local M = {} function M.dashboard_conf() local dashboard = require('alpha.themes.dashboard') local button = dashboard.button dashboard.section.header = { type = 'text', val = { [[<-. (`-')_ (`-') _ (`-') _ <-. (`-') ]], [[ \( OO) ) ( OO).-/ .-> _(OO ) (_) \(OO )_ ]], [[,--./ ,--/ (,------.(`-')----. ,--.(_/,-.\ ,-(`-'),--./ ,-.)]], [[| \ | | | .---'( OO).-. '\ \ / (_/ | ( OO)| `.' |]], [[| . '| |)(| '--. ( _) | | | \ / / | | )| |'.'| |]], [[| |\ | | .--' \| |)| |_ \ /_)(| |_/ | | | |]], [[| | \ | | `---. ' '-' '\-'\ / | |'->| | | |]], [[`--' `--' `------' `-----' `-' `--' `--' `--']] }, opts = { position = 'center', -- wrap = 'overflow', hl = 'DashboardHeader' } } dashboard.section.footer = { type = 'text', val = 'おかえりなさい', opts = { position = 'center', hl = 'DashboardFooter' } } button = function(sc, txt, keybind, keybind_opts) local sc_ = sc:gsub('%s', ''):gsub('SPC', '') local opts = { position = 'center', shortcut = sc, cursor = 5, width = 50, align_shortcut = 'right', hl = 'DashboardCenter', hl_shortcut = 'DashboardShortcut', } if keybind then keybind_opts = vim.F.if_nil(keybind_opts, {noremap = true, silent = true, nowait = true}) opts.keymap = {'n', sc_, keybind, keybind_opts} end local function on_press() local key = vim.api.nvim_replace_termcodes(sc_ .. '', true, false, true) vim.api.nvim_feedkeys(key, 'normal', false) end return { type = 'button', val = txt, on_press = on_press, opts = opts, } end dashboard.section.buttons = { type = 'group', val = { button('SPC b n', ' New file'), button('SPC f f', ' Find file'), button('SPC f o', ' Recent files'), button('SPC f g', ' Find word'), button('SPC f m', ' Bookmarks'), button('SPC e l', ' Load last session') }, opts = {spacing = 1} } require('alpha').setup { layout = { {type = 'padding', val = 4}, dashboard.section.header, {type = 'padding', val = 2}, dashboard.section.buttons, dashboard.section.footer }, opts = {margin = 5} } -- Hide tabline in dashboard buffer vim.api.nvim_command [[ autocmd FileType alpha set showtabline=0 | autocmd BufUnload set showtabline=2 ]] end function M.statusline_conf() local gl = require('galaxyline') local gls = gl.section local condition = require('galaxyline.condition') local colors = require('colors.' .. vim.g.global_theme).colors gl.short_line_list = {'NvimTree', 'packer', 'Outline'} gls.left[1] = { LeftCorner = { provider = function() return '▊ ' end, highlight = {colors.blue, colors.grey1} } } gls.left[2] = { ViMode = { provider = function() local mode_color = { n = colors.green, -- Normal no = colors.green, -- N-Pending i = colors.blue, -- Insert ic = colors.blue, -- Insert v = colors.yellow, -- Visual [''] = colors.yellow, -- V-Block V = colors.yellow, -- V-Line c = colors.white2, -- Command s = colors.purple, -- Select S = colors.purple, -- S-Line [''] = colors.purple, -- S-Block R = colors.red, -- Replace Rv = colors.red, -- V-Replace cv = colors.white2, -- Vim-Ex ce = colors.white2, -- Ex r = colors.cyan, -- Prompt rm = colors.cyan, -- More ['r?'] = colors.cyan, -- Confirm ['!'] = colors.orange, -- Shell t = colors.orange -- Terminal } vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) return ' ' end, highlight = {colors.green, colors.grey1} } } gls.left[3] = { FileSize = { provider = 'FileSize', condition = condition.buffer_not_empty, highlight = {colors.fg, colors.grey1} } } gls.left[4] ={ FileIcon = { provider = 'FileIcon', condition = condition.buffer_not_empty, highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.grey1 } } } gls.left[5] = { FileName = { provider = 'FileName', condition = condition.buffer_not_empty, highlight = {colors.fg, colors.grey1, 'bold'} } } gls.left[6] = { LineInfo = { provider = 'LineColumn', highlight = {colors.fg, colors.grey1} } } gls.left[7] = { PerCent = { provider = 'LinePercent', highlight = {colors.fg, colors.grey1, 'bold'} } } gls.left[8] = { DiagnosticError = { provider = 'DiagnosticError', icon = '  ', highlight = {colors.red, colors.grey1} } } gls.left[9] = { DiagnosticWarn = { provider = 'DiagnosticWarn', icon = '  ', highlight = {colors.yellow, colors.grey1} } } gls.left[10] = { DiagnosticHint = { provider = 'DiagnosticHint', icon = '  ', highlight = {colors.cyan, colors.grey1} } } gls.left[11] = { DiagnosticInfo = { provider = 'DiagnosticInfo', icon = '  ', highlight = {colors.blue, colors.grey1} } } gls.right[1] = { ShowLspClient = { provider = 'GetLspClient', condition = function () local tbl = {['dashboard'] = true, [''] = true} if tbl[vim.bo.filetype] then return false end return true end, icon = ' LSP:', highlight = {colors.purple, colors.grey1, 'bold'} } } gls.right[2] = { FileEncode = { provider = 'FileEncode', condition = condition.hide_in_width, separator = ' ', separator_highlight = {'NONE', colors.grey1}, highlight = {colors.fg, colors.grey1} } } gls.right[3] = { FileFormat = { provider = 'FileFormat', condition = condition.hide_in_width, separator = ' ', separator_highlight = {'NONE', colors.grey1}, highlight = {colors.fg, colors.grey1} } } gls.right[4] = { GitIcon = { provider = function() return '  ' end, condition = condition.check_git_workspace, separator = ' ', separator_highlight = {'NONE', colors.grey1}, highlight = {colors.green, colors.grey1, 'bold'} } } gls.right[5] = { GitBranch = { provider = 'GitBranch', condition = condition.check_git_workspace, highlight = {colors.green, colors.grey1, 'bold'} } } gls.right[6] = { GitSeparator = { provider = function() return ' ' end, highlight = {colors.green, colors.grey1} } } gls.right[7] = { DiffAdd = { provider = 'DiffAdd', condition = condition.hide_in_width, icon = ' ', highlight = {colors.green, colors.grey1} } } gls.right[8] = { DiffModified = { provider = 'DiffModified', condition = condition.hide_in_width, icon = '柳', highlight = {colors.yellow, colors.grey1} } } gls.right[9] = { DiffRemove = { provider = 'DiffRemove', condition = condition.hide_in_width, icon = ' ', highlight = {colors.red, colors.grey1} } } gls.short_line_left[1] = { BufferType = { provider = 'FileTypeName', separator = ' ', separator_highlight = {'NONE', colors.grey1}, highlight = {colors.blue, colors.grey1, 'bold'} } } gls.short_line_left[2] = { SFileName = { provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.fg, colors.grey1, 'bold'} } } gls.short_line_right[1] = { BufferIcon = { provider= 'BufferIcon', highlight = {colors.fg, colors.grey1} } } end function M.bufferline_conf() require('bufferline').setup { options = { numbers = 'none', max_name_length = 16, max_prefix_length = 14, tab_size = 20, diagnostics = 'nvim_lsp', show_close_icon = false, show_buffer_icons = true, show_tab_indicators = true, enforce_regular_tabs = false, show_buffer_close_icons = true, always_show_bufferline = true, offsets = { {filetype = 'NvimTree', text = 'NvimTree', text_align = 'left'}, {filetype = 'packer', text = 'Packer', text_align = 'left'} }, separator_style = 'thin' }, highlights = { fill = {guibg = {attribute = 'bg', highlight = 'TabLineFill'}}, indicator_selected = {guifg = {attribute = 'fg', highlight = 'TabLineSel'}} } } end function M.nvimtree_conf() vim.g.nvim_tree_width = 35 vim.g.nvim_tree_ignore = {'.git', '.hg', '.svn', 'node_modules'} vim.g.nvim_tree_auto_open = 0 vim.g.nvim_tree_auto_close = 1 vim.g.nvim_tree_auto_ignore_ft = {'dashboard'} vim.g.nvim_tree_follow = 1 vim.g.nvim_tree_indent_markers = 1 vim.g.nvim_tree_git_hl = 1 vim.g.nvim_tree_auto_resize = 0 -- vim.g.nvim_tree_add_trailing = 1 vim.g.nvim_tree_lsp_diagnostics = 1 vim.g.nvim_tree_icons = { default = '', symlink = '', git = { unstaged = '', staged = '', unmerged = '', renamed = '', untracked = '★', deleted = '', ignored = '' }, folder = { arrow_open = '', arrow_closed = '', default = '', open = '', empty = '', empty_open = '', symlink = '', symlink_open = '' }, lsp = { hint = '', info = '', warning = '', error = '' } } end function M.whichkey_conf() require('which-key').setup { plugins = { spelling = { enabled = true, suggestions = 30 } }, icons = { breadcrumb = '»', separator = 'ﰲ', group = '+' }, layout = { align = 'center' } } end function M.gitsigns_conf() require('gitsigns').setup { signs = { add = {hl = 'DiffAdd' , text = '', numhl='GitSignsAddNr'}, change = {hl = 'DiffChange', text = '', numhl='GitSignsChangeNr'}, delete = {hl = 'DiffDelete', text = '', numhl='GitSignsDeleteNr'}, topdelete = {hl = 'DiffDelete', text = '', numhl='GitSignsDeleteNr'}, changedelete = {hl = 'DiffChange', text = '', numhl='GitSignsChangeNr'} }, numhl = true, keymaps = { -- Default keymap options noremap = true, buffer = true, ['n ]g'] = {expr = true, '&diff ? \']g\' : \'lua require"gitsigns.actions".next_hunk()\''}, ['n [g'] = {expr = true, '&diff ? \'[g\' : \'lua require"gitsigns.actions".prev_hunk()\''}, ['n gs'] = 'lua require"gitsigns".stage_hunk()', ['v gs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', ['n gu'] = 'lua require"gitsigns".undo_stage_hunk()', ['n gr'] = 'lua require"gitsigns".reset_hunk()', ['v gr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', ['n gR'] = 'lua require"gitsigns".reset_buffer()', ['n gp'] = 'lua require"gitsigns".preview_hunk()', ['n gb'] = 'lua require"gitsigns".blame_line(true)' }, watch_index = { interval = 1000, follow_files = true }, current_line_blame = false, current_line_blame_opts = { delay = 1000, virt_text = true, virt_text_pos = 'eol' }, sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default word_diff = false, use_internal_diff = true -- If luajit is present } end return M