diff options
Diffstat (limited to 'vim')
-rw-r--r-- | vim/after/ftplugin/help.vim | 6 | ||||
-rw-r--r-- | vim/after/ftplugin/sh.vim | 1 | ||||
-rw-r--r-- | vim/after/ftplugin/vim.vim | 13 | ||||
m--------- | vim/bundle/equalalways_resized | 0 | ||||
m--------- | vim/bundle/foldlevelstart_stdin | 0 | ||||
m--------- | vim/bundle/scroll_next | 0 | ||||
-rw-r--r-- | vim/plugin/README | 3 | ||||
-rw-r--r-- | vim/plugin/equalalways_resized.vim | 27 | ||||
-rw-r--r-- | vim/plugin/foldlevelstart_stdin.vim | 28 | ||||
-rw-r--r-- | vim/plugin/scroll_next.vim | 32 | ||||
-rw-r--r-- | vim/vimrc | 60 |
11 files changed, 51 insertions, 119 deletions
diff --git a/vim/after/ftplugin/help.vim b/vim/after/ftplugin/help.vim index db621315..71ad3a8d 100644 --- a/vim/after/ftplugin/help.vim +++ b/vim/after/ftplugin/help.vim @@ -3,6 +3,12 @@ if &filetype !=# 'help' || v:version < 700 finish endif +" This variable had the wrong name before Vim 7.1 +if v:version == 700 && exists('b:undo_plugin') + let b:undo_ftplugin = b:undo_plugin + unlet b:undo_plugin +endif + " If the buffer is modifiable and writable, we're writing documentation, not " reading it; don't conceal characters if has('conceal') && &modifiable && !&readonly diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index 475527b9..766994b7 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -27,6 +27,7 @@ let b:undo_ftplugin .= '|unlet b:current_compiler b:sh_check_compiler' \ . '|setlocal errorformat< makeprg<' " Resort to g:is_posix for correct syntax on older runtime files +" 8.1.257 updated the runtime files to include a fix for this if exists('b:is_posix') \ && (v:version < 800 || v:version == 800 && !has('patch257')) let g:is_posix = 1 diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index bfac623a..46182627 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -4,9 +4,11 @@ if &filetype !=# 'vim' || v:version < 700 || &compatible endif " Use Vint as a syntax checker -compiler vint -let b:undo_ftplugin .= '|unlet b:current_compiler' - \ . '|setlocal errorformat< makeprg<' +if bufname('%') !=# 'command-line' + compiler vint + let b:undo_ftplugin .= '|unlet b:current_compiler' + \ . '|setlocal errorformat< makeprg<' +endif " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_vim_maps') @@ -19,7 +21,9 @@ nnoremap <buffer> <LocalLeader>K let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>K' " Get rid of the core ftplugin's square-bracket maps on unload -let b:undo_ftplugin .= '|nunmap <buffer> [[' +" 8.1.273 updated the runtime files to include a fix for this +if v:version < 801 || v:version == 801 && !has('patch273') + let b:undo_ftplugin .= '|nunmap <buffer> [[' \ . '|vunmap <buffer> [[' \ . '|nunmap <buffer> ]]' \ . '|vunmap <buffer> ]]' @@ -31,3 +35,4 @@ let b:undo_ftplugin .= '|nunmap <buffer> [[' \ . '|vunmap <buffer> ]"' \ . '|nunmap <buffer> ["' \ . '|vunmap <buffer> ["' +endif diff --git a/vim/bundle/equalalways_resized b/vim/bundle/equalalways_resized new file mode 160000 +Subproject 9fa2a475258563d85a75671329451c18b5ca44d diff --git a/vim/bundle/foldlevelstart_stdin b/vim/bundle/foldlevelstart_stdin new file mode 160000 +Subproject 5960c5dad48258aa14c623fc6572f867585d1c1 diff --git a/vim/bundle/scroll_next b/vim/bundle/scroll_next new file mode 160000 +Subproject 56166b68079f1573de93c4f134996854b4e6e75 diff --git a/vim/plugin/README b/vim/plugin/README new file mode 100644 index 00000000..5e969de7 --- /dev/null +++ b/vim/plugin/README @@ -0,0 +1,3 @@ +Most of my plugins are in submodules in vim/bundle. This directory, vim/plugin, +is for new plugins as they're being developed and tested, or for stuff specific +to my configuration that isn't worth packaging as its own distribution. diff --git a/vim/plugin/equalalways_resized.vim b/vim/plugin/equalalways_resized.vim deleted file mode 100644 index 8865f0af..00000000 --- a/vim/plugin/equalalways_resized.vim +++ /dev/null @@ -1,27 +0,0 @@ -" -" equalalways_resized: If 'equalalways' is set, extend it to VimResized -" events. -" -" Author: Tom Ryder <tom@sanctum.geek.nz> -" License: Same as Vim itself -" -if exists('g:loaded_equalalways_resized') || &compatible - finish -endif -if !has('autocmd') || !has('windows') || !exists('##VimResized') - finish -endif -let g:loaded_equalalways_resized = 1 - -" If 'equalalways' is set, rebalance the windows -function! s:Rebalance() abort - if &equalalways - wincmd = - endif -endfunction - -" Add hook for VimResized event -augroup equalalways_resized - autocmd! - autocmd VimResized * call s:Rebalance() -augroup END diff --git a/vim/plugin/foldlevelstart_stdin.vim b/vim/plugin/foldlevelstart_stdin.vim deleted file mode 100644 index f8e4d50e..00000000 --- a/vim/plugin/foldlevelstart_stdin.vim +++ /dev/null @@ -1,28 +0,0 @@ -" -" foldlevelstart_stdin.vim: Set 'foldlevel' to 'foldlevelstart' after reading -" from standard input, which Vim doesn't do by default. -" -" Author: Tom Ryder <tom@sanctum.geek.nz> -" License: Same as Vim itself -" -if exists('g:loaded_foldlevelstart_stdin') || &compatible - finish -endif -if !has('autocmd') || !has('folding') || !exists('##StdinReadPre') - finish -endif -let g:loaded_foldlevelstart_stdin = 1 - -" Check if 'foldlevelstart' is non-negative, and set 'foldlevel' to its value -" if it is -function! s:SetFoldlevel() abort - if &foldlevelstart >= 0 - let &l:foldlevel = &foldlevelstart - endif -endfunction - -" Watch for stdin reads and set fold level accordingly -augroup foldlevelstart_stdin - autocmd! - autocmd StdinReadPre * call s:SetFoldlevel() -augroup END diff --git a/vim/plugin/scroll_next.vim b/vim/plugin/scroll_next.vim deleted file mode 100644 index a02a4e4f..00000000 --- a/vim/plugin/scroll_next.vim +++ /dev/null @@ -1,32 +0,0 @@ -" -" scroll_next.vim: Mapping to scroll a page forward with CTRL-F until the last -" line is visible in the buffer (if supported) or the cursor is on the last -" line, and to run :next instead if so to move to the next buffer in the -" argument list. -" -" Author: Tom Ryder <tom@sanctum.geek.nz> -" License: Same as Vim itself -" -if exists('g:loaded_scroll_next') || &compatible - finish -endif -if v:version < 600 - finish -endif -let g:loaded_scroll_next = 1 - -" Check visibility of last line (Vim >=7.0) or cursor presence on last line -" and flick to :next if appropriate, or just page forward with CTRL-F -function! s:ScrollNext() abort - if line('.') == line('$') - \ || line('w$') == line('$') - silent! next - else - execute "normal! \<C-F>" - endif -endfunction - -" Mapping setup -nnoremap <silent> <unique> - \ <Plug>(ScrollNext) - \ :<C-U>call <SID>ScrollNext()<CR> @@ -55,6 +55,10 @@ endif " Add some paths not to back up set backupskip^=/dev/shm/* " Shared memory RAM disk set backupskip^=/var/tmp/* " Debian's $TMPDIR for sudoedit(8) +if !has('unix') + set backupskip-=/dev/shm/* + set backupskip-=/var/tmp/* +endif " Indent wrapped lines silent! set breakindent @@ -62,6 +66,12 @@ silent! set breakindent " Clear default 'comments' value, let the filetype handle it set comments= +" Add completion options +if exists('+completeopt') + set completeopt+=longest " Insert longest common substring + set completeopt+=menuone " Show the menu even if only one match +endif + " Give me a prompt instead of just rejecting risky :write, :saveas set confirm @@ -87,6 +97,12 @@ endif " Don't wait for a key after Escape in insert mode silent! set noesckeys +" Fold based on indent, but only when I ask +if has('folding') + set foldlevelstart=99 + set foldmethod=indent +endif + " Delete comment leaders when joining lines, if supported silent! set formatoptions+=j @@ -95,6 +111,11 @@ if system('grep --version') =~# '^grep (GNU grep)' set grepprg=grep\ -HnRs\ --exclude='.git*' endif +" Don't load GUI menus; set here before GUI starts +if has('gui_running') + set guioptions+=M +endif + " Allow buffers to have changes without being displayed set hidden @@ -139,6 +160,12 @@ set nrformats-=octal set path-=/usr/include " Let the C/C++ filetypes set that set path+=** " Search current directory's whole tree +" Make sessions usable +if exists('+sessionoptions') + set sessionoptions-=localoptions " No buffer options or mappings + set sessionoptions-=options " No global options or mappings +endif + " Don't show startup splash screen (I donated) set shortmess+=I @@ -155,28 +182,6 @@ set timeoutlen=3000 " No terminal mouse, even if we could silent! set ttymouse= -" Wildmenu settings; see also plugin/wildignore.vim -set wildmenu " Use wildmenu -set wildmode=list:longest " Tab press completes and lists -silent! set wildignorecase " Case insensitive, if supported - -" Add completion options -if exists('+completeopt') - set completeopt+=longest " Insert longest common substring - set completeopt+=menuone " Show the menu even if only one match -endif - -" Fold based on indent, but only when I ask -if has('folding') - set foldlevelstart=99 - set foldmethod=indent -endif - -" Don't load GUI menus; set here before GUI starts -if has('gui_running') - set guioptions+=M -endif - " Keep undo files, hopefully in a dedicated directory if has('persistent_undo') set undofile @@ -187,11 +192,10 @@ if has('persistent_undo') endif endif -" Make sessions usable -if exists('+sessionoptions') - set sessionoptions-=localoptions " No buffer options or mappings - set sessionoptions-=options " No global options or mappings -endif +" Wildmenu settings; see also plugin/wildignore.vim +set wildmenu " Use wildmenu +set wildmode=list:longest " Tab press completes and lists +silent! set wildignorecase " Case insensitive, if supported " Let me move beyond buffer text in visual block mode if exists('+virtualedit') @@ -211,7 +215,7 @@ endif imap <C-K><C-K> <Plug>(DigraphSearch) " Remap normal space to scroll down a page -nnoremap <Space> <C-F> +nnoremap <Space> <PageDown> " If we have plugins, do a :next after hitting the last line if &loadplugins nmap <Space> <Plug>(ScrollNext) |