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
|
"set viminfofile=$XDG_CACHE_HOME/vim/viminfo
|
||||||
|
|
||||||
" Disable automatic commenting on newline
|
" 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
|
" Have Vim jump to the last position when reopening a file
|
||||||
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
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
|
" Automatically deletes all trailing whitespace on save
|
||||||
autocmd BufWritePre * %s/\s\+$//e
|
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 <Right> <nop>
|
||||||
nnoremap <Up> <nop>
|
nnoremap <Up> <nop>
|
||||||
|
|
||||||
" Stop search highlight on esc (until next search)
|
" Stop search highlight on Ctrl+l (until next search)
|
||||||
map <silent> <esc> :noh<CR>
|
map <silent> <C-l> :noh<CR>
|
||||||
|
|
||||||
" System clipboard interactions
|
" System clipboard interactions
|
||||||
map <C-c> "+y
|
map <C-c> "+y
|
||||||
vnoremap <C-v> "+p
|
vnoremap <C-v> "+p
|
||||||
|
|
||||||
" Spell-check set to <leader>o, 'o' for 'orthography'
|
" Start spell-check
|
||||||
map <leader>o :setlocal spell! spelllang=en_US<CR>
|
map <leader>s :setlocal spell! spelllang=en_us<CR>
|
||||||
|
|
||||||
" Use shift to move 10 lines up/down quickly
|
" Use shift to move 10 lines up/down quickly
|
||||||
noremap <silent> K 10k
|
noremap <silent> K 10k
|
||||||
noremap <silent> J 10j
|
noremap <silent> J 10j
|
||||||
|
|
||||||
|
" Enable/Disable auto comment
|
||||||
|
map <leader>c :setlocal formatoptions-=cro<CR>
|
||||||
|
map <leader>C :setlocal formatoptions=cro<CR>
|
||||||
|
|
||||||
" Tab navigation
|
" Tab navigation
|
||||||
nnoremap <Tab> gt
|
nnoremap <Tab> gt
|
||||||
nnoremap <S-Tab> gT
|
nnoremap <S-Tab> gT
|
||||||
|
@ -27,12 +31,6 @@ nnoremap <silent> <A-1> :tabmove -<CR>
|
||||||
nnoremap <A-p> :tabp<CR>
|
nnoremap <A-p> :tabp<CR>
|
||||||
nnoremap <A-n> :tabn<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
|
" Remap splits navigation to just CTRL + hjkl
|
||||||
nnoremap <C-h> <C-w>h
|
nnoremap <C-h> <C-w>h
|
||||||
nnoremap <C-j> <C-w>j
|
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-Up> :resize +3<CR>
|
||||||
noremap <silent> <C-Down> :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
|
" Don't leave visual mode after indenting
|
||||||
vmap < <gv
|
vmap < <gv
|
||||||
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-=r " Remove right-hand scrollbar
|
||||||
set guioptions-=L " Remove left-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
|
set notermguicolors
|
||||||
else
|
else
|
||||||
set termguicolors
|
set termguicolors
|
||||||
|
|
Loading…
Reference in a new issue