From fbf5479d6a5e12d0565c2213f08d27ffa36aca3c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 15:10:03 +1200 Subject: Reindent and refactor local leader mappings --- vim/vimrc | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 86f13359..6944c51e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -274,41 +274,40 @@ if 1 let g:maplocalleader = '_' endif -" Filetype-specific mappings below; use a literal underscore rather than -" to keep the commands short +" Filetype-specific mappings if has('autocmd') && v:version >= 700 augroup vimrc_filetype_mappings - autocmd! + autocmd! - " Clear existing local leader maps - autocmd FileType * call vimrc#ClearLocalLeaderMaps() + " Clear existing local leader maps + autocmd FileType * call vimrc#ClearLocalLeaderMaps() - " Diff: prune sections - autocmd FileType diff nmap _p DiffPrune - autocmd FileType diff xmap _p DiffPrune + " Diff: prune sections + autocmd FileType diff nmap p DiffPrune + autocmd FileType diff xmap p DiffPrune - " HTML: lint, URL-to-link, tidy - autocmd FileType html nmap _l HtmlLint - autocmd FileType html nmap _r HtmlUrlLink - autocmd FileType html nmap _t HtmlTidy + " HTML: lint, URL-to-link, tidy + autocmd FileType html nmap l HtmlLint + autocmd FileType html nmap r HtmlUrlLink + autocmd FileType html nmap t HtmlTidy - " Perl: check, lint, and tidy - autocmd FileType perl nmap _c PerlCheck - autocmd FileType perl nmap _l PerlLint - autocmd FileType perl nmap _t PerlTidy + " Perl: check, lint, and tidy + autocmd FileType perl nmap c PerlCheck + autocmd FileType perl nmap l PerlLint + autocmd FileType perl nmap t PerlTidy - " PHP: check - autocmd FileType php nmap _c PhpCheck + " PHP: check + autocmd FileType php nmap c PhpCheck - " Shell: check and lint - autocmd FileType sh nmap _c ShCheck - autocmd FileType sh nmap _l ShLint + " Shell: check and lint + autocmd FileType sh nmap c ShCheck + autocmd FileType sh nmap l ShLint - " VimL: lint - autocmd FileType vim nmap _l VimLint + " VimL: lint + autocmd FileType vim nmap l VimLint - " Zsh: check - autocmd FileType zsh nmap _c ZshCheck + " Zsh: check + autocmd FileType zsh nmap c ZshCheck augroup END endif -- cgit v1.2.3 From 75f2d2f394c2dc1c8db7df54a774c8ef3af1fa17 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 15:12:57 +1200 Subject: Use in vimrc where reasonable --- vim/vimrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 6944c51e..720d3f3a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -219,12 +219,12 @@ if has('digraphs') endif " Normal mode leader mappings below; use a literal backslash rather than -" so that the non-plugin mappings work on vim-tiny +" on the non-plugin maps so that they work on vim-tiny " \a toggles 'formatoptions' 'a' flag using a plugin -nnoremap \a :ToggleOptionFlagLocal formatoptions a +nnoremap a :ToggleOptionFlagLocal formatoptions a " \b toggles copy-pasteable linebreak settings -nmap \b CopyLinebreakToggle +nmap b CopyLinebreakToggle " \c toggles 'cursorcolumn', \C toggles 'cursorline' nnoremap \c :set cursorcolumn! cursorcolumn? nnoremap \C :set cursorline! cursorline? @@ -250,8 +250,8 @@ nnoremap \l :set list! list? " \n toggles line numbers nnoremap \n :set number! number? " \o and \O open 'pasted insert' lines -nmap \o PasteOpenBelow -nmap \O PasteOpenAbove +nmap o PasteOpenBelow +nmap O PasteOpenAbove " \p toggles paste mode nnoremap \p :set paste! paste? " \r reloads .vimrc @@ -265,7 +265,7 @@ nnoremap \u :setlocal spelllang=en_us spelllang? " \w toggles wrapping nnoremap \w :set wrap! wrap? " \x strips trailing whitespace via a custom plugin -nmap \x StripTrailingWhitespace +nmap x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :setlocal spelllang=en_nz spelllang? -- cgit v1.2.3 From 02f8c846ca614fdf06bf6fcc77280c590337cdac Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 19:12:28 +1200 Subject: Add and apply new clear_local_maps.vim plugin --- .gitmodules | 3 +++ vim/bundle/clear_local_maps | 1 + vim/vimrc | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 vim/bundle/clear_local_maps diff --git a/.gitmodules b/.gitmodules index dd10f0e4..46810091 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,6 +5,9 @@ [submodule "vim/bundle/big_file_options"] path = vim/bundle/big_file_options url = https://sanctum.geek.nz/code/vim-big-file-options.git +[submodule "vim/bundle/clear_local_maps"] + path = vim/bundle/clear_local_maps + url = https://sanctum.geek.nz/code/vim-clear-local-maps.git [submodule "vim/bundle/copy_linebreak"] path = vim/bundle/copy_linebreak url = https://sanctum.geek.nz/code/vim-copy-linebreak.git diff --git a/vim/bundle/clear_local_maps b/vim/bundle/clear_local_maps new file mode 160000 index 00000000..b1038f42 --- /dev/null +++ b/vim/bundle/clear_local_maps @@ -0,0 +1 @@ +Subproject commit b1038f42ef051f2829464b60d3a4aa13f3020d35 diff --git a/vim/vimrc b/vim/vimrc index 720d3f3a..12892474 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -280,7 +280,7 @@ if has('autocmd') && v:version >= 700 autocmd! " Clear existing local leader maps - autocmd FileType * call vimrc#ClearLocalLeaderMaps() + autocmd FileType * silent! call clear_local_maps#Clear() " Diff: prune sections autocmd FileType diff nmap p DiffPrune -- cgit v1.2.3 From 1cdd25cab417ef9853e44825281a174e7643a8de Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 20:43:10 +1200 Subject: Update README.md about Vim mappings --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b8f2f801..e8f6b2c1 100644 --- a/README.md +++ b/README.md @@ -334,11 +334,12 @@ combination to detach. ### Vim -The majority of the Vim configuration is just setting options, with a few -mappings. I try not to deviate too much from the Vim defaults behavior in terms -of interactive behavior and keybindings. It's extensively commented, mostly -because I was reading through it one day and realized I'd forgotten what half -of it did. System-specific configuration files go in `~/.vim/config`. +The majority of the Vim configuration is just setting options, with a fair few +mappings and remappings, both global and buffer-local. I try not to deviate too +much from the Vim defaults behavior in terms of interactive behavior and +keybindings. It's extensively commented, mostly because I was reading through +it one day and realized I'd forgotten what half of it did. System-specific +configuration files go in `~/.vim/config`. #### Filetypes @@ -372,11 +373,11 @@ implemented in or bundled with Vim itself many years ago. #### Filetype plugins I also define a few rules specific to file types I often edit in -`~/.vim/after/ftplugin`, including some local mappings for checking, linting, -and tidying, and a few more in `~/.vim/after/indent`. There are also a few -tweaks to core syntax files in `~/.vim/after/syntax`, especially for shell -script (`sh.vim`). Some of these filetype plugins are also due to be separately -distributed and installed via submodules instead. +`~/.vim/after/ftplugin`, including some buffer-local mapping targets for +checking, linting, and tidying, and a few more in `~/.vim/after/indent`. There +are also a few tweaks to core syntax files in `~/.vim/after/syntax`, especially +for shell script (`sh.vim`). Some of these filetype plugins are also due to be +separately distributed and installed via submodules instead. #### Compilers -- cgit v1.2.3 From a24f3af9fe641773074ec121d9516844934ac6bd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 20:43:55 +1200 Subject: Rebuild dotfiles(7) manual page --- man/man7/dotfiles.7df | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index 4daf288d..af533838 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -474,7 +474,7 @@ binds the same key combination to detach. .SS Vim .PP The majority of the Vim configuration is just setting options, with a -few mappings. +fair few mappings and remappings, both global and buffer\-local. I try not to deviate too much from the Vim defaults behavior in terms of interactive behavior and keybindings. It's extensively commented, mostly because I was reading through it one @@ -515,8 +515,8 @@ ago. .SS Filetype plugins .PP I also define a few rules specific to file types I often edit in -\f[C]~/.vim/after/ftplugin\f[], including some local mappings for -checking, linting, and tidying, and a few more in +\f[C]~/.vim/after/ftplugin\f[], including some buffer\-local mapping +targets for checking, linting, and tidying, and a few more in \f[C]~/.vim/after/indent\f[]. There are also a few tweaks to core syntax files in \f[C]~/.vim/after/syntax\f[], especially for shell script -- cgit v1.2.3 From 48a935b448063bcd4d4a64fe145783fae9f10c3e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 20:41:03 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 1dcd1d76..63582f6a 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.3.0 -Mon Jun 25 02:01:41 UTC 2018 +tejr dotfiles v1.4.0 +Mon Jun 25 08:40:45 UTC 2018 -- cgit v1.2.3