1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-22 13:11:39 +01:00

vim: add persistent undo

This commit is contained in:
bretello 2020-12-09 01:54:42 +01:00
parent 2b6cac6c8d
commit daf0094409
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
2 changed files with 16 additions and 9 deletions

View File

@ -60,9 +60,17 @@
"ackrc": "~/.ackrc"
"vim/vimrc": "~/.vimrc"
"pdbrc.py": "~/.pdbrc.py"
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
"ansible.cfg": "~/.ansible.cfg"
- name: check undodir_migration
stat: path=${HOME}/.vim_runtime/temp_dirs/undodir
register: undodir
- name: vim undodir migration
command: mv ${HOME}/.vim_runtime/temp_dirs/undodir ${HOME}/.vim/undo
when: undodir.stat.exists
- name: git config facts
community.general.git_config:
name: "include.path"

View File

@ -29,11 +29,16 @@ set lazyredraw
set ignorecase smartcase " ignore case on search but be smart about it
set hlsearch "highlight search results (using *)
set shiftwidth=4 tabstop=4
set expandtab shiftwidth=4 tabstop=4 "always use spaces
autocmd FileType yaml,yml setlocal shiftwidth=2 softtabstop=2 expandtab
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
au BufRead,BufNewFile rules.v[46] set filetype=iptables
au BufRead,BufNewFile rules.v[46] setlocal filetype=iptables
if has('persistent_undo')
set undodir=$HOME/.vim/undo
set undofile
endif
" Return to last edit position when opening files (from amix's vimrc)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
@ -49,12 +54,6 @@ cnoremap <C-K> <C-U>
cnoremap <C-P> <Up>
cnoremap <C-N> <Down>
try
set undodir=~/.vim/temp_dirs/undodir
set undofile
catch
endtry
source $DOTFILES/vim/plugins_config.vim
source $DOTFILES/vim/shortcuts.vim
source $DOTFILES/vim/functions.vim