mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Update vim config
This commit is contained in:
parent
49b1fb917e
commit
1de5142b86
|
@ -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
|
||||
|
||||
|
|
|
@ -4,20 +4,24 @@ nnoremap <Left> <nop>
|
|||
nnoremap <Right> <nop>
|
||||
nnoremap <Up> <nop>
|
||||
|
||||
" Stop search highlight on esc (until next search)
|
||||
map <silent> <esc> :noh<CR>
|
||||
" Stop search highlight on Ctrl+l (until next search)
|
||||
map <silent> <C-l> :noh<CR>
|
||||
|
||||
" System clipboard interactions
|
||||
map <C-c> "+y
|
||||
vnoremap <C-v> "+p
|
||||
|
||||
" Spell-check set to <leader>o, 'o' for 'orthography'
|
||||
map <leader>o :setlocal spell! spelllang=en_US<CR>
|
||||
" Start spell-check
|
||||
map <leader>s :setlocal spell! spelllang=en_us<CR>
|
||||
|
||||
" Use shift to move 10 lines up/down quickly
|
||||
noremap <silent> K 10k
|
||||
noremap <silent> J 10j
|
||||
|
||||
" Enable/Disable auto comment
|
||||
map <leader>c :setlocal formatoptions-=cro<CR>
|
||||
map <leader>C :setlocal formatoptions=cro<CR>
|
||||
|
||||
" Tab navigation
|
||||
nnoremap <Tab> gt
|
||||
nnoremap <S-Tab> gT
|
||||
|
@ -27,12 +31,6 @@ nnoremap <silent> <A-1> :tabmove -<CR>
|
|||
nnoremap <A-p> :tabp<CR>
|
||||
nnoremap <A-n> :tabn<CR>
|
||||
|
||||
" Alias replace all
|
||||
nnoremap <A-s> :%s//gI<Left><Left><Left>
|
||||
|
||||
" Save file as sudo when no write permissions
|
||||
cmap w!! w !sudo tee > /dev/null %
|
||||
|
||||
" Remap splits navigation to just CTRL + hjkl
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-j> <C-w>j
|
||||
|
@ -45,7 +43,18 @@ noremap <silent> <C-Right> :vertical resize -3<CR>
|
|||
noremap <silent> <C-Up> :resize +3<CR>
|
||||
noremap <silent> <C-Down> :resize -3<CR>
|
||||
|
||||
" Alias replace all
|
||||
nnoremap <A-s> :%s//gI<Left><Left><Left>
|
||||
|
||||
" Save file as sudo when no write permissions
|
||||
cmap w!! w !sudo tee > /dev/null %
|
||||
|
||||
" Don't leave visual mode after indenting
|
||||
vmap < <gv
|
||||
vmap > >gv
|
||||
|
||||
" Compile opened file (using custom comp script)
|
||||
nnoremap <A-c> :w \| !comp <c-r>%<CR>
|
||||
|
||||
" Shell check
|
||||
nnoremap <leader>p :!shellcheck %<CR>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue