diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-02 11:07:56 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-02 11:07:56 +1200 |
commit | b6cfedbbf4e02e71fbd0e44a70a33227ce03c0ed (patch) | |
tree | 45fca8d773e13b2129529ba188f7c39034fd8fbd | |
parent | Merge branch 'release/v1.14.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-b6cfedbbf4e02e71fbd0e44a70a33227ce03c0ed.tar.gz dotfiles-b6cfedbbf4e02e71fbd0e44a70a33227ce03c0ed.zip |
Merge branch 'release/v1.15.0'v1.15.0
* release/v1.15.0: (37 commits)
Bump VERSION
Reimplement fallback for fixed_join.vim
Add insert_cancel.vim plugin and configuration
Clear away stock vim ftplugin's buffer maps
Correct \V mapping
Include install-vim-plugin in install-vim target
Break up \o and \O mapping comment
Move plugin-specific settings into ~/.vim/plugin
Remove custom digraphs
Remove unnecessary value report from \u \z maps
Add \m, \M, \v, and \V mappings
Allow range for \d and \D bindings
Swap \c and \C bindings
Rearrange mappings a little more
Remove unused mappings
Simplify Ctrl-L Vim map
Reorder mappings
Remove conditional around \d,\D maps
Remove range strip from :& rebind
Prefer "remap" to "rebind"
...
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/awk.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/c.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/cpp.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/diff.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/gitcommit.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/html.vim | 17 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/make.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/markdown.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/perl.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/php.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/sed.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/sh.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/text.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/vim.vim | 33 | ||||
-rw-r--r-- | vim/after/ftplugin/zsh.vim | 5 | ||||
-rw-r--r-- | vim/autoload/html.vim | 17 | ||||
m--------- | vim/bundle/insert_cancel | 0 | ||||
m--------- | vim/bundle/juvenile | 0 | ||||
-rw-r--r-- | vim/plugin/dist.vim | 16 | ||||
-rw-r--r-- | vim/plugin/macros.vim | 5 | ||||
-rw-r--r-- | vim/plugin/matchit.vim | 6 | ||||
-rw-r--r-- | vim/stub.vimrc | 4 | ||||
-rw-r--r-- | vim/vimrc | 153 |
27 files changed, 191 insertions, 147 deletions
diff --git a/.gitmodules b/.gitmodules index 14a95b64..6f4c3e62 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,6 +14,9 @@ [submodule "vim/bundle/fixed_join"] path = vim/bundle/fixed_join url = https://sanctum.geek.nz/code/vim-fixed-join.git +[submodule "vim/bundle/insert_cancel"] + path = vim/bundle/insert_cancel + url = https://sanctum.geek.nz/code/vim-insert-cancel.git [submodule "vim/bundle/insert_suspend_hlsearch"] path = vim/bundle/insert_suspend_hlsearch url = https://sanctum.geek.nz/code/vim-insert-suspend-hlsearch.git @@ -501,7 +501,8 @@ install-vim: install-vim-after \ install-vim-config \ install-vim-filetype \ install-vim-ftplugin \ - install-vim-indent + install-vim-indent \ + install-vim-plugin install-vim-after: install-vim-after-ftplugin \ install-vim-after-indent \ @@ -525,7 +526,7 @@ install-vim-after-syntax: cp -p -- vim/after/syntax/*.vim $(VIMDIR)/after/syntax install-vim-autoload: - mkdir -p -- $(VIMDIR)/autoload + mkdir -p $(VIMDIR)/autoload cp -p -- vim/autoload/*.vim $(VIMDIR)/autoload install-vim-bundle: install-vim-config @@ -542,8 +543,7 @@ install-vim-compiler: cp -p -- vim/compiler/*.vim $(VIMDIR)/compiler install-vim-config: - cp -p -- vim/vimrc $(VIMDIR)/vimrc - cp -p -- vim/stub.vimrc $(VIMRC) + cp -p -- vim/vimrc $(VIMRC) install-vim-filetype: cp -p -- vim/filetype.vim vim/scripts.vim $(VIMDIR) @@ -556,7 +556,7 @@ install-vim-gui: install-vim \ install-vim-gui-config install-vim-gui-config: - cp -p -- vim/gvimrc $(VIMDIR)/gvimrc + cp -p -- vim/gvimrc $(HOME)/.gvimrc install-vim-indent: mkdir -p -- $(VIMDIR)/indent @@ -1,2 +1,2 @@ -tejr dotfiles v1.14.0 -Sat Jun 30 09:19:24 UTC 2018 +tejr dotfiles v1.15.0 +Sun Jul 1 23:07:26 UTC 2018 diff --git a/vim/after/ftplugin/awk.vim b/vim/after/ftplugin/awk.vim index 2051bd21..fae66c3c 100644 --- a/vim/after/ftplugin/awk.vim +++ b/vim/after/ftplugin/awk.vim @@ -1,5 +1,8 @@ " Extra configuration for 'awk' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'awk' diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index 8ddea387..d98aa130 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -1,5 +1,8 @@ " Extra configuration for 'c' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'c' diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim index 1c834200..acecf3e5 100644 --- a/vim/after/ftplugin/cpp.vim +++ b/vim/after/ftplugin/cpp.vim @@ -1,5 +1,8 @@ " Extra configuration for 'cpp' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'cpp' diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim index a6d45afe..6098ce48 100644 --- a/vim/after/ftplugin/diff.vim +++ b/vim/after/ftplugin/diff.vim @@ -1,5 +1,8 @@ " Extra configuration for 'diff' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'diff' diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index b53854be..761ebc81 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -1,5 +1,8 @@ " Extra configuration for 'gitcommit' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'gitcommit' diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index a8e9efcc..8a1c22d4 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -1,5 +1,8 @@ " Extra configuration for 'html' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'html' @@ -9,6 +12,18 @@ let b:did_ftplugin_after = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_after' +" Set up hooks for timestamp updating +augroup html_timestamp + autocmd! + autocmd BufWritePre *.html + \ if exists('b:html_timestamp_check') + \| call html#TimestampUpdate() + \|endif +augroup END +let b:undo_ftplugin = b:undo_ftplugin + \ . '|augroup html_timestamp|autocmd!|augroup END' + \ . '|augroup! html_timestamp' + " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_html_maps') finish diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index a25d55b7..68e9e17a 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,5 +1,8 @@ " Extra configuration for 'mail' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'mail' diff --git a/vim/after/ftplugin/make.vim b/vim/after/ftplugin/make.vim index ca4e41a6..30db753f 100644 --- a/vim/after/ftplugin/make.vim +++ b/vim/after/ftplugin/make.vim @@ -1,5 +1,8 @@ " Extra configuration for 'make' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'make' diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index 454e5c4c..29d13c71 100644 --- a/vim/after/ftplugin/markdown.vim +++ b/vim/after/ftplugin/markdown.vim @@ -1,5 +1,8 @@ " Extra configuration for 'markdown' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'markdown' diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index b007af64..e9747aa3 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -1,5 +1,8 @@ " Extra configuration for 'perl' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'perl' diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim index 41fab89f..587062e5 100644 --- a/vim/after/ftplugin/php.vim +++ b/vim/after/ftplugin/php.vim @@ -1,5 +1,8 @@ " Extra configuration for 'php' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'php' diff --git a/vim/after/ftplugin/sed.vim b/vim/after/ftplugin/sed.vim index b3c3abc3..e16ec53d 100644 --- a/vim/after/ftplugin/sed.vim +++ b/vim/after/ftplugin/sed.vim @@ -1,5 +1,8 @@ " Extra configuration for 'sed' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'sed' diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index 5e4d9e99..05c3e293 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -1,5 +1,8 @@ " Extra configuration for 'sh' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'sh' diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim index 22b1c27b..cd35231e 100644 --- a/vim/after/ftplugin/text.vim +++ b/vim/after/ftplugin/text.vim @@ -1,5 +1,8 @@ " Extra configuration for 'text' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'text' diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index fa65a65a..5726e1e4 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -1,5 +1,8 @@ " Extra configuration for 'vim' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'vim' @@ -20,18 +23,16 @@ nnoremap <buffer> <LocalLeader>l let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <LocalLeader>l' -" Add undo commands to fix clearing buffer-local vim maps that the core -" ftplugin leaves in place -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> [[' - \ . '|vunmap <buffer> [[' - \ . '|nunmap <buffer> ]]' - \ . '|vunmap <buffer> ]]' - \ . '|nunmap <buffer> []' - \ . '|vunmap <buffer> []' - \ . '|nunmap <buffer> ][' - \ . '|vunmap <buffer> ][' - \ . '|nunmap <buffer> ]"' - \ . '|vunmap <buffer> ]"' - \ . '|nunmap <buffer> ["' - \ . '|vunmap <buffer> ["' +" Just get rid of the core ftplugin's square-bracket maps; I don't use them +silent! nunmap <buffer> [[ +silent! vunmap <buffer> [[ +silent! nunmap <buffer> ]] +silent! vunmap <buffer> ]] +silent! nunmap <buffer> [] +silent! vunmap <buffer> [] +silent! nunmap <buffer> ][ +silent! vunmap <buffer> ][ +silent! nunmap <buffer> ]" +silent! vunmap <buffer> ]" +silent! nunmap <buffer> [" +silent! vunmap <buffer> [" diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim index 4e56f428..eb5fc035 100644 --- a/vim/after/ftplugin/zsh.vim +++ b/vim/after/ftplugin/zsh.vim @@ -1,5 +1,8 @@ " Extra configuration for 'zsh' filetypes -if &compatible || v:version < 700 || exists('b:did_ftplugin_after') +if exists('b:did_ftplugin_after') || &compatible + finish +endif +if v:version < 700 finish endif if &filetype !=# 'zsh' diff --git a/vim/autoload/html.vim b/vim/autoload/html.vim index f46b323f..c3d99706 100644 --- a/vim/autoload/html.vim +++ b/vim/autoload/html.vim @@ -13,3 +13,20 @@ function! html#UrlLink() abort normal! a</a> endfunction + +" Update a timestamp +function! html#TimestampUpdate() abort + if !&modified + return + endif + let l:cv = winsaveview() + call cursor(1,1) + let l:li = search('\C^\s*<em>Last updated: .\+</em>$', 'n') + if l:li + let l:date = substitute(system('date -u'), '\C\n$', '', '') + let l:line = getline(l:li) + call setline(l:li, substitute(l:line, '\C\S.*', + \ '<em>Last updated: '.l:date.'</em>', '')) + endif + call winrestview(l:cv) +endfunction diff --git a/vim/bundle/insert_cancel b/vim/bundle/insert_cancel new file mode 160000 +Subproject ec0551228a91752d2be5f9d771e2cb5a624e6ba diff --git a/vim/bundle/juvenile b/vim/bundle/juvenile -Subproject 16bb7d26ec9ae1fe6d34646ebf8366c797f955c +Subproject f8dd96db090e86875c37136ca0484dd1d10abd9 diff --git a/vim/plugin/dist.vim b/vim/plugin/dist.vim new file mode 100644 index 00000000..53962c93 --- /dev/null +++ b/vim/plugin/dist.vim @@ -0,0 +1,16 @@ +" Skip loading some plugins: +" I manage plugins myself with Git and a Makefile +let g:loaded_getscriptPlugin = 1 +let g:loaded_vimballPlugin = 1 +" Vim is the wrong tool for reading archives or compressed text +let g:loaded_gzip = 1 +let g:loaded_tarPlugin = 1 +let g:loaded_zipPlugin = 1 +" I prefer filtering text with Unix tools +let g:loaded_logiPat = 1 +" The shell, tab completion, and 'wildmenu' are good enough +let g:loaded_netrwPlugin = 1 +" I don't use Vim servers +let g:loaded_rrhelper = 1 +" I don't need extra spelling files +let g:loaded_spellfile_plugin = 1 diff --git a/vim/plugin/macros.vim b/vim/plugin/macros.vim deleted file mode 100644 index 585eedc8..00000000 --- a/vim/plugin/macros.vim +++ /dev/null @@ -1,5 +0,0 @@ -" If we don't have packages (Vim < 8.0), try to load matchit.vim from the -" older macros location in the distributed runtime instead -if !has('packages') - silent! runtime macros/matchit.vim -endif diff --git a/vim/plugin/matchit.vim b/vim/plugin/matchit.vim new file mode 100644 index 00000000..31e6e37d --- /dev/null +++ b/vim/plugin/matchit.vim @@ -0,0 +1,6 @@ +" Get matchit.vim, one way or another +if has('packages') && !has('nvim') + packadd! matchit +else + silent! runtime macros/matchit.vim +endif diff --git a/vim/stub.vimrc b/vim/stub.vimrc deleted file mode 100644 index a0111291..00000000 --- a/vim/stub.vimrc +++ /dev/null @@ -1,4 +0,0 @@ -" If not running truly ancient Vim, run my real vimrc -if v:version >= 600 - runtime vimrc -endif @@ -36,7 +36,7 @@ set shiftwidth=4 " Indent with four spaces " Spaces to insert on Tab key insert if v:version > 703 || v:version == 703 && has('patch693') - set softtabstop=-1 " Refer to 'shifwidth' if supported + set softtabstop=-1 " Refer to 'shiftwidth' if supported else set softtabstop=4 " Otherwise just four spaces endif @@ -111,11 +111,6 @@ set shortmess+=m " [Modified] -> [+] set shortmess+=r " [readonly] -> [RO] set shortmess+=w " written -> [w], appended -> [a] -" Show my current position in the status bar -if has('cmdline_info') - set ruler -endif - " Clear default 'comments' value, let the filetype handle it if has('comments') set comments= @@ -142,12 +137,9 @@ endif if has('linebreak') set linebreak " Break lines at word boundaries set showbreak=... " Prefix wrapped rows with three dots - - " Indent wrapped lines, if supported if exists('+breakindent') - set breakindent + set breakindent " Indent wrapped lines, if supported endif - endif " Let me move beyond buffer text in visual block mode @@ -159,12 +151,9 @@ endif if has('wildmenu') set wildmenu " Use wildmenu set wildmode=list:longest " Tab press completes and lists - - " Complete files without case sensitivity, if supported if exists('+wildignorecase') - set wildignorecase + set wildignorecase " Case insensitive, if supported endif - endif " New windows go below or to the right of a split @@ -175,27 +164,31 @@ if has('windows') endif endif -" Rebind normal, visual <Space> to scroll down a page +" Stack normal/visual/select Ctrl-L to clear search highlight +noremap <silent> <C-L> :<C-U>nohlsearch<CR><C-L> + +" Stack insert Ctrl-C to undo the escaped insert operation +" Default to not-quite-correct vim-tiny-compatible map if no plugin +inoremap <Plug>InsertCancel <C-C>u +imap <C-C> <Plug>InsertCancel + +" Remap normal J to stay in place while joining lines +" Default to not-quite-correct vim-tiny-compatible map if no plugin +nnoremap <Plug>FixedJoin mzJ`z +nmap J <Plug>FixedJoin + +" Remap normal/visual <Space> to scroll down a page nnoremap <Space> <C-F> if v:version >= 700 xnoremap <Space> <C-F> endif -" Rebind normal, visual & to preserve substitution flags -nnoremap <silent> & :<C-U>&&<CR> +" Remap normal/visual & to preserve substitution flags +nnoremap <silent> & :&&<CR> if v:version >= 700 xnoremap <silent> & :&&<CR> endif -" Stack insert Ctrl-C to undo the escaped insert operation -inoremap <C-C> <C-C>u - -" Stack normal, visual Ctrl-L to clear search highlight before redraw -nnoremap <silent> <C-L> :<C-U>nohlsearch<CR><C-L> -if v:version >= 700 - xnoremap <silent> <C-L> :<C-U>nohlsearch<CR>gv<C-L> -endif - " Cycle through argument list nnoremap [a :<C-U>previous<CR> nnoremap ]a :<C-U>next<CR> @@ -216,103 +209,63 @@ nnoremap ]t :<C-U>tabnext<CR> nmap [<Space> <Plug>PutBlankLinesAbove nmap ]<Space> <Plug>PutBlankLinesBelow -" Remap normal J to stay in place while joining lines -if &loadplugins - nmap J <Plug>FixedJoin -endif - -" Remap normal Y to yank to end of line (consistent with C, D) -nnoremap Y y$ - -" ZA unconditionally writes all buffers -nnoremap ZA :<C-U>wall!<CR> -" ZW unconditionally writes current buffer -nnoremap ZW :<C-U>write!<CR> - -" Normal mode leader mappings below; use a literal backslash rather than -" <Leader> on the non-plugin maps so that they work on vim-tiny +" Normal mode leader mappings below; use <Bslash> rather than <Leader> on the +" non-plugin maps so that they work on vim-tiny " \a toggles 'formatoptions' 'a' flag using a plugin nnoremap <Leader>a :<C-U>ToggleOptionFlagLocal formatoptions a<CR> " \b toggles copy-pasteable linebreak settings nmap <Leader>b <Plug>CopyLinebreakToggle -" \c toggles 'cursorcolumn', \C toggles 'cursorline' -nnoremap \c :<C-U>set cursorcolumn! cursorcolumn?<CR> -nnoremap \C :<C-U>set cursorline! cursorline?<CR> -" Current date and time insertion commands, requiring POSIX date(1) -if has('unix') - " \d inserts the local date - nnoremap \d :<C-U>read !date<CR> - " \D inserts the UTC date - nnoremap \D :<C-U>read !date -u<CR> -endif +" \c toggles 'cursorline' +nnoremap <Bslash>c :<C-U>set cursorline! cursorline?<CR> +" \C toggles 'cursorcolumn' +nnoremap <Bslash>C :<C-U>set cursorcolumn! cursorcolumn?<CR> +" \d inserts the local date (POSIX date) +nnoremap <Bslash>d :read !date<CR> +" \D inserts the UTC date (POSIX date) +nnoremap <Bslash>D :read !date -u<CR> " \f shows the current 'formatoptions' at a glance -nnoremap \f :<C-U>set formatoptions?<CR> +nnoremap <Bslash>f :<C-U>set formatoptions?<CR> " \g changes directory to the current file's location -nnoremap \g :<C-U>cd %:h<CR>:pwd<CR> +nnoremap <Bslash>g :<C-U>cd %:h<CR>:pwd<CR> " \h toggles highlighting search results -nnoremap \h :<C-U>set hlsearch! hlsearch?<CR> +nnoremap <Bslash>h :<C-U>set hlsearch! hlsearch?<CR> " \i toggles showing matches as I enter my pattern -nnoremap \i :<C-U>set incsearch! incsearch?<CR> +nnoremap <Bslash>i :<C-U>set incsearch! incsearch?<CR> " \j jumps to buffers (jetpack) -nnoremap \j :<C-U>buffers<CR>:buffer<Space> +nnoremap <Bslash>j :<C-U>buffers<CR>:buffer<Space> " \l toggles showing tab, end-of-line, and trailing whitespace -nnoremap \l :<C-U>set list! list?<CR> +nnoremap <Bslash>l :<C-U>set list! list?<CR> +" \m shows all maps +nnoremap <Bslash>m :<C-U>map<CR> +" \M shows buffer-local maps +nnoremap <Bslash>M :<C-U>map <buffer><CR> " \n toggles line numbers -nnoremap \n :<C-U>set number! number?<CR> -" \o and \O open 'pasted insert' lines +nnoremap <Bslash>n :<C-U>set number! number?<CR> +" \o opens a line below in paste mode nmap <Leader>o <Plug>PasteOpenBelow +" \o opens a line above in paste mode nmap <Leader>O <Plug>PasteOpenAbove " \p toggles paste mode -nnoremap \p :<C-U>set paste! paste?<CR> +nnoremap <Bslash>p :<C-U>set paste! paste?<CR> " \r reloads .vimrc -nnoremap \r :<C-U>source $MYVIMRC<CR> +nnoremap <Bslash>r :<C-U>source $MYVIMRC<CR> " \s toggles spell checking -nnoremap \s :<C-U>setlocal spell! spell?<CR> +nnoremap <Bslash>s :<C-U>setlocal spell! spell?<CR> " \t shows current filetype -nnoremap \t :<C-U>set filetype?<CR> +nnoremap <Bslash>t :<C-U>set filetype?<CR> " \u sets US English spelling (compare \z) -nnoremap \u :<C-U>setlocal spelllang=en_us spelllang?<CR> +nnoremap <Bslash>u :<C-U>setlocal spelllang=en_us<CR> +" \v shows all global variables +nnoremap <Bslash>v :<C-U>let g: v:<CR> +" \V shows all local variables +nnoremap <Bslash>V :<C-U>let b: t: w:<CR> " \w toggles wrapping -nnoremap \w :<C-U>set wrap! wrap?<CR> +nnoremap <Bslash>w :<C-U>set wrap! wrap?<CR> " \x strips trailing whitespace via a custom plugin nmap <Leader>x <Plug>StripTrailingWhitespace " \z sets NZ English spelling (compare \u) -nnoremap \z :<C-U>setlocal spelllang=en_nz spelllang?<CR> - -" Custom digraphs -if has('digraphs') - digraph ./ 8230 " HORIZONTAL ELLIPSIS U+2026 - digraph %% 8984 " PLACE OF INTEREST SIGN U+2318 (Mac command key) - digraph 8: 9731 " SNOWMAN U+2603 -endif - -" Settings for plugins -if &loadplugins - - " Add packaged matchit.vim, if supported - if has('packages') && !has('nvim') - packadd! matchit - endif - - " Skip loading some plugins: - " I manage plugins myself with Git and a Makefile - let g:loaded_getscriptPlugin = 1 - let g:loaded_vimballPlugin = 1 - " Vim is the wrong tool for reading archives or compressed text - let g:loaded_gzip = 1 - let g:loaded_tarPlugin = 1 - let g:loaded_zipPlugin = 1 - " I prefer filtering text with Unix tools - let g:loaded_logiPat = 1 - " The shell, tab completion, and 'wildmenu' are good enough - let g:loaded_netrwPlugin = 1 - " I don't use Vim servers - let g:loaded_rrhelper = 1 - " I don't need extra spelling files - let g:loaded_spellfile_plugin = 1 - -endif +nnoremap <Bslash>z :<C-U>setlocal spelllang=en_nz<CR> " Source any .vim files from ~/.vim/config runtime! config/*.vim |