mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 19:11:30 +01:00
vim: add persistent undo
This commit is contained in:
parent
2b6cac6c8d
commit
daf0094409
|
@ -63,6 +63,14 @@
|
||||||
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
||||||
"ansible.cfg": "~/.ansible.cfg"
|
"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
|
- name: git config facts
|
||||||
community.general.git_config:
|
community.general.git_config:
|
||||||
name: "include.path"
|
name: "include.path"
|
||||||
|
|
15
vim/vimrc
15
vim/vimrc
|
@ -29,11 +29,16 @@ set lazyredraw
|
||||||
set ignorecase smartcase " ignore case on search but be smart about it
|
set ignorecase smartcase " ignore case on search but be smart about it
|
||||||
set hlsearch "highlight search results (using *)
|
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
|
autocmd FileType yaml,yml setlocal shiftwidth=2 softtabstop=2 expandtab
|
||||||
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
|
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)
|
" Return to last edit position when opening files (from amix's vimrc)
|
||||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
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-P> <Up>
|
||||||
cnoremap <C-N> <Down>
|
cnoremap <C-N> <Down>
|
||||||
|
|
||||||
try
|
|
||||||
set undodir=~/.vim/temp_dirs/undodir
|
|
||||||
set undofile
|
|
||||||
catch
|
|
||||||
endtry
|
|
||||||
|
|
||||||
source $DOTFILES/vim/plugins_config.vim
|
source $DOTFILES/vim/plugins_config.vim
|
||||||
source $DOTFILES/vim/shortcuts.vim
|
source $DOTFILES/vim/shortcuts.vim
|
||||||
source $DOTFILES/vim/functions.vim
|
source $DOTFILES/vim/functions.vim
|
||||||
|
|
Loading…
Reference in New Issue
Block a user