From 8396fe1ae13c85f3fd398c5bcc7ef66719997a3f Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Thu, 8 Jul 2021 23:08:10 +0300 Subject: [PATCH] neovim: add indent-blankline, use which-key for mappings Also add more nord highlight groups --- home/.config/nvim/lua/colors/nord.lua | 139 +++++++++++----- home/.config/nvim/lua/colors/onedark.lua | 22 +-- home/.config/nvim/lua/events.lua | 7 +- home/.config/nvim/lua/mappings.lua | 168 ++++++++++++-------- home/.config/nvim/lua/modules/blankline.lua | 45 ++++++ home/.config/nvim/lua/modules/colorizer.lua | 4 +- home/.config/nvim/lua/modules/dashboard.lua | 3 +- home/.config/nvim/lua/modules/gitgutter.lua | 6 +- home/.config/nvim/lua/modules/nvimtree.lua | 4 +- home/.config/nvim/lua/modules/terminal.lua | 30 ++-- home/.config/nvim/lua/modules/whichkey.lua | 16 ++ home/.config/nvim/lua/options.lua | 2 +- home/.config/nvim/lua/plugins.lua | 12 +- home/.config/starship.toml | 1 - 14 files changed, 312 insertions(+), 147 deletions(-) create mode 100644 home/.config/nvim/lua/modules/blankline.lua create mode 100644 home/.config/nvim/lua/modules/whichkey.lua diff --git a/home/.config/nvim/lua/colors/nord.lua b/home/.config/nvim/lua/colors/nord.lua index 5be6fa6..0f87e2e 100644 --- a/home/.config/nvim/lua/colors/nord.lua +++ b/home/.config/nvim/lua/colors/nord.lua @@ -1,18 +1,13 @@ local M = {} local function hi(group, guifg, guibg, attr, guisp) - if guifg ~= '' then - vim.cmd('hi ' .. group .. ' guifg=' .. guifg) - end - if guibg ~= '' then - vim.cmd('hi ' .. group .. ' guibg=' .. guibg) - end - if attr ~= '' then - vim.cmd('hi ' .. group .. ' gui=' .. attr) - end - if guisp ~= '' then - vim.cmd('hi ' .. group .. ' guisp=' .. guisp) - end + local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE' + local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE' + local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE' + local sp = guisp ~= '' and 'guisp=' .. guisp or '' + + local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp + vim.cmd(hl) end M.colors = { @@ -33,8 +28,7 @@ M.colors = { yellow = '#EBCB8B', green = '#A3BE8C', purple = '#B48EAD', - highlight = '#7B88A1', - none = 'NONE' + highlight = '#7B88A1' } local c = M.colors @@ -57,14 +51,14 @@ function M.highlight() -- Editor hi('ColorColumn', '' , c.grey1, '', '') hi('Cursor' , c.black , c.fg , '', '') - hi('CursorLine' , c.grey1 , '' , 'NONE', '') + hi('CursorLine' , c.grey1 , '' , '', '') hi('Error' , c.fg , c.red , '', '') hi('iCursor' , c.black , c.fg , '', '') - hi('LineNr' , c.grey3 , c.none , '', '') + hi('LineNr' , c.grey3 , '' , '', '') hi('MatchParen' , c.cyan , c.grey3, '', '') hi('NonText' , c.grey2 , '' , '', '') hi('Normal' , c.fg , c.black, '', '') - hi('Pmenu' , c.fg , c.grey2, 'NONE', '') + hi('Pmenu' , c.fg , c.grey2, '', '') hi('PmenuSbar' , c.fg , c.grey2, '', '') hi('PmenuSel' , c.cyan , c.grey3, '', '') hi('PmenuThumb' , c.cyan , c.grey3, '', '') @@ -82,11 +76,11 @@ function M.highlight() hi('TermCursorNC' , '' , c.grey2, '', '') -- Gutter - hi('CursorColumn', c.grey1, '' , '' , '') - hi('CursorLineNr', c.fg , '' , 'NONE', '') - hi('Folded' , c.grey3, c.grey1, 'bold', '') - hi('FoldColumn' , c.grey3, c.black, '' , '') - hi('SignColumn' , c.grey1, c.black, '' , '') + hi('CursorColumn', c.grey1, '' , '', '') + hi('CursorLineNr', c.fg , '' , '', '') + hi('Folded' , c.grey3, c.grey1, '', '') + hi('FoldColumn' , c.grey3, c.black, '', '') + hi('SignColumn' , c.grey1, c.black, '', '') -- Navigation hi('Directory', c.cyan, '', '', '') @@ -101,23 +95,23 @@ function M.highlight() hi('WildMenu' , c.cyan , c.grey1 , '', '') -- Statusline - hi('StatusLine' , c.cyan, c.grey3, 'NONE', '') - hi('StatusLineNC' , c.fg , c.grey3, 'NONE', '') - hi('StatusLineTerm' , c.cyan, c.grey3, 'NONE', '') - hi('StatusLineTermNC', c.fg , c.grey3, 'NONE', '') + hi('StatusLine' , c.cyan, c.grey3, '', '') + hi('StatusLineNC' , c.fg , c.grey3, '', '') + hi('StatusLineTerm' , c.cyan, c.grey3, '', '') + hi('StatusLineTermNC', c.fg , c.grey3, '', '') -- Search hi('IncSearch', c.white2, c.dark_blue, 'underline', '') - hi('Search' , c.grey1 , c.cyan , 'NONE' , '') + hi('Search' , c.grey1 , c.cyan , '' , '') -- Tabline - hi('TabLine' , c.fg , c.grey1, 'NONE', '') - hi('TabLineFill', c.fg , c.grey1, 'NONE', '') - hi('TabLineSel' , c.cyan, c.grey3, 'NONE', '') + hi('TabLine' , c.fg , c.grey1, '', '') + hi('TabLineFill', c.fg , c.grey1, '', '') + hi('TabLineSel' , c.cyan, c.grey3, '', '') -- Window - hi('Title', c.fg, '', 'NONE', '') - hi('VertSplit', c.grey2, c.black, 'NONE', '') + hi('Title', c.fg, '', '', '') + hi('VertSplit', c.grey2, c.black, '', '') -------------------------- -- Language base groups -- @@ -133,13 +127,13 @@ function M.highlight() hi('Exception', c.blue, '', '', '') hi('Float', c.purple, '', '', '') hi('Function', c.cyan, '', '', '') - hi('Identifier', c.fg, '', 'NONE', '') + hi('Identifier', c.fg, '', '', '') hi('Include', c.blue, '', '', '') hi('Keyword', c.blue, '', '', '') hi('Label', c.blue, '', '', '') hi('Number', c.purple, '', '', '') - hi('Operator', c.blue, '', 'NONE', '') - hi('PreProc', c.blue, '', 'NONE', '') + hi('Operator', c.blue, '', '', '') + hi('PreProc', c.blue, '', '', '') hi('Repeat', c.blue, '', '', '') hi('Special', c.fg, '', '', '') hi('SpecialChar', c.yellow, '', '', '') @@ -149,8 +143,8 @@ function M.highlight() hi('String', c.green, '', '', '') hi('Structure', c.blue, '', '', '') hi('Tag', c.fg, '', '', '') - hi('Todo', c.yellow, c.none, '', '') - hi('Type', c.blue, '', 'NONE', '') + hi('Todo', c.yellow, '', '', '') + hi('Type', c.blue, '', '', '') hi('Typedef', c.blue, '', '', '') vim.cmd('hi! link Macro Define') vim.cmd('hi! link PreCondit PreProc') @@ -189,6 +183,15 @@ function M.highlight() hi('DiffChange', c.yellow, c.grey1, '', '') hi('DiffDelete', c.red , c.grey1, '', '') hi('DiffText' , c.blue , c.grey1, '', '') + -- Legacy diff groups for some plugins + hi('diffOldFile', c.dark_blue, c.grey1, '', '') + hi('diffNewFile', c.blue, c.grey1, '', '') + hi('diffFile', c.cyan, c.grey1, '', '') + hi('diffLine', c.purple, c.grey1, '', '') + hi('diffIndexLine', c.fg, c.grey1, '', '') + vim.cmd('hi! link diffAdded DiffAdd') + vim.cmd('hi! link diffRemoved DiffDelete') + vim.cmd('hi! link diffChanged DiffChange') --------------------- -- Plugins' groups -- @@ -198,12 +201,41 @@ function M.highlight() hi('GitSignsChangeNr', c.yellow, '', '', '') hi('GitSignsDeleteNr', c.red , '', '', '') + -- BufferLine + hi('BufferLineIndicatorSelected', c.black, '', '', '') + hi('BufferLineFill', c.black, '', '', '') + -- Dashboard hi('DashboardHeader' , c.cyan , '', 'bold' , '') hi('DashboardCenter' , c.blue , '', 'bold' , '') hi('DashboardShortcut', c.grey_bright, '', 'bold,italic', '') hi('DashboardFooter' , c.green , '', 'bold' , '') + -- NvimTree + hi('NvimTreeRootFolder' , c.teal , '', 'bold', '') + hi('NvimTreeGitDirty' , c.yellow , '', '', '') + hi('NvimTreeGitNew' , c.green , '', '', '') + hi('NvimTreeImageFile' , c.purple , '', '', '') + hi('NvimTreeExecFile' , c.green , '', '', '') + hi('NvimTreeSpecialFile' , c.dark_blue, '', 'underline', '') + hi('NvimTreeFolderName' , c.blue , '', '', '') + hi('NvimTreeEmptyFolderName', c.grey3 , '', '', '') + hi('NvimTreeFolderIcon' , c.fg , '', '', '') + hi('NvimTreeIndentMarker' , c.grey3 , '', '', '') + hi('NvimTreeNormal' , c.fg , c.black, '', '') + + -- WhichKey + hi('WhichKey' , c.green , '', 'bold', '') + hi('WhichKeyGroup' , c.cyan , '', '' , '') + hi('WhichKeyDesc' , c.blue , '', '' , '') + hi('WhichKeySeperator', c.grey3 , '', '' , '') + hi('WhichKeyFloating' , c.fg , '', '' , '') + hi('WhichKeyFloat' , c.grey_bright, '', '' , '') + + -- Indent Blankline + hi('IndentBlanklineChar', c.grey1, '', '', '') + hi('IndentBlanklineContextChar', c.grey1, '', '', '') + -- ts-rainbow hi('rainbowcol1', c.red, '', 'bold', '') hi('rainbowcol2', c.orange, '', 'bold', '') @@ -212,6 +244,39 @@ function M.highlight() hi('rainbowcol5', c.cyan, '', 'bold', '') hi('rainbowcol6', c.blue, '', 'bold', '') hi('rainbowcol7', c.purple, '', 'bold', '') + + -- Treesitter + hi('TSAnnotation' , c.orange, '', '', '') + hi('TSCharacter' , c.fg , '', '', '') + hi('TSConstructor' , c.blue , '', '', '') + hi('TSConstant' , c.fg , '', '', '') + hi('TSFloat' , c.purple, '', '', '') + hi('TSNumber' , c.purple, '', '', '') + hi('TSString' , c.green , '', '', '') + hi('TSAttribute' , c.purple, '', '', '') + hi('TSBoolean' , c.blue , '', '', '') + hi('TSConstBuiltin', c.teal , '', '', '') + hi('TSConstMacro' , c.teal , '', '', '') + hi('TSError' , c.fg , c.red, '', '') + hi('TSException' , c.red , '', 'underline', '') + hi('TSField' , c.fg , '', '', '') + hi('TSFuncMacro' , c.cyan , '', '', '') + hi('TSInclude' , c.teal , '', '', '') + hi('TSLabel' , c.blue , '', '', '') + hi('TSNamespace' , c.teal , '', '', '') + hi('TSOperator' , c.blue , '', '', '') + hi('TSParameter' , c.dark_blue, '', '', '') + hi('TSParameterReference', c.dark_blue, '', '', '') + hi('TSProperty' , c.fg , '', '', '') + hi('TSPunctDelimiter', c.white2, '', '', '') + hi('TSPunctBracket', c.white2, '', '', '') + hi('TSPunctSpecial', c.white2 , '', '', '') + hi('TSStringRegex' , c.teal, '', '', '') + hi('TSStringEscape', c.grey2, '', '', '') + hi('TSSymbol' , c.purple, '', '', '') + hi('TSType' , c.blue , '', '', '') + hi('TSTypeBuiltin' , c.blue, '', '', '') + hi('TSTag' , c.teal, '', '', '') end return M diff --git a/home/.config/nvim/lua/colors/onedark.lua b/home/.config/nvim/lua/colors/onedark.lua index 6228f71..c9c91da 100644 --- a/home/.config/nvim/lua/colors/onedark.lua +++ b/home/.config/nvim/lua/colors/onedark.lua @@ -1,18 +1,13 @@ local M = {} local function hi(group, guifg, guibg, attr, guisp) - if guifg ~= '' then - vim.cmd('hi ' .. group .. ' guifg=' .. guifg) - end - if guibg ~= '' then - vim.cmd('hi ' .. group .. ' guibg=' .. guibg) - end - if attr ~= '' then - vim.cmd('hi ' .. group .. ' gui=' .. attr) - end - if guisp ~= '' then - vim.cmd('hi ' .. group .. ' guisp=' .. guisp) - end + local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE' + local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE' + local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE' + local sp = guisp ~= '' and 'guisp=' .. guisp or '' + + local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp + vim.cmd(hl) end M.colors = { @@ -34,8 +29,7 @@ M.colors = { yellow = '#E5C07B', green = '#98C379', purple = '#C678DD', - highlight = '#9CA0A4', - none = 'NONE' + highlight = '#9CA0A4' } local c = M.colors diff --git a/home/.config/nvim/lua/events.lua b/home/.config/nvim/lua/events.lua index a750b66..a1506cd 100644 --- a/home/.config/nvim/lua/events.lua +++ b/home/.config/nvim/lua/events.lua @@ -22,8 +22,11 @@ end function M.load_autocmds() local definitions = { - packer = { - {"BufWritePost", "*.lua", "lua require('events').packer_compile()"} + plugins = { + -- Re-compile packer on config changed + {"BufWritePost", "*.lua", "lua require('events').packer_compile()"}, + -- Blankline is lazy-load + {"CursorMoved", [[* IndentBlanklineRefresh]]} }, -- Edit binary files in hex with xxd (:%!xxd and :%!xxd -r) diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index 44203c5..5475017 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -1,74 +1,72 @@ -local function map(mode, lhs, rhs, opts) - local options = {noremap = true, silent = true} - if opts then - options = vim.tbl_extend('force', options, opts) - end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) -end - -local opt = {} +local api = vim.api +local wk = require('which-key') -------------------- -- Basic bindings -- -------------------- -- No one likes Esc -map('i', 'jk', [[]], opt) +api.nvim_set_keymap('i', 'jk', [[]], {noremap = true, silent = true}) --- Better Y -map('n', 'Y', [[y$]], opt) +-- Escape to normal mode in terminal buffer +api.nvim_set_keymap('t', '', '', {noremap = true, silent = true}) -- Continuous indent -map('v', '<', '', '>gv', opt) +api.nvim_set_keymap('v', '<', '', '>gv', {noremap = true, silent = true}) --- Escape mode in terminal buffer -map('t', '', '', opt) - --- Copy the whole buffer -map('n', '', [[ %y+]], opt) --- 'Legacy' save file --- map('n', '', ':w ', opt) --- Close buffer -map('n', '', ':bd!', opt) - --- Remove trailing whitespace -map('n', '', ':%s/\\s\\+$//e', opt) - --- Resize buffer -map('n', '', ':resize -2', opt) -map('n', '', ':resize +2', opt) -map('n', '', ':vertical resize -2', opt) -map('n', '', ':vertical resize +2', opt) - --- Switch between tabs and spaces -function toggleIndentStyle() - if vim.o.expandtab == true then - vim.cmd('set noexpandtab nosmarttab softtabstop& shiftwidth&') - vim.cmd('echomsg "Switched to indent with tabs"') - else - vim.opt.expandtab = true - vim.opt.smarttab = true - vim.opt.softtabstop = 4 - vim.opt.shiftwidth = 4 - vim.cmd('echomsg "Switched to indent with 4 spaces"') - end -end -map('n', '', ':lua toggleIndentStyle()', opt) - --- Move between tabs -map('n', '', [[BufferLineCycleNext]], opt) -map('n', '', [[BufferLineCyclePrev]], opt) - --- NvimTree -map('n', '', ':NvimTreeToggle', opt) - ---------------- --- Which-key -- ---------------- -local wk = require('which-key') - --- Don't need to show bufferline numbers +-- Normal mode wk.register({ + -- Better Y + Y = {'y$', 'Yank to eol'}, + + -- Copy the whole buffer + [''] = {'%y+', 'Copy whole buffer'}, + + -- 'Legacy' save buffer + -- [''] = {':w', 'Write buffer'}, + + -- Close buffer + [''] = {':bd!', 'Close buffer'}, + + -- Remove trailing whitespace + [''] = {':%s/\\s\\+$//e', 'Remove trailing'}, + + -- Resize buffer + [''] = {':resize -2', 'Resize vertical -2'}, + [''] = {':resize +2', 'Resize vertical +2'}, + [''] = {':vertical resize -2', 'Resize horizontal -2'}, + [''] = {':vertical resize +2', 'Resize horizontal +2'}, + + -- Switch between tabs and spaces + [''] = { + function() + if vim.o.expandtab == true then + vim.cmd('set noexpandtab nosmarttab softtabstop& shiftwidth&') + vim.cmd('echomsg "Switched to indent with tabs"') + else + vim.opt.expandtab = true + vim.opt.smarttab = true + vim.opt.softtabstop = 4 + vim.opt.shiftwidth = 4 + vim.cmd('echomsg "Switched to indent with 4 spaces"') + end + end, + 'Switch indent style' + }, + + -- Naming common keys + ['['] = {name = 'Block motions (previous)'}, + [']'] = {name = 'Block motions (next)'}, + g = {name = 'Goto motions'}, + z = {name = 'Misc utils'} +}) + +------------- +-- Plugins -- +------------- +-- Normal mode +wk.register({ + -- Don't need to show bufferline numbers ['1'] = 'which_key_ignore', ['2'] = 'which_key_ignore', ['3'] = 'which_key_ignore', @@ -77,7 +75,51 @@ wk.register({ ['6'] = 'which_key_ignore', ['7'] = 'which_key_ignore', ['8'] = 'which_key_ignore', - ['9'] = 'which_key_ignore' + ['9'] = 'which_key_ignore', + + -- Move between tabs + [''] = {'BufferLineCycleNext', 'Next buffer'}, + [''] = {'BufferLineCyclePrev', 'Previous buffer'}, + + -- NvimTree + [''] = {':NvimTreeToggle', 'NvimTree'}, + + -- ToggleTerm + [''] = 'Toggle terminal', }) --- ToggleTerm +-- With leader key (normal mode) +wk.register({ + -- GitSigns + g = { + name = 'Git', + b = 'Blame current line', + i = 'Preview hunk', + n = 'Next hunk', + p = 'Previous hunk', + r = 'Reset hunk', + R = 'Reset all hunks in buffer', + s = 'Stage hunk', + u = 'Undo hunk' + }, + + -- Telescope + f = { + name = 'Telescope' + }, + + b = { + name = 'Buffer', + n = {':DashboardNewFile', 'New file'} + } +}, {prefix = ''}) + +-- With leader key (visual mode) +wk.register({ + -- GitSigns + g = { + name = 'Git', + r = 'Reset hunk', + s = 'Stage hunk' + } +}, {mode = 'v', prefix = ''}) diff --git a/home/.config/nvim/lua/modules/blankline.lua b/home/.config/nvim/lua/modules/blankline.lua new file mode 100644 index 0000000..446f071 --- /dev/null +++ b/home/.config/nvim/lua/modules/blankline.lua @@ -0,0 +1,45 @@ +local function blankline_options() + vim.g.indent_blankline_char = '│' + vim.g.indent_blankline_show_first_indent_level = true + vim.g.indent_blankline_filetype_exclude = { + 'startify', + 'dashboard', + 'dotooagenda', + 'log', + 'fugitive', + 'gitcommit', + 'packer', + 'vimwiki', + 'markdown', + 'json', + 'txt', + 'vista', + 'help', + 'todoist', + 'NvimTree', + 'peekaboo', + 'git', + 'TelescopePrompt', + 'undotree', + 'flutterToolsOutline', + '' -- for all buffers without a file type + } + vim.g.indent_blankline_buftype_exclude = {'terminal', 'nofile'} + vim.g.indent_blankline_show_trailing_blankline_indent = false + vim.g.indent_blankline_show_current_context = true + vim.g.indent_blankline_context_patterns = { + 'class', + 'function', + 'method', + 'block', + 'list_literal', + 'selector', + '^if', + '^table', + 'if_statement', + 'while', + 'for' + } +end + +blankline_options() diff --git a/home/.config/nvim/lua/modules/colorizer.lua b/home/.config/nvim/lua/modules/colorizer.lua index ba96932..e726bf6 100644 --- a/home/.config/nvim/lua/modules/colorizer.lua +++ b/home/.config/nvim/lua/modules/colorizer.lua @@ -1,4 +1,4 @@ -return require('colorizer').setup( +return require('colorizer').setup { {'*'}, { RGB = true, -- #RGB hex codes @@ -11,4 +11,4 @@ return require('colorizer').setup( css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn mode = 'background' -- Set the display mode. } -) +} diff --git a/home/.config/nvim/lua/modules/dashboard.lua b/home/.config/nvim/lua/modules/dashboard.lua index b99b372..f598d89 100644 --- a/home/.config/nvim/lua/modules/dashboard.lua +++ b/home/.config/nvim/lua/modules/dashboard.lua @@ -10,8 +10,7 @@ local function dashboard_options() b = {description = {' Recents SPC f o'}, command = 'Telescope oldfiles'}, c = {description = {' Find Word SPC f w'}, command = 'Telescope live_grep'}, d = {description = {'洛 New File SPC b n'}, command = 'DashboardNewFile'}, - e = {description = {' Bookmarks SPC f m'}, command = 'Telescope marks'}, - f = {description = {' Load Last Session SPC s l'}, command = 'SessionLoad'} + e = {description = {' Bookmarks SPC f m'}, command = 'Telescope marks'} } vim.g.dashboard_custom_header = { " ", diff --git a/home/.config/nvim/lua/modules/gitgutter.lua b/home/.config/nvim/lua/modules/gitgutter.lua index b545f5a..6919ab6 100644 --- a/home/.config/nvim/lua/modules/gitgutter.lua +++ b/home/.config/nvim/lua/modules/gitgutter.lua @@ -12,8 +12,8 @@ return require('gitsigns').setup { noremap = true, buffer = true, - ['n ]c'] = { expr = true, '&diff ? \']c\' : \'lua require"gitsigns.actions".next_hunk()\''}, - ['n [c'] = { expr = true, '&diff ? \'[c\' : \'lua require"gitsigns.actions".prev_hunk()\''}, + ['n gn'] = {expr = true, '&diff ? \'gn\' : \'lua require"gitsigns.actions".next_hunk()\''}, + ['n gp'] = {expr = true, '&diff ? \'gp\' : \'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")})', @@ -21,7 +21,7 @@ return require('gitsigns').setup { ['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 gi'] = 'lua require"gitsigns".preview_hunk()', ['n gb'] = 'lua require"gitsigns".blame_line(true)' }, watch_index = { diff --git a/home/.config/nvim/lua/modules/nvimtree.lua b/home/.config/nvim/lua/modules/nvimtree.lua index cb37cbc..32165bf 100644 --- a/home/.config/nvim/lua/modules/nvimtree.lua +++ b/home/.config/nvim/lua/modules/nvimtree.lua @@ -1,9 +1,9 @@ local function tree_options() vim.g.nvim_tree_width = 35 - vim.g.nvim_tree_ignore = { '.git', '.hg', '.svn', 'node_modules' } + vim.g.nvim_tree_ignore = {'.git', '.hg', '.svn', 'node_modules'} vim.g.nvim_tree_auto_open = 1 vim.g.nvim_tree_auto_close = 1 - vim.g.nvim_tree_auto_ignore_ft = { 'dashboard' } + 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 diff --git a/home/.config/nvim/lua/modules/terminal.lua b/home/.config/nvim/lua/modules/terminal.lua index 1a91861..284a567 100644 --- a/home/.config/nvim/lua/modules/terminal.lua +++ b/home/.config/nvim/lua/modules/terminal.lua @@ -1,20 +1,14 @@ -local M = {} - -M.config = function() - require('toggleterm').setup { - open_mapping = [[]], - shade_terminals = false, - float_opts = { - border = 'curved', - width = 80, - height = 80, - winblend = 3, - highlights = { - border = 'Normal', - background = 'Normal' - } +return require('toggleterm').setup { + open_mapping = [[]], + shade_terminals = false, + float_opts = { + border = 'curved', + width = 80, + height = 80, + winblend = 3, + highlights = { + border = 'Normal', + background = 'Normal' } } -end - -return M +} diff --git a/home/.config/nvim/lua/modules/whichkey.lua b/home/.config/nvim/lua/modules/whichkey.lua new file mode 100644 index 0000000..7c47e71 --- /dev/null +++ b/home/.config/nvim/lua/modules/whichkey.lua @@ -0,0 +1,16 @@ +return require('which-key').setup { + plugins = { + spelling = { + enabled = true, + suggestions = 30 + } + }, + icons = { + breadcrumb = "»", + separator = "ﰲ", + group = "+" + }, + layout = { + align = 'center' + } +} diff --git a/home/.config/nvim/lua/options.lua b/home/.config/nvim/lua/options.lua index 2f70c1a..ef73282 100644 --- a/home/.config/nvim/lua/options.lua +++ b/home/.config/nvim/lua/options.lua @@ -6,7 +6,7 @@ local function load_options() vim.cmd('set iskeyword+=-') -- General settings - opt.mouse = 'a' + opt.mouse = 'nv' opt.errorbells = false opt.visualbell = false opt.hidden = true diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index d002a20..a884710 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -43,14 +43,16 @@ return packer.startup( } use { 'folke/which-key.nvim', - require('which-key').setup() + config = function() + require('modules.whichkey') + end } -- Utils use { 'akinsho/nvim-toggleterm.lua', config = function() - require('modules.terminal').config() + require('modules.terminal') end } @@ -72,6 +74,12 @@ return packer.startup( vim.cmd('ColorizerReloadAllBuffers') end } + use { + 'lukas-reineke/indent-blankline.nvim', + config = function() + require('modules.blankline') + end + } use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', diff --git a/home/.config/starship.toml b/home/.config/starship.toml index fb182da..a568896 100644 --- a/home/.config/starship.toml +++ b/home/.config/starship.toml @@ -304,7 +304,6 @@ disabled = false python_binary = "python3" pyenv_version_name = false pyenv_prefix = "pyenv" -scan_for_pyfiles = true symbol = " " style = "yellow bold" format = "via [${symbol}${pyenv_prefix}${version}( \\($virtualenv\\))]($style) "