diff --git a/nvim/.config/nvim/after/plugin/better-whitespace.vim b/nvim/.config/nvim/after/plugin/better-whitespace.vim new file mode 100644 index 0000000..a74ade3 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/better-whitespace.vim @@ -0,0 +1,4 @@ +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/diagnostic.vim b/nvim/.config/nvim/after/plugin/diagnostic.vim new file mode 100644 index 0000000..975a72a --- /dev/null +++ b/nvim/.config/nvim/after/plugin/diagnostic.vim @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000..83e0875 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/floaterm.vim @@ -0,0 +1,9 @@ +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.vim b/nvim/.config/nvim/after/plugin/fzf.vim index f746b68..b03e540 100644 --- a/nvim/.config/nvim/after/plugin/fzf.vim +++ b/nvim/.config/nvim/after/plugin/fzf.vim @@ -1,3 +1,6 @@ +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? diff --git a/nvim/.config/nvim/after/plugin/rainbow.vim b/nvim/.config/nvim/after/plugin/rainbow.vim new file mode 100644 index 0000000..e2c01c7 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/rainbow.vim @@ -0,0 +1 @@ +let g:rainbow_active = 1 diff --git a/nvim/.config/nvim/after/plugin/togglelist.vim b/nvim/.config/nvim/after/plugin/togglelist.vim new file mode 100644 index 0000000..f7375af --- /dev/null +++ b/nvim/.config/nvim/after/plugin/togglelist.vim @@ -0,0 +1,2 @@ +nnoremap qt :call ToggleQuickfixList() +nnoremap Lt :call ToggleLocationList() diff --git a/nvim/.config/nvim/after/plugin/vimtex.vim b/nvim/.config/nvim/after/plugin/vimtex.vim new file mode 100644 index 0000000..bb6b098 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/vimtex.vim @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..fb286a1 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/which_key.vim @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000..779e3e2 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/workspace.vim @@ -0,0 +1,7 @@ +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/autocmd.vim b/nvim/.config/nvim/autocmd.vim deleted file mode 100644 index 43fb20a..0000000 --- a/nvim/.config/nvim/autocmd.vim +++ /dev/null @@ -1,46 +0,0 @@ -augroup terminal_job - au! - au TermOpen * startinsert - au TermOpen * setlocal listchars= nonumber norelativenumber -augroup END - -augroup ResizeWindowsProportionally - au! - autocmd VimResized * :wincmd = -augroup END - -augroup ToggleSearchHighlighting - autocmd! - autocmd InsertEnter * setlocal nohlsearch -augroup END - -augroup UserStatusline - autocmd! - autocmd BufEnter,WinEnter,TermOpen * setlocal statusline=%!ActiveStatus() - autocmd WinLeave * setlocal statusline=%!PassiveStatus() - autocmd ColorScheme * hi User1 guifg=DarkRed guibg=Black - autocmd ColorScheme * hi User2 guifg=White guibg=Black - autocmd ColorScheme * hi User3 guifg=Cyan guibg=Black - autocmd ColorScheme * hi User4 guifg=Orange guibg=Black - autocmd ColorScheme * hi User5 guifg=Red guibg=Black - autocmd ColorScheme * hi User6 guifg=Gray guibg=Black - autocmd ColorScheme * hi User7 guifg=Gray guibg=Black - autocmd ColorScheme * hi User8 guifg=DarkYellow guibg=Black -augroup END - -augroup LuaHighlight - autocmd! - autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank("IncSearch", 2000) -augroup END - -augroup Scrollbar - autocmd! - autocmd BufEnter * silent! lua require('scrollbar').show() - autocmd BufLeave * silent! lua require('scrollbar').clear() - - autocmd CursorMoved * silent! lua require('scrollbar').show() - autocmd VimResized * silent! lua require('scrollbar').show() - - autocmd FocusGained * silent! lua require('scrollbar').show() - autocmd FocusLost * silent! lua require('scrollbar').clear() -augroup END diff --git a/nvim/.config/nvim/config.vim b/nvim/.config/nvim/config.vim deleted file mode 100644 index a63dea9..0000000 --- a/nvim/.config/nvim/config.vim +++ /dev/null @@ -1,110 +0,0 @@ -" Set up leaders -let mapleader="\" -let maplocalleader="," - -set shada="NONE" " Prevent SHADA files from being generated or read -set laststatus=2 " Always show status bar -set updatetime=100 " Let plugins show effects after 100ms -set mouse-=a " Disable mouse click to go to position -set encoding=utf-8 -set exrc " Allow loading local .nvimrc files -set secure " Disallow use of autocmd, shell and write in local rc -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set ruler " Show the line and column numbers of the cursor. -set formatoptions+=o " Continue comment marker in new lines. -set formatoptions+=j " Delete comment character when joining commented lines -set textwidth=78 " Hard-wrap long lines as you type them. -set autoindent " Copy indent from current line when starting a new line -set noerrorbells " No beeps. -set modeline " Enable modeline. -set linespace=0 " Set line-spacing to minimum. -set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) -set noshowmode " Because of neovim's cursor shape -set splitbelow " Horizontal split below current. -set splitright " Vertical split to right of current. -set nobackup " no backup files -set nowritebackup " only in case you don't want a backup file while editing -set noswapfile " no swap files -set nofoldenable " Open folds by default -set undofile " Enable undo persistence across sessions -set hidden -set noautochdir -set hlsearch -set nostartofline " Do not jump to first character with page commands. -set ignorecase " Make searching case insensitive -set smartcase " ... unless the query has capital letters. -set magic " Use 'magic' patterns (extended regular expressions). -set autoread " Autoload file if it changes on disk -set termguicolors " Enable colors for terminal -set completeopt-=menu -set completeopt-=longest " Don't insert the longest common text -set completeopt-=preview " Hide the documentation preview window -set completeopt+=menuone " Show the completions UI even with only 1 item -set completeopt+=noinsert " Don't insert text automatically -set completeopt+=noselect " Do not select a match in the menu -" Required for vim-workspace -" See https://github.com/thaerkh/vim-workspace/issues/11 -set sessionoptions-=blank -set fileformat=unix -set inccommand=split -set switchbuf=useopen -set backspace=indent,eol,start -set scrolloff=3 " Show next 3 lines while scrolling. -set sidescrolloff=5 " Show next 5 columns while side-scrolling. -set diffopt=filler,internal,algorithm:histogram,indent-heuristic - -" Wild menu -set wildmenu -set wildmode=longest:full,full -set wildoptions=pum -set pumblend=30 -set wildignore=*.o,*.obj,*~,*.exe,*.a,*.pdb,*.lib -set wildignore+=__pycache__,.stversions,*.spl,*.out,%* -set wildignore+=*.so,*.dll,*.swp,*.egg,*.jar,*.class,*.pyc,*.pyo,*.bin,*.dex -set wildignore+=*.zip,*.7z,*.rar,*.gz,*.tar,*.gzip,*.bz2,*.tgz,*.xz -set wildignore+=*DS_Store*,*.ipch -set wildignore+=*.gem -set wildignore+=*.png,*.jpg,*.gif,*.bmp,*.tga,*.pcx,*.ppm,*.img,*.iso -set wildignore+=*.so,*.swp,*.zip,*/.Trash/**,*.pdf,*.dmg,*/.rbenv/** -set wildignore+=*/.nx/**,*.app,*.git,.git -set wildignore+=*.wav,*.mp3,*.ogg,*.pcm -set wildignore+=*.mht,*.suo,*.sdf,*.jnlp -set wildignore+=*.chm,*.epub,*.pdf,*.mobi,*.ttf -set wildignore+=*.mp4,*.avi,*.flv,*.mov,*.mkv,*.swf,*.swc -set wildignore+=*.ppt,*.pptx,*.docx,*.xlt,*.xls,*.xlsx,*.odt,*.wps -set wildignore+=*.msi,*.crx,*.deb,*.vfd,*.apk,*.ipa,*.bin,*.msu -set wildignore+=*.gba,*.sfc,*.078,*.nds,*.smd,*.smc -set wildignore+=*.linux2,*.win32,*.darwin,*.freebsd,*.linux,*.android - -" We do this to prevent the loading of the system fzf.vim plugin. This is -" present at least on Arch/Manjaro -set rtp-=/usr/share/vim/vimfiles - -" Disable providers we do not give a shit about -let g:loaded_python3_provider = 0 -let g:loaded_python_provider = 0 -let g:loaded_ruby_provider = 0 -let g:loaded_perl_provider = 0 -let g:loaded_node_provider = 0 - -" Disable some in built plugins completely -let g:loaded_netrw = 1 -let g:loaded_netrwPlugin = 1 -let g:loaded_matchparen = 1 -let g:loaded_matchit = 1 -let g:loaded_2html_plugin = 1 -let g:loaded_getscriptPlugin = 1 -let g:loaded_gzip = 1 -let g:loaded_logipat = 1 -let g:loaded_rrhelper = 1 -let g:loaded_spellfile_plugin = 1 -let g:loaded_tarPlugin = 1 -let g:loaded_vimballPlugin = 1 -let g:loaded_zipPlugin = 1 - -" Add the in built Cfilter plugin. Replaces QFGrep. -packadd cfilter - -" Colorscheme -colorscheme yolokai diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index b9e4c85..fcafbd8 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -89,15 +89,11 @@ Plug 'martinda/Jenkinsfile-vim-syntax' call plug#end() -let g:vim_home = get(g:, 'vim_home', expand('~/.config/nvim/')) -let config_list = [ - \ 'autocmd.vim', - \ 'config.vim', - \ 'keymappings.vim', - \ 'plugin_settings.vim', - \] -for files in config_list - for f in glob(g:vim_home.files, 1, 1) - exec 'source' f - endfor -endfor +" Set up leader keys +let mapleader="\" +let maplocalleader="," +" Use Tab & S-Tab instead of C-g and C-t for incsearch +cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] +cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] + +lua require 'init' diff --git a/nvim/.config/nvim/keymappings.vim b/nvim/.config/nvim/keymappings.vim deleted file mode 100644 index 2020ab7..0000000 --- a/nvim/.config/nvim/keymappings.vim +++ /dev/null @@ -1,121 +0,0 @@ -" Remap escape keys to something usable on home row -inoremap jk -cnoremap jk -inoremap -cnoremap -" Use Q to execute default register. -nnoremap Q - -" Save -nnoremap w :w -" Search and Replace -nnoremap c. :%s//g -nnoremap c. :%s/\<\>//g -" Quit -nnoremap x :x -nnoremap q :q -nnoremap Q :qa -" Navigate buffers -nnoremap [b :bprevious -nnoremap ]b :bnext -nnoremap [B :bfirst -nnoremap ]B :blast -" Reload buffer -nnoremap e :e -nnoremap E :bufdo e -" Tab navigation -nnoremap tp :tabprevious -nnoremap tn :tabnext -nnoremap tf :tabfirst -nnoremap tl :tablast -nnoremap tN :tabnew -nnoremap tc :tabclose -" For tags -nnoremap [t :tprevious -nnoremap ]t :tNext -nnoremap [T :tfirst -nnoremap ]T :tlast -nnoremap ts :exec("tselect ".expand("")) -" For workspace -nnoremap ps :ToggleWorkspace -" Quickfix & Location list mappings -nnoremap qo :copen -nnoremap qc :cclose -nnoremap [q :cprevious -nnoremap ]q :cnext -nnoremap [Q :cfirst -nnoremap ]Q :clast -nnoremap q* :Ggrep! -nnoremap qs :Ggrep! -nnoremap qt :call ToggleQuickfixList() -nnoremap Lo :lopen -nnoremap Lc :lclose -nnoremap [l :lprevious -nnoremap ]l :lnext -nnoremap [L :lfirst -nnoremap ]L :llast -nnoremap L* :Glgrep! -nnoremap Ls :Glgrep! -nnoremap Lt :call ToggleLocationList() -" Preview tags -nnoremap pt :ptag -nnoremap [p :ptprevious -nnoremap ]p :ptnext -nnoremap po :ppop -nnoremap pc :pc -nnoremap pi :psearch -" Short cuts for setting fold methods -nnoremap zmi :set foldmethod=indent -nnoremap zmm :set foldmethod=manual -nnoremap zme :set foldmethod=expr -nnoremap zmk :set foldmethod=marker -nnoremap zms :set foldmethod=syntax - -" Key Bindings to help with terminal mode -tnoremap jk -nnoremap :FloatermToggle -tnoremap :FloatermToggle - -" Key bindings to move between window splits -for key in range(0, 9) - execute 'nnoremap '.key key.'w' -endfor - -" Disable Arrow Keys -inoremap -inoremap -inoremap -inoremap -noremap -noremap -noremap -noremap - -" Whick key -nnoremap :WhichKey '' -nnoremap :WhichKey ',' - -" Tag helpers -nnoremap :vsp :exec("tag ".expand("")) -nnoremap :sp :exec("tag ".expand("")) - -" Use Tab & S-Tab instead of C-g and C-t for incsearch -cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] -cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] -nnoremap n :nohlsearch - -" Move across wrapped lines like regular lines -" Go to the first non-blank character of a line -noremap 0 ^ -" Just in case you need to go to the very beginning of a line -noremap ^ 0 -" Centre the window on each search movement -nnoremap n nzz -nnoremap N Nzz -vnoremap n nzz -vnoremap N Nzz - -" Make dot work on visually selected lines -vnoremap . :norm. -" Go to the last file we changed -nnoremap diff --git a/nvim/.config/nvim/lua/autocmd.lua b/nvim/.config/nvim/lua/autocmd.lua new file mode 100644 index 0000000..f440518 --- /dev/null +++ b/nvim/.config/nvim/lua/autocmd.lua @@ -0,0 +1,55 @@ +local vim = vim +local api = vim.api + +--- This function is taken from https://github.com/norcalli/nvim_utils +function nvim_create_augroups(definitions) + for group_name, definition in pairs(definitions) do + api.nvim_command('augroup '..group_name) + api.nvim_command('autocmd!') + for _, def in ipairs(definition) do + local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ') + api.nvim_command(command) + end + api.nvim_command('augroup END') + end +end + +local autocmds = { + terminal_job = { + { "TermOpen", "*", "startinsert" }; + { "TermOpen", "*", "setlocal listchars= nonumber norelativenumber" }; + }; + resize_windows_proportionally = { + { "VimResized", "*", ":wincmd =" }; + }; + toggle_search_highlighting = { + { "InsertEnter", "*", "setlocal nohlsearch" }; + }; + lua_highlight = { + { "TextYankPost", "*", "silent! lua require'vim.highlight'.on_yank(\"IncSearch\", 2000)" }; + }; + scrollbar = { + { "BufEnter", "*", "silent! lua require('scrollbar').show()" }; + { "BufLeave", "*", "silent! lua require('scrollbar').clear()" }; + + { "CursorMoved", "*", "silent! lua require('scrollbar').show()" }; + { "VimResized", "*", "silent! lua require('scrollbar').show()" }; + + { "FocusGained", "*", "silent! lua require('scrollbar').show()" }; + { "FocusLost", "*", "silent! lua require('scrollbar').clear()" }; + }; + user_status_line = { + { "BufEnter,WinEnter,TermOpen", "*", "setlocal statusline=%!ActiveStatus()" }; + { "WinLeave", "*", "setlocal statusline=%!PassiveStatus()" }; + { "ColorScheme", "*", "hi User1 guifg=DarkRed guibg=Black" }; + { "ColorScheme", "*", "hi User2 guifg=White guibg=Black" }; + { "ColorScheme", "*", "hi User3 guifg=Cyan guibg=Black" }; + { "ColorScheme", "*", "hi User4 guifg=Orange guibg=Black" }; + { "ColorScheme", "*", "hi User5 guifg=Red guibg=Black" }; + { "ColorScheme", "*", "hi User6 guifg=Gray guibg=Black" }; + { "ColorScheme", "*", "hi User7 guifg=Gray guibg=Black" }; + { "ColorScheme", "*", "hi User8 guifg=DarkYellow guibg=Black" }; + }; +} + +nvim_create_augroups(autocmds) diff --git a/nvim/.config/nvim/lua/init.lua b/nvim/.config/nvim/lua/init.lua new file mode 100644 index 0000000..49fef5e --- /dev/null +++ b/nvim/.config/nvim/lua/init.lua @@ -0,0 +1,98 @@ +-- Global vim options +vim.o.laststatus = 2 +vim.o.updatetime = 100 +vim.o.scrolloff = 3 +vim.o.sidescrolloff = 5 +vim.o.textwidth = 78 +vim.o.linespace = 0 +vim.o.exrc = true +vim.o.secure = true +vim.o.showcmd = true +vim.o.showmatch = true +vim.o.ruler = true +vim.o.autoindent = true +vim.o.errorbells = false +vim.o.modeline = true +vim.o.joinspaces = false +vim.o.showmode = false +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.backup = false +vim.o.writebackup = false +vim.o.swapfile = false +vim.o.foldenable = false +vim.o.undofile = true +vim.o.hidden = true +vim.o.autochdir = false +vim.o.hlsearch = true +vim.o.startofline = false +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.magic = true +vim.o.autoread = true +vim.o.termguicolors = true +vim.o.fileformat = 'unix' +vim.o.inccommand = 'split' +vim.o.switchbuf = 'useopen' +vim.o.encoding = 'utf-8' + +-- Disable providers we do not give a shit about +vim.g.loaded_python3_provider = 0 +vim.g.loaded_python_provider = 0 +vim.g.loaded_ruby_provider = 0 +vim.g.loaded_perl_provider = 0 +vim.g.loaded_node_provider = 0 + +-- Disable some in built plugins completely +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_matchparen = 1 +vim.g.loaded_matchit = 1 +vim.g.loaded_2html_plugin = 1 +vim.g.loaded_getscriptPlugin = 1 +vim.g.loaded_gzip = 1 +vim.g.loaded_logipat = 1 +vim.g.loaded_rrhelper = 1 +vim.g.loaded_spellfile_plugin = 1 +vim.g.loaded_tarPlugin = 1 +vim.g.loaded_vimballPlugin = 1 +vim.g.loaded_zipPlugin = 1 + +-- Needs to be set before loading quickr-cscope +vim.g.quickr_cscope_keymaps = 0 +-- Needs to be set before vimtex gets loaded, else it complains +vim.g.tex_flavor = 'latex' +-- Needs to be before togglelist gets loadded +vim.g.toggle_list_no_mappings = 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') +vim.api.nvim_command('let g:sneak#use_ic_scs = 0') + +-- Settings using nvim.api +-- We do this to prevent the loading of the system fzf.vim plugin. This is +-- present at least on Arch/Manjaro +vim.api.nvim_command('set rtp-=/usr/share/vim/vimfiles') +vim.api.nvim_command('set shada="NONE"') +vim.api.nvim_command('set mouse-=a') +vim.api.nvim_command('set formatoptions+=o') +vim.api.nvim_command('set formatoptions+=j') +vim.api.nvim_command('set completeopt=menuone,noinsert,noselect') +vim.api.nvim_command('set wildmenu') +vim.api.nvim_command('set wildmode=longest:full,full') +vim.api.nvim_command('set wildoptions=pum') +vim.api.nvim_command('set pumblend=30') +vim.api.nvim_command('set sessionoptions-=blank') +vim.api.nvim_command('set backspace=indent,eol,start') +vim.api.nvim_command('set diffopt=filler,internal,algorithm:histogram,indent-heuristic') + +-- Add the in built Cfilter plugin. Replaces QFGrep. +vim.cmd [[packadd cfilter]] + +vim.cmd [[colorscheme yolokai]] + +-- Add other lua configs or plugins +require 'autocmd' +require 'keymappings' +require 'lsp' +require 'treesitter' diff --git a/nvim/.config/nvim/lua/keymappings.lua b/nvim/.config/nvim/lua/keymappings.lua new file mode 100644 index 0000000..4fe0179 --- /dev/null +++ b/nvim/.config/nvim/lua/keymappings.lua @@ -0,0 +1,113 @@ +local remap = vim.api.nvim_set_keymap + +-- Remap escape keys to something usable on home row +remap('i', 'jk', '', { noremap = true }) +remap('c', 'jk', '', { noremap = true }) +remap('i', '', '', { noremap = true }) +remap('c', '', '', { noremap = true }) +-- Use Q to execute default register. +remap('n', 'Q', '', { noremap = true }) +-- Save +remap('n', 'w', ':w', { noremap = true }) +-- Search and Replace +remap('n', 'c.', ':%s//g', { noremap = true }) +remap('n', 'c.', ':%s/\\<\\>//g', { noremap = true }) +-- Quit +remap('n', 'x', ':x', { noremap = true }) +remap('n', 'q', ':q', { noremap = true }) +remap('n', 'Q', ':qa', { noremap = true }) +-- Navigate buffers +remap('n', '[b', ':bprevious', { noremap = true }) +remap('n', ']b', ':bnext', { noremap = true }) +remap('n', '[B', ':bfirst', { noremap = true }) +remap('n', ']B', ':blast', { noremap = true }) +-- Reload buffer +remap('n', 'e', ':e', { noremap = true }) +remap('n', 'E', ':bufdo', { noremap = true }) +-- Tab navigation +remap('n', 'tp', ':tabprevious', { noremap = true }) +remap('n', 'tn', ':tabnext', { noremap = true }) +remap('n', 'tf', ':tabfirst', { noremap = true }) +remap('n', 'tl', ':tablast', { noremap = true }) +remap('n', 'tN', ':tabnew', { noremap = true }) +remap('n', 'tc', ':tabclose', { noremap = true }) +-- For tags +remap('n', '[t', ':tprevious', { noremap = true }) +remap('n', ']t', ':tNext', { noremap = true }) +remap('n', '[T', ':tfirst', { noremap = true }) +remap('n', ']T', ':tlast', { noremap = true }) +remap('n', 'ts', ':exec(\"tselect \".expand(\"\"))', { noremap = true }) +-- Quickfix list mappings +remap('n', 'qo', ':copen', { noremap = true }) +remap('n', 'qc', ':cclose', { noremap = true }) +remap('n', '[q', ':cprevious', { noremap = true }) +remap('n', ']q', ':cnext', { noremap = true }) +remap('n', '[Q', ':cfirst', { noremap = true }) +remap('n', ']Q', ':clast', { noremap = true }) +-- Location list mappings +remap('n', 'Lo', ':lopen', { noremap = true }) +remap('n', 'Lc', ':lclose', { noremap = true }) +remap('n', '[l', ':lprevious', { noremap = true }) +remap('n', ']l', ':lnext', { noremap = true }) +remap('n', '[L', ':lfirst', { noremap = true }) +remap('n', ']L', ':lfirst', { noremap = true }) +-- Preview tags +remap('n', 'pt', ':ptag ', { noremap = true }) +remap('n', '[p', ':ptprevious', { noremap = true }) +remap('n', ']p', ':ptnext', { noremap = true }) +remap('n', 'po', ':ppop', { noremap = true }) +remap('n', 'pc', ':pc', { noremap = true }) +remap('n', 'pi', ':psearch ', { noremap = true }) +-- Short cuts for setting fold methods +remap('n', 'zmi', ':set foldmethod=indent', { noremap = true }) +remap('n', 'zmm', ':set foldmethod=manual', { noremap = true }) +remap('n', 'zme', ':set foldmethod=expr', { noremap = true }) +remap('n', 'zmk', ':set foldmethod=marker', { noremap = true }) +remap('n', 'zms', ':set foldmethod=syntax', { noremap = true }) + +-- Key Bindings to help with terminal mode +remap('t', 'jk', '', { noremap = true }) + +-- Key bindings to move between window splits +remap('n', '0', '0w', { noremap = true }) +remap('n', '1', '1w', { noremap = true }) +remap('n', '2', '2w', { noremap = true }) +remap('n', '3', '3w', { noremap = true }) +remap('n', '4', '4w', { noremap = true }) +remap('n', '5', '5w', { noremap = true }) +remap('n', '6', '6w', { noremap = true }) +remap('n', '7', '7w', { noremap = true }) +remap('n', '8', '8w', { noremap = true }) +remap('n', '9', '9w', { noremap = true }) + +-- Disable Arrow Keys +remap('i', '', '', { noremap = true }) +remap('i', '', '', { noremap = true }) +remap('i', '', '', { noremap = true }) +remap('i', '', '', { noremap = true }) +remap('n', '', '', { noremap = true }) +remap('n', '', '', { noremap = true }) +remap('n', '', '', { noremap = true }) +remap('n', '', '', { noremap = true }) + +-- Tag helpers +remap('n', '', ':vsp :exec(\"tag \".expand(\"\"))', { noremap = true }) +remap('n', '', ':sp :exec(\"tag \".expand(\"\"))', { noremap = true }) + +remap('n', 'n', ':nohlsearch', { noremap = true, silent = true }) + +-- Move across wrapped lines like regular lines +-- Go to the first non-blank character of a line +remap('n', '0', '^', { noremap = true }) +-- Just in case you need to go to the very beginning of a line +remap('n', '^', '0', { noremap = true }) +-- Centre the window on each search movement +remap('n', 'n', 'nzz', { noremap = true }) +remap('n', 'N', 'Nzz', { noremap = true }) +remap('v', 'n', 'nzz', { noremap = true }) +remap('v', 'N', 'Nzz', { noremap = true }) + +-- Make dot work on visually selected lines +remap('v', '.', ':norm.', { noremap = true }) +-- Go to the last file we changed +remap('n', '', '', { noremap = true }) diff --git a/nvim/.config/nvim/plugin_settings.vim b/nvim/.config/nvim/plugin_settings.vim deleted file mode 100644 index ebaa685..0000000 --- a/nvim/.config/nvim/plugin_settings.vim +++ /dev/null @@ -1,60 +0,0 @@ -" Better whitespace -let g:better_whitespace_enabled = 1 -let g:strip_whitespace_on_save = 1 -let g:better_whitespace_operator = '' -let g:strip_whitespace_confirm = 0 -" Automatically detect style file and apply style to formatting -let g:clang_format#detect_style_file = 1 -" For workspace -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 -" Toggle quickfix/location list -let g:toggle_list_no_mappings = 1 - -let g:mapleader = "\" -let g:maplocalleader = ',' -let g:which_key_use_floating_win = 1 - -" Rainbow Parentheses -let g:rainbow_active = 1 - -" FZF -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 } } - -" Incremental search -let g:incsearch#auto_nohlsearch = 1 - -" Sneak -let g:sneak#label = 1 -let g:sneak#s_next = 1 -let g:sneak#use_ic_scs = 0 - -" vimtex -let g:tex_flavor = 'latex' -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' - -" Floaterm -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 = ['─', '│', '─', '│', '╭', '╮', '╯', '╰'] - -" Quickr Cscope -let g:quickr_cscope_keymaps = 0 - -" Neovim LSP Diagnostics -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 - -lua require 'lsp' -lua require 'treesitter'