From e132c864e873e8f8f040f4048e992d20468e4255 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:27:02 +1200 Subject: Spin off fixed_join Vim plugin --- .gitmodules | 3 +++ Makefile | 7 ------- vim/bundle/fixed_join | 1 + vim/doc/fixed_join.txt | 52 ----------------------------------------------- vim/plugin/fixed_join.vim | 45 ---------------------------------------- 5 files changed, 4 insertions(+), 104 deletions(-) create mode 160000 vim/bundle/fixed_join delete mode 100644 vim/doc/fixed_join.txt delete mode 100644 vim/plugin/fixed_join.vim diff --git a/.gitmodules b/.gitmodules index 90217ff7..8772a8e5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,7 @@ # My Vim plugins +[submodule "vim/bundle/fixed_join"] + path = vim/bundle/fixed_join + url = https://sanctum.geek.nz/code/vim-fixed-join.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/Makefile b/Makefile index def064d6..ff1cad84 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,6 @@ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ dist-vim-plugin-copy-linebreak \ - dist-vim-plugin-fixed-join \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace \ dist-vim-plugin-toggle-option-flag @@ -678,7 +677,6 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-command-typos \ dist-vim-plugin-copy-linebreak \ dist-vim-plugin-detect-background \ - dist-vim-plugin-fixed-join \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace \ dist-vim-plugin-toggle-option-flag @@ -718,11 +716,6 @@ dist-vim-plugin-detect-background: \ vim/doc/detect_background.txt \ VERSION sh dist/vim-plugin.sh detect_background -dist-vim-plugin-fixed-join: \ - vim/plugin/fixed_join.vim \ - vim/doc/fixed_join.txt \ - VERSION - sh dist/vim-plugin.sh fixed_join dist-vim-plugin-mail-mutt: \ vim/plugin/mail_mutt.vim \ vim/doc/mail_mutt.txt \ diff --git a/vim/bundle/fixed_join b/vim/bundle/fixed_join new file mode 160000 index 00000000..9e17f60e --- /dev/null +++ b/vim/bundle/fixed_join @@ -0,0 +1 @@ +Subproject commit 9e17f60eec422d2fd2669b909d602dfb05ac5468 diff --git a/vim/doc/fixed_join.txt b/vim/doc/fixed_join.txt deleted file mode 100644 index d12985ef..00000000 --- a/vim/doc/fixed_join.txt +++ /dev/null @@ -1,52 +0,0 @@ -*fixed_join.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *fixed_join* - -This plugin provides a mapping target and an optional command to `:join` lines -in normal mode while keeping the cursor in-place. - -REQUIREMENTS *fixed_join-requirements* - -This plugin is only available if 'compatible' is not set. - -MAPPINGS *fixed_join-mappings* - *FixedJoin* - -This plugin provides a mapping target |FixedJoin| to create a binding -for a user to `:join` lines in normal mode without the cursor jumping around. - -If the user's configuration does not specify a mapping to this target by the -time this plugin is loaded, it will attempt to map 'J' in normal mode to -simply replace the default functionality. - -COMMANDS *fixed_join-commands* - *:FixedJoin* - -The plugin also provides a `:FixedJoin` command if Vim has the -|+user_commands| feature, but this is not required. - -ALTERNATIVE *fixed-join-alternative* - -If you don't mind clobbering a mark, this whole plugin can be replaced with -one mapping in your |vimrc|: -> - :nnoremap J mzJ`z -< -This was what the author was doing before writing this plugin as an exercise. - -AUTHOR *fixed_join-author* - -Written and maintained by Tom Ryder . - -LICENSE *fixed_join-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *fixed_join-distribution* - -This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun -off into a separate distribution as it solidifies and this documentation -improves. See for more -information. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/plugin/fixed_join.vim b/vim/plugin/fixed_join.vim deleted file mode 100644 index 2e7f2abd..00000000 --- a/vim/plugin/fixed_join.vim +++ /dev/null @@ -1,45 +0,0 @@ -" -" fixed_join.vim: User-defined key mapping and optional command to keep cursor -" in place when joining lines in normal mode. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_fixed_join') || &compatible - finish -endif -let g:loaded_fixed_join = 1 - -" Declare function -function! s:FixedJoin() - - " Save current cursor position - let l:lc = line('.') - let l:cc = col('.') - - " Build and execute join command - let l:command = '.,+' . v:count1 . 'join' - execute l:command - - " Restore cursor position - call cursor(l:lc, l:cc) - -endfunction - -" Create mapping proxy to the function just defined -noremap - \ FixedJoin - \ :call FixedJoin() - -" If there's no mapping to it already, try to bind normal-mode J to it, to -" simply replace the old functionality -nmap - \ J - \ FixedJoin - -" Create a command as well in case it's useful -if has('user_commands') - command -nargs=0 - \ FixedJoin - \ call FixedJoin() -endif -- cgit v1.2.3 From 6165cfe32251c80f44625b4b3128dcb5585a6ad3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:43:54 +1200 Subject: Spin off toggle_option_flag Vim plugin --- .gitmodules | 3 ++ Makefile | 11 +--- vim/bundle/toggle_option_flags | 1 + vim/doc/toggle_option_flag.txt | 37 -------------- vim/plugin/toggle_option_flag.vim | 104 -------------------------------------- 5 files changed, 6 insertions(+), 150 deletions(-) create mode 160000 vim/bundle/toggle_option_flags delete mode 100644 vim/doc/toggle_option_flag.txt delete mode 100644 vim/plugin/toggle_option_flag.vim diff --git a/.gitmodules b/.gitmodules index 8772a8e5..550c19e9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,6 +11,9 @@ [submodule "vim/bundle/sahara"] path = vim/bundle/sahara url = https://sanctum.geek.nz/code/vim-sahara.git +[submodule "vim/bundle/toggle_option_flags"] + path = vim/bundle/toggle_option_flags + url = https://sanctum.geek.nz/code/vim-toggle-option-flags.git # Others' Vim plugins [submodule "vim/bundle/abolish"] diff --git a/Makefile b/Makefile index ff1cad84..605c10f9 100644 --- a/Makefile +++ b/Makefile @@ -83,8 +83,7 @@ dist-vim-plugin-command-typos \ dist-vim-plugin-copy-linebreak \ dist-vim-plugin-mail-mutt \ - dist-vim-plugin-strip-trailing-whitespace \ - dist-vim-plugin-toggle-option-flag + dist-vim-plugin-strip-trailing-whitespace .SUFFIXES: .SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh @@ -678,8 +677,7 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-copy-linebreak \ dist-vim-plugin-detect-background \ dist-vim-plugin-mail-mutt \ - dist-vim-plugin-strip-trailing-whitespace \ - dist-vim-plugin-toggle-option-flag + dist-vim-plugin-strip-trailing-whitespace dist-vim-plugin-auto-backupdir: \ vim/plugin/auto_backupdir.vim \ @@ -726,8 +724,3 @@ dist-vim-plugin-strip-trailing-whitespace: \ vim/doc/strip_trailing_whitespace.txt \ VERSION sh dist/vim-plugin.sh strip_trailing_whitespace -dist-vim-plugin-toggle-option-flag: \ - vim/plugin/toggle_option_flag.vim \ - vim/doc/toggle_option_flag.txt \ - VERSION - sh dist/vim-plugin.sh toggle_option_flag diff --git a/vim/bundle/toggle_option_flags b/vim/bundle/toggle_option_flags new file mode 160000 index 00000000..59f88251 --- /dev/null +++ b/vim/bundle/toggle_option_flags @@ -0,0 +1 @@ +Subproject commit 59f8825150b79f732d57d33cb75a20719a7c690d diff --git a/vim/doc/toggle_option_flag.txt b/vim/doc/toggle_option_flag.txt deleted file mode 100644 index be035221..00000000 --- a/vim/doc/toggle_option_flag.txt +++ /dev/null @@ -1,37 +0,0 @@ -*toggle_option_flag.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *toggle_option_flag* - - *:ToggleOptionFlag* *:ToggleOptionFlagLocal* -This plugin provides `:ToggleOptionFlag` and `:ToggleOptionFlagLocal` commands -to toggle the values of options like |'formatoptions'| or |'complete'| that -have values comprised of single-character or comma-separated flags. The author -originally designed it for toggling flags in |'formatoptions'| quickly. - -EXAMPLES *toggle_option_flag-examples* -> - :ToggleOptionFlag formatoptions a - :ToggleOptionFlag switchbuf useopen - :ToggleOptionFlagLocal shortmess I -< -REQUIREMENTS *toggle_option_flag-requirements* - -This plugin is only available if 'compatible' is not set. It also requires the -|+user_commands| Vim feature. - -AUTHOR *toggle_option_flag-author* - -Written and maintained by Tom Ryder . - -LICENSE *toggle_option_flag-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *toggle_option_flag-distribution* - -This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun -off into a separate distribution as it solidifies and this documentation -improves. See for more -information. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/plugin/toggle_option_flag.vim b/vim/plugin/toggle_option_flag.vim deleted file mode 100644 index bc7ccd78..00000000 --- a/vim/plugin/toggle_option_flag.vim +++ /dev/null @@ -1,104 +0,0 @@ -" -" toggle_option_flag.vim: Provide commands to toggle flags in grouped options -" like 'formatoptions', 'shortmess', 'complete', 'switchbuf', etc. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_toggle_option_flag') || &compatible - finish -endif -if !has('user_commands') - finish -endif -let g:loaded_toggle_option_flag = 1 - -" Show an error-highlighted message and beep, but without a real :echoerr -function! s:Error(message) - execute 'normal! \' - echohl ErrorMsg - echomsg a:message - echohl None -endfunction - -" Test whether an option currently has a flag as part of its value -function! s:Has(option, flag) - - " Horrible :execute to get the option's current setting into a variable - " (I couldn't get {curly braces} indirection to work) - let l:current = '' - execute 'let l:current = &' . a:option - - " If the flag we're toggling is longer than one character, this must by - " necessity be a delimited option. I think all of those in VimL are - " comma-separated. Extend the flag and value so that they'll still match at - " the start and end. Otherwise, use them as-is. - if strlen(a:flag) > 1 - let l:search_flag = ',' . a:flag . ',' - let l:search_value = ',' . l:current . ',' - else - let l:search_flag = a:flag - let l:search_value = l:current - endif - - " Return whether - return stridx(l:search_value, l:search_flag) > -1 - -endfunction - -" Internal function to do the toggling -function! s:Toggle(option, flag, local) - - " Check for spurious option strings, we don't want to :execute anything funny - if a:option =~# '\m\L' - call s:Error('Illegal option name') - return 0 - endif - - " Check the option actually exists - if !exists('&' . a:option) - call s:Error('No such option: ' . a:option) - return 0 - endif - - " Choose which set command to use - let l:set = a:local - \ ? 'setlocal' - \ : 'set' - - " Find whether the flag is set before the change - let l:before = s:Has(a:option, a:flag) - - " Assign -= or += as the operation to run based on whether the flag already - " appears in the option value or not - let l:operation = l:before - \ ? '-=' - \ : '+=' - - " Try to set the option; suppress errors, we'll check our work - silent! execute l:set - \ . ' ' - \ . a:option . l:operation . escape(a:flag, '\ ') - - " Find whether the flag is set after the change - let l:after = s:Has(a:option, a:flag) - - " If we made a difference, report the new value; if we didn't, admit it - if l:before != l:after - execute l:set . ' ' . a:option . '?' - else - call s:Error('Unable to toggle '.a:option.' flag '.a:flag) - endif - - " Return value is whether we made a change - return l:before != l:after - -endfunction - -" User commands wrapping around calls to the above function -command -nargs=+ -complete=option - \ ToggleOptionFlag - \ call Toggle(, 0) -command -nargs=+ -complete=option - \ ToggleOptionFlagLocal - \ call Toggle(, 1) -- cgit v1.2.3 From a2b0d46ddcdb747085eae9659c718dc90920456d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:49:22 +1200 Subject: Separate plugins from colorschemes --- .gitmodules | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 550c19e9..49355178 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,15 +5,17 @@ [submodule "vim/bundle/insert_suspend_hlsearch"] path = vim/bundle/insert_suspend_hlsearch url = https://sanctum.geek.nz/code/vim-insert-suspend-hlsearch.git +[submodule "vim/bundle/toggle_option_flags"] + path = vim/bundle/toggle_option_flags + url = https://sanctum.geek.nz/code/vim-toggle-option-flags.git + +# My Vim colorschemes [submodule "vim/bundle/juvenile"] path = vim/bundle/juvenile url = https://sanctum.geek.nz/code/vim-juvenile.git [submodule "vim/bundle/sahara"] path = vim/bundle/sahara url = https://sanctum.geek.nz/code/vim-sahara.git -[submodule "vim/bundle/toggle_option_flags"] - path = vim/bundle/toggle_option_flags - url = https://sanctum.geek.nz/code/vim-toggle-option-flags.git # Others' Vim plugins [submodule "vim/bundle/abolish"] -- cgit v1.2.3 From 575e5e19908beb64bd501f263130200403f0cd38 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 30 May 2018 23:56:06 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index da1e5892..09daa252 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v0.35.0 -Wed May 30 11:07:48 UTC 2018 +tejr dotfiles v0.36.0 +Wed May 30 11:55:57 UTC 2018 -- cgit v1.2.3