diff --git a/nvim/.config/nvim/after/plugin/asyncdo.vim b/nvim/.config/nvim/after/plugin/asyncdo.vim deleted file mode 100644 index 1f435ea..0000000 --- a/nvim/.config/nvim/after/plugin/asyncdo.vim +++ /dev/null @@ -1,7 +0,0 @@ -" Async Make mappings -nnoremap b :Make -nnoremap B :LMake - -" Asynchronous make -command! -bang -nargs=* -complete=file Make call asyncdo#run(0, &makeprg, ) -command! -bang -nargs=* -complete=file LMake call asyncdo#lrun(0, &makeprg, ) diff --git a/nvim/.config/nvim/after/plugin/better-whitespace.vim b/nvim/.config/nvim/after/plugin/better-whitespace.vim deleted file mode 100644 index a74ade3..0000000 --- a/nvim/.config/nvim/after/plugin/better-whitespace.vim +++ /dev/null @@ -1,4 +0,0 @@ -let g:better_whitespace_enabled = 1 -let g:strip_whitespace_on_save = 1 -let g:better_whitespace_operator = '' -let g:strip_whitespace_confirm = 0 diff --git a/nvim/.config/nvim/after/plugin/completion.vim b/nvim/.config/nvim/after/plugin/completion.vim deleted file mode 100644 index 4c41fe2..0000000 --- a/nvim/.config/nvim/after/plugin/completion.vim +++ /dev/null @@ -1,49 +0,0 @@ -let g:completion_enable_auto_popup = 0 -let g:completion_auto_change_source = 1 -let g:completion_trigger_on_delete = 1 -let g:completion_matching_ignore_case = 0 -let g:completion_matching_strategy_list = ['exact', 'substring'] - -let g:completion_chain_complete_list = { - \ 'c': [ - \ {'complete_items': ['buffers']}, - \ {'mode': 'tags'}, - \ {'mode': 'keyn'}, - \ {'mode': ''}, - \ {'mode': ''} - \], - \ 'haskell': [ - \ {'complete_items': ['lsp']}, - \ {'complete_items': ['buffers']}, - \ {'mode': 'keyn'}, - \ {'mode': ''}, - \ {'mode': ''}, - \], - \ 'rust': [ - \ {'complete_items': ['lsp']}, - \ {'complete_items': ['buffers']}, - \ {'mode': 'keyn'} - \], - \ 'purescript': [ - \ {'complete_items': ['lsp']}, - \ {'complete_items': ['buffers']}, - \ {'mode': 'keyn'}, - \ {'mode': ''}, - \ {'mode': ''} - \], - \ 'default': [ - \ {'complete_items': ['buffers']}, - \ {'mode': 'keyn'}, - \ {'mode': ''}, - \ {'mode': ''}, - \], - \} - -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" -imap (completion_smart_tab) -imap (completion_next_source) -imap (completion_prev_source) - -" Use completion-nvim in every buffer -autocmd BufEnter * lua require'completion'.on_attach() diff --git a/nvim/.config/nvim/after/plugin/diagnostic.vim b/nvim/.config/nvim/after/plugin/diagnostic.vim deleted file mode 100644 index 975a72a..0000000 --- a/nvim/.config/nvim/after/plugin/diagnostic.vim +++ /dev/null @@ -1,4 +0,0 @@ -let g:diagnostic_enable_virtual_text = 0 -let g:diagnostic_show_sign = 1 -let g:diagnostic_auto_popup_while_jump = 1 -let g:diagnostic_insert_delay = 1 diff --git a/nvim/.config/nvim/after/plugin/floaterm.vim b/nvim/.config/nvim/after/plugin/floaterm.vim deleted file mode 100644 index 83e0875..0000000 --- a/nvim/.config/nvim/after/plugin/floaterm.vim +++ /dev/null @@ -1,9 +0,0 @@ -let g:floaterm_open_in_root = 0 -let g:floaterm_position = 'center' -let g:floaterm_width = 0.8 -let g:floaterm_height = 0.8 -let g:floaterm_winblend = 0 -let g:floaterm_borderchars = ['─', '│', '─', '│', '╭', '╮', '╯', '╰'] - -nnoremap :FloatermToggle -tnoremap :FloatermToggle diff --git a/nvim/.config/nvim/after/plugin/fzf-preview.vim b/nvim/.config/nvim/after/plugin/fzf-preview.vim deleted file mode 100644 index 6daddbf..0000000 --- a/nvim/.config/nvim/after/plugin/fzf-preview.vim +++ /dev/null @@ -1,9 +0,0 @@ -nnoremap fg :FZFGGrep -nnoremap fG :FZFGrep -nnoremap fl :FZFBLines -nnoremap f\ :FZFRg -nnoremap fS :exe ':FZFRg ' . expand('') -nnoremap ft :exe ':FZFTags ' . expand('') -nnoremap fT :FZFTags -nnoremap fq :cclose:FZFQuickFix -nnoremap fQ :lclose:FZFLocList diff --git a/nvim/.config/nvim/after/plugin/fzf.vim b/nvim/.config/nvim/after/plugin/fzf.vim deleted file mode 100644 index b03e540..0000000 --- a/nvim/.config/nvim/after/plugin/fzf.vim +++ /dev/null @@ -1,23 +0,0 @@ -let $FZF_DEFAULT_OPTS="--layout=reverse --bind \"Ctrl-n:preview-down,Ctrl-p:preview-up\"" -let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } - -nnoremap b :Buffers -nnoremap B :History -nnoremap / :GFiles? -nnoremap ff :GFiles -nnoremap fF :Files -nnoremap fL :Lines -nnoremap fc :BCommits -nnoremap fC :Commits -nnoremap fh :History: -nnoremap fH :History/ -nnoremap fm :Commands -nnoremap fo :Locate -nnoremap fk :Maps -nnoremap f/ :Rg -nnoremap fs :exe ':Rg ' . expand('') - -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-file) -imap (fzf-complete-line) diff --git a/nvim/.config/nvim/after/plugin/rainbow.vim b/nvim/.config/nvim/after/plugin/rainbow.vim deleted file mode 100644 index e2c01c7..0000000 --- a/nvim/.config/nvim/after/plugin/rainbow.vim +++ /dev/null @@ -1 +0,0 @@ -let g:rainbow_active = 1 diff --git a/nvim/.config/nvim/after/plugin/signify.vim b/nvim/.config/nvim/after/plugin/signify.vim deleted file mode 100644 index 316da9b..0000000 --- a/nvim/.config/nvim/after/plugin/signify.vim +++ /dev/null @@ -1,10 +0,0 @@ -nnoremap ghu :SignifyHunkUndo -nnoremap ghp :SignifyHunkDiff -nmap ]c (signify-next-hunk) -nmap [c (signify-prev-hunk) -nmap ]C 9999]c -nmap [C 9999[c -omap ih (signify-motion-inner-pending) -xmap ih (signify-motion-inner-visual) -omap ah (signify-motion-outer-pending) -xmap ah (signify-motion-outer-visual) diff --git a/nvim/.config/nvim/after/plugin/togglelist.vim b/nvim/.config/nvim/after/plugin/togglelist.vim deleted file mode 100644 index f7375af..0000000 --- a/nvim/.config/nvim/after/plugin/togglelist.vim +++ /dev/null @@ -1,2 +0,0 @@ -nnoremap qt :call ToggleQuickfixList() -nnoremap Lt :call ToggleLocationList() diff --git a/nvim/.config/nvim/after/plugin/vim-sneak.vim b/nvim/.config/nvim/after/plugin/vim-sneak.vim deleted file mode 100644 index 9c43dca..0000000 --- a/nvim/.config/nvim/after/plugin/vim-sneak.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Replace 'f' with 1 character sneak -nmap f Sneak_f -nmap F Sneak_F -xmap f Sneak_f -xmap F Sneak_F -omap f Sneak_f -omap F Sneak_F -" Replace 't' with 1 character sneak -nmap t Sneak_t -nmap T Sneak_T -xmap t Sneak_t -xmap T Sneak_T -omap t Sneak_t -omap T Sneak_T -" Two character sneak -nmap s Sneak_s -nmap S Sneak_S diff --git a/nvim/.config/nvim/after/plugin/vimtex.vim b/nvim/.config/nvim/after/plugin/vimtex.vim deleted file mode 100644 index bb6b098..0000000 --- a/nvim/.config/nvim/after/plugin/vimtex.vim +++ /dev/null @@ -1,3 +0,0 @@ -let g:vimtex_view_general_viewer = 'qpdfview' -let g:vimtex_view_general_options = '--unique @pdf\#src:@tex:@line:@col' -let g:vimtex_view_general_options_latexmk = '--unique' diff --git a/nvim/.config/nvim/after/plugin/which_key.vim b/nvim/.config/nvim/after/plugin/which_key.vim deleted file mode 100644 index fb286a1..0000000 --- a/nvim/.config/nvim/after/plugin/which_key.vim +++ /dev/null @@ -1,4 +0,0 @@ -let g:which_key_use_floating_win = 1 - -nnoremap :WhichKey '' -nnoremap :WhichKey ',' diff --git a/nvim/.config/nvim/after/plugin/workspace.vim b/nvim/.config/nvim/after/plugin/workspace.vim deleted file mode 100644 index 779e3e2..0000000 --- a/nvim/.config/nvim/after/plugin/workspace.vim +++ /dev/null @@ -1,7 +0,0 @@ -let g:workspace_session_directory = $HOME . '/.vim/session/' -let g:workspace_undodir = $HOME . '/.vim/undodir' -let g:workspace_autosave = 0 -let g:workspace_autosave_ignore = ['gitcommit', 'qf', 'tagbar'] -let g:workspace_session_disable_on_args = 1 - -nnoremap ps :ToggleWorkspace diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 3297b28..fd108c4 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -1,10 +1,9 @@ -" Set up leader keys. FIXME: Move this to lua +" Set up leader let mapleader="\" let maplocalleader="," -" Use Tab & S-Tab instead of C-g and C-t for incsearch. FIXME: Move this to lua -cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] -cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] -" Initialise + lua require 'init' -" This seems to be required here else our colorscheme does not load + +" This seems to be required here as well as in init.lua else the colorscheme +" does not take effect or load colorscheme yolokai diff --git a/nvim/.config/nvim/lua/init.lua b/nvim/.config/nvim/lua/init.lua index ae095ba..b1dceb2 100644 --- a/nvim/.config/nvim/lua/init.lua +++ b/nvim/.config/nvim/lua/init.lua @@ -62,8 +62,13 @@ vim.g.loaded_zipPlugin = 1 vim.g.quickr_cscope_keymaps = 0 -- Needs to be set before vimtex gets loaded, else it complains vim.g.tex_flavor = 'latex' +vim.g.vimtex_view_general_viewer = 'qpdfview' +vim.g.vimtex_view_general_options = '--unique \\@pdf\\#src:@tex:@line:@col' +vim.g.vimtex_view_general_options_latexmk = '--unique' -- Needs to be before togglelist gets loadded vim.g.toggle_list_no_mappings = 1 +-- Enable rainbow brackets everywhere +vim.g.rainbow_active = 1 -- Needs to be set before vim-sneak is loaded vim.api.nvim_command('let g:sneak#label = 1') vim.api.nvim_command('let g:sneak#s_next = 1') @@ -97,3 +102,16 @@ require 'keymappings' require 'plugins' require 'lsp' require 'treesitter' +-- Load plugin specific settings +require 'modules.asyncdo' +require 'modules.better-whitespace' +require 'modules.completion' +require 'modules.diagnostic' +require 'modules.floaterm' +require 'modules.fzf' +require 'modules.fzf-preview' +require 'modules.signify' +require 'modules.sneak' +require 'modules.togglelist' +require 'modules.which_key' +require 'modules.workspace' diff --git a/nvim/.config/nvim/lua/keymappings.lua b/nvim/.config/nvim/lua/keymappings.lua index 4fe0179..a7ed471 100644 --- a/nvim/.config/nvim/lua/keymappings.lua +++ b/nvim/.config/nvim/lua/keymappings.lua @@ -111,3 +111,7 @@ remap('v', 'N', 'Nzz', { noremap = true }) remap('v', '.', ':norm.', { noremap = true }) -- Go to the last file we changed remap('n', '', '', { noremap = true }) + +-- Use Tab & S-Tab instead of C-g and C-t for incsearch +remap('c', '', 'getcmdtype() =~ \'[?/]\' ? \'\' : feedkeys(\'\', \'int\')[1]', { noremap = true, expr = true }) +remap('c', '', 'getcmdtype() =~ \'[?/]\' ? \'\' : feedkeys(\'\', \'int\')[1]', { noremap = true, expr = true }) diff --git a/nvim/.config/nvim/lua/modules/asyncdo.lua b/nvim/.config/nvim/lua/modules/asyncdo.lua new file mode 100644 index 0000000..43d02a7 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/asyncdo.lua @@ -0,0 +1,7 @@ +local remap = vim.api.nvim_set_keymap + +remap('n', 'b', ':Make', { noremap = true }) +remap('n', 'B', ':LMake', { noremap = true }) + +vim.api.nvim_command('command! -bang -nargs=* -complete=file Make call asyncdo#run(0, &makeprg, )') +vim.api.nvim_command('command! -bang -nargs=* -complete=file LMake call asyncdo#lrun(0, &makeprg, )') diff --git a/nvim/.config/nvim/lua/modules/better-whitespace.lua b/nvim/.config/nvim/lua/modules/better-whitespace.lua new file mode 100644 index 0000000..4bd7672 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/better-whitespace.lua @@ -0,0 +1,4 @@ +vim.g.better_whitespace_enabled = 1 +vim.g.strip_whitespace_on_save = 1 +vim.g.better_whitespace_operator = '' +vim.g.strip_whitespace_confirm = 0 diff --git a/nvim/.config/nvim/lua/modules/completion.lua b/nvim/.config/nvim/lua/modules/completion.lua new file mode 100644 index 0000000..938e15d --- /dev/null +++ b/nvim/.config/nvim/lua/modules/completion.lua @@ -0,0 +1,43 @@ +local remap = vim.api.nvim_set_keymap + +vim.g.completion_enable_auto_popup = 0 +vim.g.completion_auto_change_source = 1 +vim.g.completion_trigger_on_delete = 1 +vim.g.completion_matching_ignore_case = 0 +vim.g.completion_matching_strategy_list = { 'exact', 'substring' } + +vim.g.completion_chain_complete_list = { + c = { + { complete_items = { 'buffers' } }, + { mode = { 'tags' } }, + { mode = { 'keyn' } }, + { mode = { '' } }, + { mode = { '' } } + }, + haskell = { + { complete_items = { 'buffers', 'lsp' } }, + { mode = { 'keyn' } }, + { mode = { '' } }, + { mode = { '' } } + }, + rust = { + { complete_items = { 'buffers', 'lsp' } }, + { mode = { 'keyn' } }, + { mode = { '' } }, + { mode = { '' } } + }, + default = { + { complete_items = { 'buffers' } }, + { mode = { 'keyn' } }, + { mode = { '' } }, + { mode = { '' } } + }, +} + +remap('i', '', 'pumvisible() ? "" : ""', { noremap = true, expr = true }) +remap('i', '', 'pumvisible() ? "" : ""', { noremap = true, expr = true }) +remap('i', '', '(completion_smart_tab)', { noremap = false }) +remap('i', '', '(completion_next_source)', { noremap = false }) +remap('i', '', '(completion_prev_source)', { noremap = false }) + +vim.api.nvim_command('autocmd BufEnter * lua require\'completion\'.on_attach()') diff --git a/nvim/.config/nvim/lua/modules/diagnostic.lua b/nvim/.config/nvim/lua/modules/diagnostic.lua new file mode 100644 index 0000000..dc7fdc6 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/diagnostic.lua @@ -0,0 +1,4 @@ +vim.g.diagnostic_enable_virtual_text = 0 +vim.g.diagnostic_show_sign = 1 +vim.g.diagnostic_auto_popup_while_jump = 1 +vim.g.diagnostic_insert_delay = 1 diff --git a/nvim/.config/nvim/lua/modules/floaterm.lua b/nvim/.config/nvim/lua/modules/floaterm.lua new file mode 100644 index 0000000..1a01551 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/floaterm.lua @@ -0,0 +1,11 @@ +local remap = vim.api.nvim_set_keymap + +vim.g.floaterm_open_in_root = 0 +vim.g.floaterm_position = 'center' +vim.g.floaterm_width = 0.8 +vim.g.floaterm_height = 0.8 +vim.g.floaterm_winblend = 0 +vim.g.floaterm_borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'} + +remap('n', '', ':FloatermToggle', { noremap = true, silent = true }) +remap('t', '', ':FloatermToggle', { noremap = true, silent = true }) diff --git a/nvim/.config/nvim/lua/modules/fzf-preview.lua b/nvim/.config/nvim/lua/modules/fzf-preview.lua new file mode 100644 index 0000000..c81043c --- /dev/null +++ b/nvim/.config/nvim/lua/modules/fzf-preview.lua @@ -0,0 +1,11 @@ +local remap = vim.api.nvim_set_keymap + +remap('n', 'fg', ':FZFGGrep', { noremap = true }) +remap('n', 'fG', ':FZFGrep', { noremap = true }) +remap('n', 'fl', ':FZFBLines', { noremap = true }) +remap('n', 'f\\', ':FZFRg', { noremap = true }) +remap('n', 'fT', ':FZFTags', { noremap = true }) +remap('n', 'fq', ':cclose:FZFQuickFix', { noremap = true }) +remap('n', 'fQ', ':lclose:FZFLocList', { noremap = true }) +remap('n', 'fS', ':exe \':FZFRg \' . expand(\'\')', { noremap = true }) +remap('n', 'ft', ':exe \':FZFTags \' . expand(\'\')', { noremap = true }) diff --git a/nvim/.config/nvim/lua/modules/fzf.lua b/nvim/.config/nvim/lua/modules/fzf.lua new file mode 100644 index 0000000..5ed8171 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/fzf.lua @@ -0,0 +1,30 @@ +local remap = vim.api.nvim_set_keymap + +vim.env.FZF_DEFAULT_OPTS = "--layout=reverse --bind \"Ctrl-n:preview-down,Ctrl-p:preview-up\"" +vim.g.fzf_layout = { + window = { + width = 0.8, + height = 0.8 + }, +} + +remap('n', 'b', ':Buffers', { noremap = true }) +remap('n', 'B', ':History', { noremap = true }) +remap('n', '/', ':GFiles?', { noremap = true }) +remap('n', 'ff', ':GFiles', { noremap = true }) +remap('n', 'fF', ':Files', { noremap = true }) +remap('n', 'fL', ':Lines', { noremap = true }) +remap('n', 'fc', ':BCommits', { noremap = true }) +remap('n', 'fC', ':Commits', { noremap = true }) +remap('n', 'fh', ':History:', { noremap = true }) +remap('n', 'fH', ':History/', { noremap = true }) +remap('n', 'fm', ':Commands', { noremap = true }) +remap('n', 'fo', ':Locate', { noremap = true }) +remap('n', 'fk', ':Maps', { noremap = true }) +remap('n', 'f/', ':Rg', { noremap = true }) +remap('n', 'fs', ':exe \':Rg \' . expand(\'\')', { noremap = true }) + +remap('i', '', '(fzf-complete-word)', { noremap = false }) +remap('i', '', '(fzf-complete-path)', { noremap = false }) +remap('i', '', '(fzf-complete-file)', { noremap = false }) +remap('i', '', '(fzf-complete-line)', { noremap = false }) diff --git a/nvim/.config/nvim/lua/modules/signify.lua b/nvim/.config/nvim/lua/modules/signify.lua new file mode 100644 index 0000000..fdf699c --- /dev/null +++ b/nvim/.config/nvim/lua/modules/signify.lua @@ -0,0 +1,12 @@ +local remap = vim.api.nvim_set_keymap + +remap('n', 'ghu', ':SignifyHunkUndo', { noremap = true }) +remap('n', 'ghp', ':SignifyHunkDiff', { noremap = true }) +remap('n', ']c', '(signify-next-hunk)', { noremap = false }) +remap('n', '[c', '(signify-prev-hunk)', { noremap = false }) +remap('n', ']C', '9999]c', { noremap = false }) +remap('n', '[C', '9999[c', { noremap = false }) +remap('o', 'ih', '(signify-motion-inner-pending)', { noremap = false }) +remap('x', 'ih', '(signify-motion-inner-visual)', { noremap = false }) +remap('o', 'ah', '(signify-motion-outer-pending)', { noremap = false }) +remap('x', 'ah', '(signify-motion-outer-visual)', { noremap = false }) diff --git a/nvim/.config/nvim/lua/modules/sneak.lua b/nvim/.config/nvim/lua/modules/sneak.lua new file mode 100644 index 0000000..2548d88 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/sneak.lua @@ -0,0 +1,19 @@ +local remap = vim.api.nvim_set_keymap + +-- Replace 'f' with 1 character sneak +remap('n', 'f', 'Sneak_f', { noremap = false }) +remap('n', 'F', 'Sneak_F', { noremap = false }) +remap('x', 'f', 'Sneak_f', { noremap = false }) +remap('x', 'F', 'Sneak_F', { noremap = false }) +remap('o', 'f', 'Sneak_f', { noremap = false }) +remap('o', 'F', 'Sneak_F', { noremap = false }) +-- Replace 't' with 1 character sneak +remap('n', 't', 'Sneak_t', { noremap = false }) +remap('n', 'T', 'Sneak_T', { noremap = false }) +remap('x', 't', 'Sneak_t', { noremap = false }) +remap('x', 'T', 'Sneak_T', { noremap = false }) +remap('o', 't', 'Sneak_t', { noremap = false }) +remap('o', 'T', 'Sneak_T', { noremap = false }) +-- Two character sneak +remap('n', 's', 'Sneak_s', { noremap = false }) +remap('n', 'S', 'Sneak_S', { noremap = false }) diff --git a/nvim/.config/nvim/lua/modules/togglelist.lua b/nvim/.config/nvim/lua/modules/togglelist.lua new file mode 100644 index 0000000..0a42059 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/togglelist.lua @@ -0,0 +1,4 @@ +local remap = vim.api.nvim_set_keymap + +remap('n', 'qt', ':call ToggleQuickfixList()', { noremap = true }) +remap('n', 'Lt', ':call ToggleLocationList()', { noremap = true }) diff --git a/nvim/.config/nvim/lua/modules/which_key.lua b/nvim/.config/nvim/lua/modules/which_key.lua new file mode 100644 index 0000000..f0c2528 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/which_key.lua @@ -0,0 +1,6 @@ +local remap = vim.api.nvim_set_keymap + +vim.g.which_key_use_floating_win = 1 + +remap('n', '', ':WhichKey \'\'', { noremap = true, silent = true }) +remap('n', '', ':WhichKey \',\'', { noremap = true, silent = true }) diff --git a/nvim/.config/nvim/lua/modules/workspace.lua b/nvim/.config/nvim/lua/modules/workspace.lua new file mode 100644 index 0000000..b2d6438 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/workspace.lua @@ -0,0 +1,9 @@ +local remap = vim.api.nvim_set_keymap + +vim.g.workspace_session_directory = vim.fn.expand('~/.vim/session/') +vim.g.workspace_undodir = vim.fn.expand('~/.vim/undodir') +vim.g.workspace_autosave = 0 +vim.g.workspace_autosave_ignore = {'gitcommit', 'qf', 'tagbar'} +vim.g.workspace_session_disable_on_args = 1 + +remap('n', 'ps', ':ToggleWorkspace', { noremap = true })