X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/1ac43be85134b530d0fa31d4a54cefb14ab21c94..41ff5ae8d91fb9c4c6eec8fcf761449d4c9aedbc:/etc/vim/.vimrc?ds=sidebyside diff --git a/etc/vim/.vimrc b/etc/vim/.vimrc index 341cf2a..aca1f42 100644 --- a/etc/vim/.vimrc +++ b/etc/vim/.vimrc @@ -48,6 +48,7 @@ endif unlet x unlet y + """ vim-only defaults if !has('nvim') " neovim defaults are already set @@ -57,15 +58,51 @@ if !has('nvim') autocmd! vimStartup " packages - packadd! matchit - packadd! editorconfig " this is now built to [n]vim in but optional - packadd! vim-commentary " nvim has built in commenting now + packadd! matchit " included with [n]vim but disabled by default + packadd! editorconfig " now included with [n]vim but disabled by default + packadd! vim-commentary " nvim has this built in now, vim still needs it " options set hlsearch autocmd BufRead * set autoindent endif + +""" package config +"" suda +" https://github.com/lambdalisue/vim-suda/issues/32#issuecomment-829608925 +if ! &diff + let g:suda_smart_edit = 1 +endif +" re-enable backup, swap, undo for suda buffers that we can read +" https://github.com/lambdalisue/vim-suda/issues/25 +function s:SudaSettingsSave() + let l:f = expand('') + if stridx(l:f, 'suda://') == 0 + let g:sev_suda_file = expand('') + let g:sev_suda_backup = &backup + let g:sev_suda_swapfile = &swapfile + let g:sev_suda_undofile = &undofile + endif +endfunction +function s:SudaSettingsRestore() + if exists('g:sev_suda_file') && filereadable(g:sev_suda_file) + if exists('g:sev_suda_backup') && g:sev_suda_backup + " XXX: suda.vim uses setlocal for this, even though it's global... + setlocal backup + endif + if exists('g:sev_suda_swapfile') && g:sev_suda_swapfile + setlocal swapfile + endif + if exists('g:sev_suda_undofile') && g:sev_suda_undofile + setlocal undofile + endif + endif +endfunction +autocmd BufReadPre * call s:SudaSettingsSave() +autocmd BufReadPost suda://* call s:SudaSettingsRestore() + + """ styling " nice default theme colorscheme murphy @@ -113,9 +150,16 @@ autocmd VimEnter,WinNew, autocmd VimEnter,WinNew * set list set listchars=tab:├─,extends:»,precedes:«,space:·,trail:∙,nbsp:■ + """ editor " always save undo file for all file buffers -autocmd BufRead * set undofile +autocmd BufReadPre * setlocal undofile + + +" explicitly use modeline, even on systems where it's disabled by system vimrc +autocmd BufRead * set modeline +" should be default disabled but just in case +set nomodelineexpr "" indent " always use shiftwidth instead of tabsize @@ -129,7 +173,7 @@ autocmd FileType html set softtabstop=2 shiftwidth=2 expandtab let g:EditorConfig_enable_for_new_buf = 1 "" syntax -autocmd FileType todo set colorcolumn=0 +autocmd Syntax php syn clear phpHereDoc phpNowDoc "" mappings " use more accessible escapes, as C-n and C-o are shadowed by some terminals