From 751eeb947a20e1bcd6e79a53bc3d15cd27bf2371 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 22:36:50 +1200 Subject: Add +title settings to .vimrc --- vim/vimrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index 9fc842b5..9cee7a39 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -150,6 +150,12 @@ if has('linebreak') endif +" Don't set window icons or titles in terminals or the GUI +if has('title') + set noicon + set notitle +endif + " Let me move beyond buffer text in visual block mode if has('virtualedit') set virtualedit+=block -- cgit v1.2.3 From f9de91a7f7d1a514bdebd1d4045952aa30f44339 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 22:48:13 +1200 Subject: Stack Vim ^ to make it support counts Can't immediately see a clean way to do it for operator mode, though. --- vim/vimrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index 9cee7a39..b5ccb4f9 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -193,6 +193,12 @@ if v:version >= 700 xnoremap & :&& endif +" Stack ^ to make it support counts by abusing $ +nnoremap ^ $^ +if v:version >= 700 + xnoremap ^ $^ +endif + " Stack insert Ctrl-C to undo the escaped insert operation inoremap u -- cgit v1.2.3 From f09ddf0e8390cca6ce0c70472825cc41368fdfa1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 22:52:47 +1200 Subject: Adjust comments specifying Vim mapping modes --- vim/vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index b5ccb4f9..bc49834a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -181,19 +181,19 @@ if has('windows') endif endif -" Rebind normal, visual to scroll down a page +" Rebind normal/visual to scroll down a page nnoremap if v:version >= 700 xnoremap endif -" Rebind normal, visual & to preserve substitution flags +" Rebind normal/visual & to preserve substitution flags nnoremap & :&& if v:version >= 700 xnoremap & :&& endif -" Stack ^ to make it support counts by abusing $ +" Stack normal/visual ^ to make it support counts by abusing $ nnoremap ^ $^ if v:version >= 700 xnoremap ^ $^ @@ -202,7 +202,7 @@ endif " Stack insert Ctrl-C to undo the escaped insert operation inoremap u -" Stack normal, visual Ctrl-L to clear search highlight before redraw +" Stack normal/visual Ctrl-L to clear search highlight before redraw nnoremap :nohlsearch if v:version >= 700 xnoremap :nohlsearchgv -- cgit v1.2.3 From a2dcef64b25a60a76015753d2479233ba78733b8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 22:58:21 +1200 Subject: Add gg mapping to exrc --- ex/exrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ex/exrc b/ex/exrc index 355b48ee..9c764b83 100644 --- a/ex/exrc +++ b/ex/exrc @@ -3,3 +3,6 @@ set autoindent set report=0 set shiftwidth=4 set showmode + +" Make gg go to the top of the file +map gg 1G -- cgit v1.2.3 From 15bc98d23efbb4def7aa4447b3c2c39854f6b8d0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 23:00:34 +1200 Subject: Remove 'ruler' Vim option Let's see if I miss it. I have CTRL-G. --- vim/vimrc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index bc49834a..17927fbc 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -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= -- cgit v1.2.3 From 2c3ba061cd709aac08907e2df08d8257c7f5a492 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 23:59:45 +1200 Subject: Revert "Add +title settings to .vimrc" This reverts commit 751eeb947a20e1bcd6e79a53bc3d15cd27bf2371. --- vim/vimrc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 17927fbc..98023f3f 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -145,12 +145,6 @@ if has('linebreak') endif -" Don't set window icons or titles in terminals or the GUI -if has('title') - set noicon - set notitle -endif - " Let me move beyond buffer text in visual block mode if has('virtualedit') set virtualedit+=block -- cgit v1.2.3 From d26635ffd674f245def447db75ae1c14884d8a87 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 00:00:43 +1200 Subject: Revert "Add gg mapping to exrc" This reverts commit a2dcef64b25a60a76015753d2479233ba78733b8. --- ex/exrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/ex/exrc b/ex/exrc index 9c764b83..355b48ee 100644 --- a/ex/exrc +++ b/ex/exrc @@ -3,6 +3,3 @@ set autoindent set report=0 set shiftwidth=4 set showmode - -" Make gg go to the top of the file -map gg 1G -- cgit v1.2.3 From 6b399b72d12ed5e81b67baa958c07cd2db17c144 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 00:01:22 +1200 Subject: Revert "Stack Vim ^ to make it support counts" This reverts commit f9de91a7f7d1a514bdebd1d4045952aa30f44339. --- vim/vimrc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 98023f3f..60f47d18 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -182,12 +182,6 @@ if v:version >= 700 xnoremap & :&& endif -" Stack normal/visual ^ to make it support counts by abusing $ -nnoremap ^ $^ -if v:version >= 700 - xnoremap ^ $^ -endif - " Stack insert Ctrl-C to undo the escaped insert operation inoremap u -- cgit v1.2.3 From 6c86137d744f767a49231fa1e61c6b2c525f85aa Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 00:02:29 +1200 Subject: Revert "Start using ~/.vim/vimrc as vimrc path" This reverts commit 40c1e1ace9531ae11f44dde2b893dfd6fae0cc3c. I don't actually like this much. --- Makefile | 5 ++--- vim/stub.vimrc | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 vim/stub.vimrc diff --git a/Makefile b/Makefile index f986416f..4f8b867b 100644 --- a/Makefile +++ b/Makefile @@ -542,8 +542,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 +555,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 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 -- cgit v1.2.3 From eb3da0c180f0060785fae8f16af55fbbd09e8d2d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 00:34:47 +1200 Subject: Update juvenile.vim colorscheme --- vim/bundle/juvenile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/juvenile b/vim/bundle/juvenile index 16bb7d26..f8dd96db 160000 --- a/vim/bundle/juvenile +++ b/vim/bundle/juvenile @@ -1 +1 @@ -Subproject commit 16bb7d26ec9ae1fe6d34646ebf8366c797f955c8 +Subproject commit f8dd96db090e86875c37136ca0484dd1d10abd92 -- cgit v1.2.3 From c78e7a2f2140ef088886bd76f9cfe8f492c434e8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 15:19:44 +1200 Subject: Correct comment spelling in .vimrc --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 60f47d18..ff76bdf1 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -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 -- cgit v1.2.3 From d79cb0392451afb3959ea4a254e2834e469db407 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 16:54:29 +1200 Subject: Support nested dirs in two Vim runtime subdirs ~/.vim/after/ftplugin and ~/.vim/autoload, specifically. --- Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4f8b867b..45726635 100644 --- a/Makefile +++ b/Makefile @@ -509,8 +509,11 @@ install-vim-after: install-vim-after-ftplugin \ install-vim-after-syntax install-vim-after-ftplugin: - mkdir -p $(VIMDIR)/after/ftplugin - cp -p -- vim/after/ftplugin/*.vim $(VIMDIR)/after/ftplugin + find vim/after/ftplugin/* \ + -type d -exec sh -c \ + 'mkdir -p -- $(VIMDIR)/"$${1#vim/}"' _ {} \; \ + -o -type f -exec sh -c \ + 'cp -p -- "$$1" $(VIMDIR)/"$${1#vim/}"' _ {} \; install-vim-after-indent: mkdir -p $(VIMDIR)/after/indent @@ -525,8 +528,11 @@ install-vim-after-syntax: cp -p -- vim/after/syntax/*.vim $(VIMDIR)/after/syntax install-vim-autoload: - mkdir -p -- $(VIMDIR)/autoload - cp -p -- vim/autoload/*.vim $(VIMDIR)/autoload + find vim/autoload/* \ + -type d -exec sh -c \ + 'mkdir -p -- $(VIMDIR)/"$${1#vim/}"' _ {} \; \ + -o -type f -exec sh -c \ + 'cp -p -- "$$1" $(VIMDIR)/"$${1#vim/}"' _ {} \; install-vim-bundle: install-vim-config find vim/bundle/*/* \ -- cgit v1.2.3 From 8c364ee070ca116c462997b6cfc28d963c33becd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 16:58:37 +1200 Subject: Add new html/timestamp.vim ftplugin Not sure if this one will get published--it's a bit ad-hoc in its current state. --- vim/after/ftplugin/html/timestamp.vim | 28 ++++++++++++++++++++++++++++ vim/autoload/html/timestamp.vim | 15 +++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 vim/after/ftplugin/html/timestamp.vim create mode 100644 vim/autoload/html/timestamp.vim diff --git a/vim/after/ftplugin/html/timestamp.vim b/vim/after/ftplugin/html/timestamp.vim new file mode 100644 index 00000000..29a215cd --- /dev/null +++ b/vim/after/ftplugin/html/timestamp.vim @@ -0,0 +1,28 @@ +" html/timestamp.vim: Update timestamps in HTML files on save. + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_html_timestamp') + finish +endif + +" Flag as loaded +let b:did_ftplugin_html_timestamp = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_html_timestamp' + +" Set up appropriate hooks +augroup html_timestamp + autocmd! + autocmd BufWritePre *.html + \ if exists('b:html_timestamp_check') + \| call html#timestamp#Update() + \|endif +augroup END +let b:undo_ftplugin = b:undo_ftplugin + \ . '|augroup html_timestamp|autocmd!|augroup END' + \ . '|augroup! html_timestamp' diff --git a/vim/autoload/html/timestamp.vim b/vim/autoload/html/timestamp.vim new file mode 100644 index 00000000..1b3ea830 --- /dev/null +++ b/vim/autoload/html/timestamp.vim @@ -0,0 +1,15 @@ +function! html#timestamp#Update() abort + if !&modified + return + endif + let l:cv = winsaveview() + call cursor(1,1) + let l:li = search('\C^\s*Last updated: .\+$', '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.*', + \ 'Last updated: '.l:date.'', '')) + endif + call winrestview(l:cv) +endfunction -- cgit v1.2.3 From 09d180ee3c798928535c5a0d0677594605652b9a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 22:33:01 +1200 Subject: Merge HTML timestamp into after/ftplugin/html.vim I don't see myself breaking this out into its own ftplugin, and the Makefile can be simpler this way. --- Makefile | 14 ++++---------- vim/after/ftplugin/html.vim | 12 ++++++++++++ vim/after/ftplugin/html/timestamp.vim | 28 ---------------------------- vim/autoload/html.vim | 17 +++++++++++++++++ vim/autoload/html/timestamp.vim | 15 --------------- 5 files changed, 33 insertions(+), 53 deletions(-) delete mode 100644 vim/after/ftplugin/html/timestamp.vim delete mode 100644 vim/autoload/html/timestamp.vim diff --git a/Makefile b/Makefile index 45726635..f0a0c5f9 100644 --- a/Makefile +++ b/Makefile @@ -509,11 +509,8 @@ install-vim-after: install-vim-after-ftplugin \ install-vim-after-syntax install-vim-after-ftplugin: - find vim/after/ftplugin/* \ - -type d -exec sh -c \ - 'mkdir -p -- $(VIMDIR)/"$${1#vim/}"' _ {} \; \ - -o -type f -exec sh -c \ - 'cp -p -- "$$1" $(VIMDIR)/"$${1#vim/}"' _ {} \; + mkdir -p $(VIMDIR)/after/ftplugin + cp -p -- vim/after/ftplugin/*.vim $(VIMDIR)/after/ftplugin install-vim-after-indent: mkdir -p $(VIMDIR)/after/indent @@ -528,11 +525,8 @@ install-vim-after-syntax: cp -p -- vim/after/syntax/*.vim $(VIMDIR)/after/syntax install-vim-autoload: - find vim/autoload/* \ - -type d -exec sh -c \ - 'mkdir -p -- $(VIMDIR)/"$${1#vim/}"' _ {} \; \ - -o -type f -exec sh -c \ - 'cp -p -- "$$1" $(VIMDIR)/"$${1#vim/}"' _ {} \; + mkdir -p $(VIMDIR)/autoload + cp -p -- vim/autoload/*.vim $(VIMDIR)/autoload install-vim-bundle: install-vim-config find vim/bundle/*/* \ diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index a8e9efcc..a9d3f948 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -9,6 +9,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/html/timestamp.vim b/vim/after/ftplugin/html/timestamp.vim deleted file mode 100644 index 29a215cd..00000000 --- a/vim/after/ftplugin/html/timestamp.vim +++ /dev/null @@ -1,28 +0,0 @@ -" html/timestamp.vim: Update timestamps in HTML files on save. - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_timestamp') - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_timestamp = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_timestamp' - -" Set up appropriate hooks -augroup html_timestamp - autocmd! - autocmd BufWritePre *.html - \ if exists('b:html_timestamp_check') - \| call html#timestamp#Update() - \|endif -augroup END -let b:undo_ftplugin = b:undo_ftplugin - \ . '|augroup html_timestamp|autocmd!|augroup END' - \ . '|augroup! html_timestamp' 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 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*Last updated: .\+$', '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.*', + \ 'Last updated: '.l:date.'', '')) + endif + call winrestview(l:cv) +endfunction diff --git a/vim/autoload/html/timestamp.vim b/vim/autoload/html/timestamp.vim deleted file mode 100644 index 1b3ea830..00000000 --- a/vim/autoload/html/timestamp.vim +++ /dev/null @@ -1,15 +0,0 @@ -function! html#timestamp#Update() abort - if !&modified - return - endif - let l:cv = winsaveview() - call cursor(1,1) - let l:li = search('\C^\s*Last updated: .\+$', '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.*', - \ 'Last updated: '.l:date.'', '')) - endif - call winrestview(l:cv) -endfunction -- cgit v1.2.3 From fa3465d5c37d04ae1657f2e59a38fec71c70dcce Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 22:41:03 +1200 Subject: Make Vim ftplugin preamble consistent with plugins --- vim/after/ftplugin/awk.vim | 5 ++++- vim/after/ftplugin/c.vim | 5 ++++- vim/after/ftplugin/cpp.vim | 5 ++++- vim/after/ftplugin/diff.vim | 5 ++++- vim/after/ftplugin/gitcommit.vim | 5 ++++- vim/after/ftplugin/html.vim | 5 ++++- vim/after/ftplugin/mail.vim | 5 ++++- vim/after/ftplugin/make.vim | 5 ++++- vim/after/ftplugin/markdown.vim | 5 ++++- vim/after/ftplugin/perl.vim | 5 ++++- vim/after/ftplugin/php.vim | 5 ++++- vim/after/ftplugin/sed.vim | 5 ++++- vim/after/ftplugin/sh.vim | 5 ++++- vim/after/ftplugin/text.vim | 5 ++++- vim/after/ftplugin/vim.vim | 5 ++++- vim/after/ftplugin/zsh.vim | 5 ++++- 16 files changed, 64 insertions(+), 16 deletions(-) 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 a9d3f948..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' 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..5fa9af61 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' 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' -- cgit v1.2.3 From ef3b8f4587c8dc3f44a0067caf1819e9d4e38251 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:06:41 +1200 Subject: Rearrange a few .vimrc comments --- vim/vimrc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index ff76bdf1..d991b138 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -137,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 @@ -154,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 -- cgit v1.2.3 From 1936d72116b689e1e5431dabc302a5d5150ca7e3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:11:22 +1200 Subject: Use not \ for maps --- vim/vimrc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index d991b138..1225e2fa 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -218,56 +218,56 @@ nnoremap ZA :wall! " ZW unconditionally writes current buffer nnoremap ZW :write! -" Normal mode leader mappings below; use a literal backslash rather than -" on the non-plugin maps so that they work on vim-tiny +" Normal mode leader mappings below; use rather than 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 " \b toggles copy-pasteable linebreak settings nmap b CopyLinebreakToggle " \c toggles 'cursorcolumn', \C toggles 'cursorline' -nnoremap \c :set cursorcolumn! cursorcolumn? -nnoremap \C :set cursorline! cursorline? +nnoremap c :set cursorcolumn! cursorcolumn? +nnoremap C :set cursorline! cursorline? " Current date and time insertion commands, requiring POSIX date(1) if has('unix') " \d inserts the local date - nnoremap \d :read !date + nnoremap d :read !date " \D inserts the UTC date - nnoremap \D :read !date -u + nnoremap D :read !date -u endif " \f shows the current 'formatoptions' at a glance -nnoremap \f :set formatoptions? +nnoremap f :set formatoptions? " \g changes directory to the current file's location -nnoremap \g :cd %:h:pwd +nnoremap g :cd %:h:pwd " \h toggles highlighting search results -nnoremap \h :set hlsearch! hlsearch? +nnoremap h :set hlsearch! hlsearch? " \i toggles showing matches as I enter my pattern -nnoremap \i :set incsearch! incsearch? +nnoremap i :set incsearch! incsearch? " \j jumps to buffers (jetpack) -nnoremap \j :buffers:buffer +nnoremap j :buffers:buffer " \l toggles showing tab, end-of-line, and trailing whitespace -nnoremap \l :set list! list? +nnoremap l :set list! list? " \n toggles line numbers -nnoremap \n :set number! number? +nnoremap n :set number! number? " \o and \O open 'pasted insert' lines nmap o PasteOpenBelow nmap O PasteOpenAbove " \p toggles paste mode -nnoremap \p :set paste! paste? +nnoremap p :set paste! paste? " \r reloads .vimrc -nnoremap \r :source $MYVIMRC +nnoremap r :source $MYVIMRC " \s toggles spell checking -nnoremap \s :setlocal spell! spell? +nnoremap s :setlocal spell! spell? " \t shows current filetype -nnoremap \t :set filetype? +nnoremap t :set filetype? " \u sets US English spelling (compare \z) -nnoremap \u :setlocal spelllang=en_us spelllang? +nnoremap u :setlocal spelllang=en_us spelllang? " \w toggles wrapping -nnoremap \w :set wrap! wrap? +nnoremap w :set wrap! wrap? " \x strips trailing whitespace via a custom plugin nmap x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) -nnoremap \z :setlocal spelllang=en_nz spelllang? +nnoremap z :setlocal spelllang=en_nz spelllang? " Custom digraphs if has('digraphs') -- cgit v1.2.3 From ff0386dd62b8affc52ae5297405dc922b1ee6fdc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:13:29 +1200 Subject: Prefer "remap" to "rebind" --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 1225e2fa..feeba6e9 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -164,13 +164,13 @@ if has('windows') endif endif -" Rebind normal/visual to scroll down a page +" Remap normal/visual to scroll down a page nnoremap if v:version >= 700 xnoremap endif -" Rebind normal/visual & to preserve substitution flags +" Remap normal/visual & to preserve substitution flags nnoremap & :&& if v:version >= 700 xnoremap & :&& -- cgit v1.2.3 From 263c8ce75246b998a80c5f751fe5f8f776a25102 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:13:55 +1200 Subject: Remove range strip from :& rebind Not needed; a range works just fine --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index feeba6e9..b52a5368 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -171,7 +171,7 @@ if v:version >= 700 endif " Remap normal/visual & to preserve substitution flags -nnoremap & :&& +nnoremap & :&& if v:version >= 700 xnoremap & :&& endif -- cgit v1.2.3 From 3a5f0bfd84b11846a389bdd4c331f47b69a84116 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:14:54 +1200 Subject: Remove conditional around \d,\D maps --- vim/vimrc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index b52a5368..b4769216 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -228,13 +228,10 @@ nmap b CopyLinebreakToggle " \c toggles 'cursorcolumn', \C toggles 'cursorline' nnoremap c :set cursorcolumn! cursorcolumn? nnoremap C :set cursorline! cursorline? -" Current date and time insertion commands, requiring POSIX date(1) -if has('unix') - " \d inserts the local date - nnoremap d :read !date - " \D inserts the UTC date - nnoremap D :read !date -u -endif +" \d inserts the local date (POSIX date) +nnoremap d :read !date +" \D inserts the UTC date (POSIX date) +nnoremap D :read !date -u " \f shows the current 'formatoptions' at a glance nnoremap f :set formatoptions? " \g changes directory to the current file's location -- cgit v1.2.3 From 320faa7654ab04216e61c6c0c419e2042bc80853 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:15:17 +1200 Subject: Reorder mappings --- vim/vimrc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index b4769216..2ba4fdff 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -164,6 +164,19 @@ if has('windows') endif endif +" Remap normal J to stay in place while joining lines +if &loadplugins + nmap J 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 :wall! +" ZW unconditionally writes current buffer +nnoremap ZW :write! + " Remap normal/visual to scroll down a page nnoremap if v:version >= 700 @@ -176,15 +189,15 @@ if v:version >= 700 xnoremap & :&& endif -" Stack insert Ctrl-C to undo the escaped insert operation -inoremap u - " Stack normal/visual Ctrl-L to clear search highlight before redraw nnoremap :nohlsearch if v:version >= 700 xnoremap :nohlsearchgv endif +" Stack insert Ctrl-C to undo the escaped insert operation +inoremap u + " Cycle through argument list nnoremap [a :previous nnoremap ]a :next @@ -205,19 +218,6 @@ nnoremap ]t :tabnext nmap [ PutBlankLinesAbove nmap ] PutBlankLinesBelow -" Remap normal J to stay in place while joining lines -if &loadplugins - nmap J 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 :wall! -" ZW unconditionally writes current buffer -nnoremap ZW :write! - " Normal mode leader mappings below; use rather than on the " non-plugin maps so that they work on vim-tiny -- cgit v1.2.3 From c4d7309460483606505ef557b874d622303b17aa Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:46:18 +1200 Subject: Simplify Ctrl-L Vim map It can be used in select mode, too. --- vim/vimrc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 2ba4fdff..91cff473 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -189,11 +189,8 @@ if v:version >= 700 xnoremap & :&& endif -" Stack normal/visual Ctrl-L to clear search highlight before redraw -nnoremap :nohlsearch -if v:version >= 700 - xnoremap :nohlsearchgv -endif +" Stack normal/visual/select Ctrl-L to clear search highlight +noremap :nohlsearch " Stack insert Ctrl-C to undo the escaped insert operation inoremap u -- cgit v1.2.3 From dae802d5c726fb431fc54e940e08575feb9c81d8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:47:09 +1200 Subject: Remove unused mappings These have all fallen out of disuse; I'm much more likely to y$ anyway. --- vim/vimrc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 91cff473..33c80f1a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -169,14 +169,6 @@ if &loadplugins nmap J 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 :wall! -" ZW unconditionally writes current buffer -nnoremap ZW :write! - " Remap normal/visual to scroll down a page nnoremap if v:version >= 700 -- cgit v1.2.3 From 8dcdf5f8273c0fc38bdb3258eba4a853793666a2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:47:47 +1200 Subject: Rearrange mappings a little more --- vim/vimrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 33c80f1a..da48f4c6 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -164,6 +164,12 @@ if has('windows') endif endif +" Stack normal/visual/select Ctrl-L to clear search highlight +noremap :nohlsearch + +" Stack insert Ctrl-C to undo the escaped insert operation +inoremap u + " Remap normal J to stay in place while joining lines if &loadplugins nmap J FixedJoin @@ -181,12 +187,6 @@ if v:version >= 700 xnoremap & :&& endif -" Stack normal/visual/select Ctrl-L to clear search highlight -noremap :nohlsearch - -" Stack insert Ctrl-C to undo the escaped insert operation -inoremap u - " Cycle through argument list nnoremap [a :previous nnoremap ]a :next -- cgit v1.2.3 From 236a63e4d3fa1f94c80636a8c7959d4c5f9894f5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:48:13 +1200 Subject: Swap \c and \C bindings --- vim/vimrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index da48f4c6..f8cfc115 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -214,9 +214,10 @@ nmap ] PutBlankLinesBelow nnoremap a :ToggleOptionFlagLocal formatoptions a " \b toggles copy-pasteable linebreak settings nmap b CopyLinebreakToggle -" \c toggles 'cursorcolumn', \C toggles 'cursorline' -nnoremap c :set cursorcolumn! cursorcolumn? -nnoremap C :set cursorline! cursorline? +" \c toggles 'cursorline' +nnoremap c :set cursorline! cursorline? +" \C toggles 'cursorcolumn' +nnoremap C :set cursorcolumn! cursorcolumn? " \d inserts the local date (POSIX date) nnoremap d :read !date " \D inserts the UTC date (POSIX date) -- cgit v1.2.3 From cc8561269c9bcca317bca607f75dd6c0e02a6694 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:48:32 +1200 Subject: Allow range for \d and \D bindings --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f8cfc115..c4f6c2dd 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -219,9 +219,9 @@ nnoremap c :set cursorline! cursorline? " \C toggles 'cursorcolumn' nnoremap C :set cursorcolumn! cursorcolumn? " \d inserts the local date (POSIX date) -nnoremap d :read !date +nnoremap d :read !date " \D inserts the UTC date (POSIX date) -nnoremap D :read !date -u +nnoremap D :read !date -u " \f shows the current 'formatoptions' at a glance nnoremap f :set formatoptions? " \g changes directory to the current file's location -- cgit v1.2.3 From 1e845312f6396cad8bf7d3c9bb2a83f353438832 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:48:54 +1200 Subject: Add \m, \M, \v, and \V mappings For listing maps and variables. --- vim/vimrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index c4f6c2dd..f322c191 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -234,6 +234,10 @@ nnoremap i :set incsearch! incsearch? nnoremap j :buffers:buffer " \l toggles showing tab, end-of-line, and trailing whitespace nnoremap l :set list! list? +" \m shows all maps +nnoremap m :map +" \M shows buffer-local maps +nnoremap M :map " \n toggles line numbers nnoremap n :set number! number? " \o and \O open 'pasted insert' lines @@ -249,6 +253,10 @@ nnoremap s :setlocal spell! spell? nnoremap t :set filetype? " \u sets US English spelling (compare \z) nnoremap u :setlocal spelllang=en_us spelllang? +" \v shows all global variables +nnoremap v :let g: v: +" \V shows all local variables +nnoremap v :let b: t: w: " \w toggles wrapping nnoremap w :set wrap! wrap? " \x strips trailing whitespace via a custom plugin -- cgit v1.2.3 From 07288c6255de470a5539d6f7b45c992f450c3d90 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:49:54 +1200 Subject: Remove unnecessary value report from \u \z maps --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f322c191..5cc62439 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -252,7 +252,7 @@ nnoremap s :setlocal spell! spell? " \t shows current filetype nnoremap t :set filetype? " \u sets US English spelling (compare \z) -nnoremap u :setlocal spelllang=en_us spelllang? +nnoremap u :setlocal spelllang=en_us " \v shows all global variables nnoremap v :let g: v: " \V shows all local variables @@ -262,7 +262,7 @@ nnoremap w :set wrap! wrap? " \x strips trailing whitespace via a custom plugin nmap x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) -nnoremap z :setlocal spelllang=en_nz spelllang? +nnoremap z :setlocal spelllang=en_nz " Custom digraphs if has('digraphs') -- cgit v1.2.3 From 16a18df4813c0d9e789f56e132d7133129a68f85 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:50:26 +1200 Subject: Remove custom digraphs Ellipsis is digraph ,. which is fine. Mac command key I have never used, snowman was just a joke. --- vim/vimrc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 5cc62439..b35c5404 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -264,13 +264,6 @@ nmap x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap z :setlocal spelllang=en_nz -" 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 -- cgit v1.2.3 From 5a25d075ad3f26bcdc14e39b75c1f893fcc79eef Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:51:04 +1200 Subject: Move plugin-specific settings into ~/.vim/plugin Makes way more sense--these files won't get loaded by definition unless plugins are enabled, and dist.vim will still be in time to stop the distributed plugins from loading. --- vim/plugin/dist.vim | 16 ++++++++++++++++ vim/plugin/macros.vim | 5 ----- vim/plugin/matchit.vim | 6 ++++++ vim/vimrc | 27 --------------------------- 4 files changed, 22 insertions(+), 32 deletions(-) create mode 100644 vim/plugin/dist.vim delete mode 100644 vim/plugin/macros.vim create mode 100644 vim/plugin/matchit.vim 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/vimrc b/vim/vimrc index b35c5404..52b1a378 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -264,32 +264,5 @@ nmap x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap z :setlocal spelllang=en_nz -" 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 - " Source any .vim files from ~/.vim/config runtime! config/*.vim -- cgit v1.2.3 From 85007e32c4a7adbeb12291b25823a74b40e428e6 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:53:34 +1200 Subject: Break up \o and \O mapping comment --- vim/vimrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 52b1a378..fb404fe8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -240,8 +240,9 @@ nnoremap m :map nnoremap M :map " \n toggles line numbers nnoremap n :set number! number? -" \o and \O open 'pasted insert' lines +" \o opens a line below in paste mode nmap o PasteOpenBelow +" \o opens a line above in paste mode nmap O PasteOpenAbove " \p toggles paste mode nnoremap p :set paste! paste? -- cgit v1.2.3 From 93dce7a81ba12698c3c6fffa50f55f4c743710da Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:54:46 +1200 Subject: Include install-vim-plugin in install-vim target --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f0a0c5f9..86b3942c 100644 --- a/Makefile +++ b/Makefile @@ -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 \ -- cgit v1.2.3 From 7814a00e2fd9f53aac70c930414de3b035111b30 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:55:46 +1200 Subject: Correct \V mapping --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index fb404fe8..29ddccec 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -257,7 +257,7 @@ nnoremap u :setlocal spelllang=en_us " \v shows all global variables nnoremap v :let g: v: " \V shows all local variables -nnoremap v :let b: t: w: +nnoremap V :let b: t: w: " \w toggles wrapping nnoremap w :set wrap! wrap? " \x strips trailing whitespace via a custom plugin -- cgit v1.2.3 From 8d87620cf7d312ecd9cf0b74e4668e1bfe9aa492 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 23:58:19 +1200 Subject: Clear away stock vim ftplugin's buffer maps --- vim/after/ftplugin/vim.vim | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 5fa9af61..5726e1e4 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -23,18 +23,16 @@ nnoremap l let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap 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 [[' - \ . '|vunmap [[' - \ . '|nunmap ]]' - \ . '|vunmap ]]' - \ . '|nunmap []' - \ . '|vunmap []' - \ . '|nunmap ][' - \ . '|vunmap ][' - \ . '|nunmap ]"' - \ . '|vunmap ]"' - \ . '|nunmap ["' - \ . '|vunmap ["' +" Just get rid of the core ftplugin's square-bracket maps; I don't use them +silent! nunmap [[ +silent! vunmap [[ +silent! nunmap ]] +silent! vunmap ]] +silent! nunmap [] +silent! vunmap [] +silent! nunmap ][ +silent! vunmap ][ +silent! nunmap ]" +silent! vunmap ]" +silent! nunmap [" +silent! vunmap [" -- cgit v1.2.3 From cbaa10e9f4b2708ad1733f06992e68cba9d04296 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 2 Jul 2018 11:02:25 +1200 Subject: Add insert_cancel.vim plugin and configuration --- .gitmodules | 3 +++ vim/bundle/insert_cancel | 1 + vim/vimrc | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 160000 vim/bundle/insert_cancel 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 diff --git a/vim/bundle/insert_cancel b/vim/bundle/insert_cancel new file mode 160000 index 00000000..ec055122 --- /dev/null +++ b/vim/bundle/insert_cancel @@ -0,0 +1 @@ +Subproject commit ec0551228a91752d2be5f9d771e2cb5a624e6ba4 diff --git a/vim/vimrc b/vim/vimrc index 29ddccec..80eef1e6 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -168,7 +168,9 @@ endif noremap :nohlsearch " Stack insert Ctrl-C to undo the escaped insert operation -inoremap u +" Default to not-quite-correct vim-tiny-compatible map if no plugin +inoremap InsertCancel u +imap InsertCancel " Remap normal J to stay in place while joining lines if &loadplugins -- cgit v1.2.3 From ab847d44e227e8f054522c4695077988fc465d17 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 2 Jul 2018 11:02:39 +1200 Subject: Reimplement fallback for fixed_join.vim --- vim/vimrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 80eef1e6..15d86763 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -173,9 +173,9 @@ inoremap InsertCancel u imap InsertCancel " Remap normal J to stay in place while joining lines -if &loadplugins - nmap J FixedJoin -endif +" Default to not-quite-correct vim-tiny-compatible map if no plugin +nnoremap FixedJoin mzJ`z +nmap J FixedJoin " Remap normal/visual to scroll down a page nnoremap -- cgit v1.2.3 From 8f4c107c59c78f38c4782c71e4f63849036927ea Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 2 Jul 2018 11:07:29 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index efd50e06..949d3df7 100644 --- a/VERSION +++ b/VERSION @@ -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 -- cgit v1.2.3