feat(vim): add autosave

This commit is contained in:
arielherself 2024-12-28 20:53:55 +08:00
parent cf903619ea
commit d26f286a18
Signed by: arielherself
SSH Key Fingerprint: SHA256:AK3cyo9tFsp7Mox7K0sYphleC8hReXhnRKxwuDT5LBc
1 changed files with 21 additions and 4 deletions

25
.vimrc
View File

@ -4,11 +4,22 @@ let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q" let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q" let &t_EI = "\<Esc>[2 q"
" Fix color in some environments
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
" maybe need to remove this in gnu screen
set termguicolors
endif
" Add this if color doesn't work
" set term=xterm-256color
" Common stuff " Common stuff
set encoding=utf-8 set encoding=utf-8
set exrc set exrc
set undofile set undofile
set undodir=~/.vim/undofiles-vanilla set undodir=~/.vim/undofiles-vanilla " you have to manually create this directory
set undolevels=10000 set undolevels=10000
set undoreload=50000 set undoreload=50000
" filetype off " filetype off
@ -22,7 +33,6 @@ set selectmode=key
set keymodel=startsel set keymodel=startsel
set number set number
set cursorline set cursorline
set termguicolors
set clipboard=unnamedplus " not `+=` in vim set clipboard=unnamedplus " not `+=` in vim
set updatetime=700 set updatetime=700
set whichwrap+=<,>,[,] set whichwrap+=<,>,[,]
@ -93,6 +103,7 @@ Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plug 'Yggdroot/indentLine' Plug 'Yggdroot/indentLine'
Plug '907th/vim-auto-save'
call plug#end() call plug#end()
@ -159,8 +170,8 @@ endfunction
let g:asyncomplete_preprocessor = [function('s:truncate_labels')] let g:asyncomplete_preprocessor = [function('s:truncate_labels')]
" Personal keybindings " Personal keybindings
nnoremap <leader>h <Plug>(easymotion-bd-w) nnoremap <leader>w <Plug>(easymotion-bd-w)
vnoremap <leader>h <Plug>(easymotion-bd-w) vnoremap <leader>w <Plug>(easymotion-bd-w)
nnoremap <leader>o <Cmd>Files<CR> nnoremap <leader>o <Cmd>Files<CR>
nnoremap <leader>g <Cmd>Rg<CR> nnoremap <leader>g <Cmd>Rg<CR>
nnoremap gpd <Cmd>LspPeekDefinition<CR> nnoremap gpd <Cmd>LspPeekDefinition<CR>
@ -180,6 +191,7 @@ vnoremap <C-k> dkPV`]
vnoremap <Tab> >gv vnoremap <Tab> >gv
vnoremap <S-Tab> <gv vnoremap <S-Tab> <gv
nnoremap <C-a> ggVG nnoremap <C-a> ggVG
nnoremap gy `[v`]
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Bclose " Bclose
@ -265,5 +277,10 @@ let g:indentLine_char = ''
let g:indentLine_first_char = '' let g:indentLine_first_char = ''
let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_showFirstIndentLevel = 1
" cursor word
let g:cursorword_delay = 1
let g:auto_save = 0
" Why?! " Why?!
set noshowmode set noshowmode