diff --git a/home/.config/nvim/rc/autocmd.vim b/home/.config/nvim/rc/autocmd.vim index 34e958c..1d69361 100644 --- a/home/.config/nvim/rc/autocmd.vim +++ b/home/.config/nvim/rc/autocmd.vim @@ -2,7 +2,7 @@ "set viminfofile=$XDG_CACHE_HOME/vim/viminfo " Disable automatic commenting on newline -autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o +autocmd FileType * setlocal formatoptions-=cro " Have Vim jump to the last position when reopening a file autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif @@ -10,3 +10,6 @@ autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "norm " Automatically deletes all trailing whitespace on save autocmd BufWritePre * %s/\s\+$//e +" Enable spellcheck for certain file types +autocmd FileType tex,latex,markdown,gitcommit setlocal spell spelllang=en_us + diff --git a/home/.config/nvim/rc/mappings.vim b/home/.config/nvim/rc/mappings.vim index e531b78..1dd1e43 100644 --- a/home/.config/nvim/rc/mappings.vim +++ b/home/.config/nvim/rc/mappings.vim @@ -4,20 +4,24 @@ nnoremap nnoremap nnoremap -" Stop search highlight on esc (until next search) -map :noh +" Stop search highlight on Ctrl+l (until next search) +map :noh " System clipboard interactions map "+y vnoremap "+p -" Spell-check set to o, 'o' for 'orthography' -map o :setlocal spell! spelllang=en_US +" Start spell-check +map s :setlocal spell! spelllang=en_us " Use shift to move 10 lines up/down quickly noremap K 10k noremap J 10j +" Enable/Disable auto comment +map c :setlocal formatoptions-=cro +map C :setlocal formatoptions=cro + " Tab navigation nnoremap gt nnoremap gT @@ -27,12 +31,6 @@ nnoremap :tabmove - nnoremap :tabp nnoremap :tabn -" Alias replace all -nnoremap :%s//gI - -" Save file as sudo when no write permissions -cmap w!! w !sudo tee > /dev/null % - " Remap splits navigation to just CTRL + hjkl nnoremap h nnoremap j @@ -45,7 +43,18 @@ noremap :vertical resize -3 noremap :resize +3 noremap :resize -3 +" Alias replace all +nnoremap :%s//gI + +" Save file as sudo when no write permissions +cmap w!! w !sudo tee > /dev/null % + " Don't leave visual mode after indenting vmap < >gv +" Compile opened file (using custom comp script) +nnoremap :w \| !comp % + +" Shell check +nnoremap p :!shellcheck % diff --git a/home/.config/nvim/rc/theme.vim b/home/.config/nvim/rc/theme.vim index cd4c673..be6fcbf 100644 --- a/home/.config/nvim/rc/theme.vim +++ b/home/.config/nvim/rc/theme.vim @@ -14,7 +14,11 @@ set guioptions-=T " Remove toolbar set guioptions-=r " Remove right-hand scrollbar set guioptions-=L " Remove left-hand scrollbar -if empty($DISPLAY) " Don't use true colors (256) in TTY +" Use more noticable cursor line color +highlight CursorLine guibg=#2b2b2b + +" Don't use true colors in TTY +if empty($DISPLAY) set notermguicolors else set termguicolors