diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-03 09:25:53 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-03 09:25:53 +1200 |
commit | 71ced1ccfa28a4dffe126b1408849676e4b36505 (patch) | |
tree | 73f184a6c4b81dbf6551fddc84810eb86dc4b86c | |
parent | Merge branch 'hotfix/v1.41.1' (diff) | |
parent | Rebuild dotfiles(7) man page (diff) | |
download | dotfiles-71ced1ccfa28a4dffe126b1408849676e4b36505.tar.gz dotfiles-71ced1ccfa28a4dffe126b1408849676e4b36505.zip |
Merge branch 'release/v1.42.0'v1.42.0
* release/v1.42.0:
Rebuild dotfiles(7) man page
Bump VERSION
Remove unsupported pandoc(1) option
Remove j/gj,k/gk maps again
Revert "Remove & remaps"
Add some experimental :vimgrep and :helpgrep maps
Use g_ instead of $ for yanking command lines
Correct \: mapping
Round out execution mappings
Use \! instead of \@ for line-execute
Add 'confirm'
Add \@ mapping to execute lines with 'shell'
Revert "Remove j/gj remappings"
Add leader mappings for < and >
Check for existence of +completeopt
Add longest and menuone to 'completeopt'
Add equalalways_resized.vim plugin
Remove trailing space from Vim plugin
Add missing abort attribute to plugin
Add scroll_next.vim plugin
Don't set up 'wildignore' in &compatible mode
Add foldlevelstart_stdin.vim plugin
Correct syntax of new map
Try an expanded mapping for <Space>
Remove backspace mapping
Update insert_cancel.vim plugin
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | dist/build-dotfiles-manual.sh | 2 | ||||
-rw-r--r-- | man/man7/dotfiles.7df | 2 | ||||
m--------- | vim/bundle/insert_cancel | 0 | ||||
-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/plugin/wildignore.vim | 2 | ||||
-rw-r--r-- | vim/vimrc | 40 |
9 files changed, 130 insertions, 7 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v1.41.1 -Thu Jul 26 07:46:47 UTC 2018 +tejr dotfiles v1.42.0 +Thu Aug 2 21:23:24 UTC 2018 diff --git a/dist/build-dotfiles-manual.sh b/dist/build-dotfiles-manual.sh index 07db593f..30ad6810 100644 --- a/dist/build-dotfiles-manual.sh +++ b/dist/build-dotfiles-manual.sh @@ -1,3 +1,3 @@ # Author tool for building the dotfiles(7) manual cat man/man7/dotfiles.7df.head README.md | -pandoc -sS -t man -o man/man7/dotfiles.7df +pandoc -s -t man -o man/man7/dotfiles.7df diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index 1e9c1e02..f6300f3a 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 1.19.2.1 +.\" Automatically generated by Pandoc 2.2.1 .\" .TH "DOTFILES" "7" "October 2017" "Tom Ryder's personal scripts and configuration" "" .hy diff --git a/vim/bundle/insert_cancel b/vim/bundle/insert_cancel -Subproject af423a79c9689531ec71658c2dc51804ed91a8a +Subproject 3989870e2d41b8a3caf13a261b1fa1b8b56aa9f diff --git a/vim/plugin/equalalways_resized.vim b/vim/plugin/equalalways_resized.vim new file mode 100644 index 00000000..8865f0af --- /dev/null +++ b/vim/plugin/equalalways_resized.vim @@ -0,0 +1,27 @@ +" +" 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 new file mode 100644 index 00000000..f8e4d50e --- /dev/null +++ b/vim/plugin/foldlevelstart_stdin.vim @@ -0,0 +1,28 @@ +" +" 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 new file mode 100644 index 00000000..a02a4e4f --- /dev/null +++ b/vim/plugin/scroll_next.vim @@ -0,0 +1,32 @@ +" +" 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> diff --git a/vim/plugin/wildignore.vim b/vim/plugin/wildignore.vim index b10eaa01..a08e0251 100644 --- a/vim/plugin/wildignore.vim +++ b/vim/plugin/wildignore.vim @@ -1,7 +1,7 @@ " Don't complete certain files that I'm not likely to want to manipulate from " within Vim; this is kind of expensive to reload, so I've made it a plugin " with a load guard -if v:version < 700 || !has('wildignore') +if &compatible || v:version < 700 || !has('wildignore') finish endif if exists('g:loaded_wildmenu') @@ -58,6 +58,9 @@ silent! set breakindent " Clear default 'comments' value, let the filetype handle it set comments= +" Give me a prompt instead of just rejecting risky :write, :saveas +set confirm + " Try to keep swapfiles in one system-appropriate dir set directory^=~/.vim/cache/swap//,~/vimfiles/cache/swap// @@ -142,6 +145,12 @@ 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 @@ -182,9 +191,18 @@ endif " Map double Ctrl-K in insert mode to search digraph names imap <C-K><C-K> <Plug>(DigraphSearch) -" Remap normal space to scroll down a page, backspace up a page +" Remap normal space to scroll down a page nnoremap <Space> <C-F> -nnoremap <BS> <C-B> +" If we have plugins, do a :next after hitting the last line +if &loadplugins + nmap <Space> <Plug>(ScrollNext) +endif + +" Remap normal/visual & to preserve substitution flags +nnoremap <silent> & :&&<CR> +if exists(':xnoremap') + xnoremap <silent> & :&&<CR> +endif " Map g: as a 'colon operator' nmap g: <Plug>(ColonOperator) @@ -289,11 +307,29 @@ nnoremap <Bslash>+ :<C-U>call vimrc#Anchor('1GgqG')<CR> " \. runs the configured make program into the location list nnoremap <Bslash>. :<C-U>lmake!<CR> +" \< and \> adjusts indent of last edit; good for pasting +nnoremap <Bslash>< :<C-U>'[,']<<CR> +nnoremap <Bslash>> :<C-U>'[,']><CR> + +" \/ types :vimgrep for me ready to enter a search pattern +nnoremap <Bslash>/ :<C-U>vimgrep /\c/ **<S-Left><S-Left><Right> +" \? types :helpgrep for me ready to enter a search pattern +nnoremap <Bslash>? :<C-U>helpgrep \c<S-Left> + " \DEL deletes the current buffer nnoremap <Bslash><Delete> :bdelete<CR> " \INS edits a new buffer nnoremap <Bslash><Insert> :<C-U>enew<CR> +" Execution mappings; each of these clobbers register z + +" \@ executes line in normal mode +nnoremap <Bslash>@ g^"zyg_@z +" \: executes line in command mode +nnoremap <Bslash>: g^"zyg_:<C-R>z<CR> +" \! executes line with 'shell' +nnoremap <Bslash>! g^"zyg_:!<C-R>z<CR> + " If we're running NeoVim, source some extra configuration if has('nvim') runtime nvim.vim |