From 8b579e948d20900df4957d30448be37dfc86ccef Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 10:07:26 +1200 Subject: Junk detect_background.vim and thereby autoload It's too complicated and confusing, and doesn't do enough to justify wrecking Vim's own logic for doing this sort of thing. Better to just say `:set background=dark` and be done with it. This is the only one of my inline plugins with an `autoload` file, so we can get rid of that, too. Not worth packaging/publishing to www.vim.org. --- Makefile | 12 ------------ lint/vim.sh | 1 - vim/autoload/detect_background.vim | 37 ------------------------------------- vim/config/syntax.vim | 15 +++++---------- vim/doc/detect_background.txt | 37 ------------------------------------- 5 files changed, 5 insertions(+), 97 deletions(-) delete mode 100644 vim/autoload/detect_background.vim delete mode 100644 vim/doc/detect_background.txt diff --git a/Makefile b/Makefile index 605c10f9..78bab07a 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,6 @@ install-vim-after-ftdetect \ install-vim-after-indent \ install-vim-after-syntax \ - install-vim-autoload \ install-vim-bundle \ install-vim-compiler \ install-vim-config \ @@ -499,7 +498,6 @@ VIMDIR = $(HOME)/.vim VIMRC = $(HOME)/.vimrc install-vim: install-vim-after \ - install-vim-autoload \ install-vim-bundle \ install-vim-compiler \ install-vim-config \ @@ -528,10 +526,6 @@ install-vim-after-syntax: mkdir -p $(VIMDIR)/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 - install-vim-bundle: install-vim-config find vim/bundle/*/* \ -type d -exec sh -c \ @@ -675,7 +669,6 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ dist-vim-plugin-copy-linebreak \ - dist-vim-plugin-detect-background \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace @@ -709,11 +702,6 @@ dist-vim-plugin-copy-linebreak: \ vim/doc/copy_linebreak.txt \ VERSION sh dist/vim-plugin.sh copy_linebreak -dist-vim-plugin-detect-background: \ - vim/autoload/detect_background.vim \ - vim/doc/detect_background.txt \ - VERSION - sh dist/vim-plugin.sh detect_background dist-vim-plugin-mail-mutt: \ vim/plugin/mail_mutt.vim \ vim/doc/mail_mutt.txt \ diff --git a/lint/vim.sh b/lint/vim.sh index 5c1bbe22..3c173518 100644 --- a/lint/vim.sh +++ b/lint/vim.sh @@ -1,6 +1,5 @@ set -- \ vim/after \ - vim/autoload \ vim/compiler \ vim/config \ vim/ftdetect \ diff --git a/vim/autoload/detect_background.vim b/vim/autoload/detect_background.vim deleted file mode 100644 index e4163a43..00000000 --- a/vim/autoload/detect_background.vim +++ /dev/null @@ -1,37 +0,0 @@ -" -" detect_background.vim: Invert Vim's built-in logic for choosing dark or -" light backgrounds; we'll default to choosing a dark background unless we -" find some reason *not* to. -" -" Return the string to which we think the option should be set, to allow the -" caller to use it as they see fit. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_detect_background') || &compatible - finish -endif -let g:loaded_detect_background = 1 - -" Declare autoload function for 'background' set -function! detect_background#DetectBackground() abort - - " Split up the value of $COLORFGBG (if any) by semicolons - let l:colorfgbg = split($COLORFGBG, ';') - - " Get the background color value, or an empty string if none - let l:bg = len(l:colorfgbg) - \ ? l:colorfgbg[-1] - \ : '' - - " Choose the background setting based on this value - if l:bg ==# 'default' - \ || l:bg == 7 - \ || l:bg == 15 - return 'light' - else - return 'dark' - endif - -endfunction diff --git a/vim/config/syntax.vim b/vim/config/syntax.vim index 2322db5b..a2186b1f 100644 --- a/vim/config/syntax.vim +++ b/vim/config/syntax.vim @@ -5,17 +5,12 @@ if has('syntax') && !has('g:syntax_on') silent! syntax enable silent! syntax sync minlines=100 - " If we can, detect a light background, but default to a dark one. This is - " only because it's more likely the author of this configuration will be - " using one. - if v:version >= 701 - silent! let &background = detect_background#DetectBackground() - else - set background=dark - endif + " Opinionated; if the author is using color at all, it will probably be with + " a dark background + set background=dark - " The 'sahara' colorscheme only works for dark backgrounds with 256 colors - if &background ==# 'dark' && (has('gui_running') || &t_Co == 256) + " The 'sahara' colorscheme only works in the GUI or with 256 colors + if has('gui_running') || &t_Co >= 256 silent! colorscheme sahara endif diff --git a/vim/doc/detect_background.txt b/vim/doc/detect_background.txt deleted file mode 100644 index 570ac47b..00000000 --- a/vim/doc/detect_background.txt +++ /dev/null @@ -1,37 +0,0 @@ -*detect_background.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *detect_background* - *detect_background#DetectBackground()* - -The |detect_background#DetectBackground()| function provided by this plugin -inspects the $COLORFGBG environment variable to determine whether the user is -using a terminal with a light background, and returns the word "dark" or -"light" accordingly, for use in setting 'background'. - -The function does roughly the reverse of Vim's built-in heuristics to set the -'background' option, which default to a light background in the absence of -hints otherwise. - -Note that this plugin does not inspect the value of the $TERM environment -variable or the |'term'| option at all, nor the |'t_RB'| option. - -REQUIREMENTS *detect_background-requirements* - -This plugin is only available if 'compatible' is not set. - -AUTHOR *detect_background-author* - -Written and maintained by Tom Ryder . - -LICENSE *detect_background-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *detect_background-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: -- cgit v1.2.3 From 307c4b58898222375686cc0712828420876d515f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 10:29:52 +1200 Subject: Spin off copy_linebreak Vim plugin --- .gitmodules | 3 ++ Makefile | 7 ----- vim/bundle/copy_linebreak | 1 + vim/doc/copy_linebreak.txt | 56 ----------------------------------- vim/plugin/copy_linebreak.vim | 68 ------------------------------------------- 5 files changed, 4 insertions(+), 131 deletions(-) create mode 160000 vim/bundle/copy_linebreak delete mode 100644 vim/doc/copy_linebreak.txt delete mode 100644 vim/plugin/copy_linebreak.vim diff --git a/.gitmodules b/.gitmodules index 49355178..6bc0a4e9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,7 @@ # My Vim plugins +[submodule "vim/bundle/copy_linebreak"] + path = vim/bundle/copy_linebreak + url = https://sanctum.geek.nz/code/vim-copy-linebreak.git [submodule "vim/bundle/fixed_join"] path = vim/bundle/fixed_join url = https://sanctum.geek.nz/code/vim-fixed-join.git diff --git a/Makefile b/Makefile index 78bab07a..d73dcc84 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,6 @@ dist-vim-plugin-auto-undodir \ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ - dist-vim-plugin-copy-linebreak \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace @@ -668,7 +667,6 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-undodir \ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ - dist-vim-plugin-copy-linebreak \ dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace @@ -697,11 +695,6 @@ dist-vim-plugin-command-typos: \ vim/doc/command_typos.txt \ VERSION sh dist/vim-plugin.sh command_typos -dist-vim-plugin-copy-linebreak: \ - vim/plugin/copy_linebreak.vim \ - vim/doc/copy_linebreak.txt \ - VERSION - sh dist/vim-plugin.sh copy_linebreak dist-vim-plugin-mail-mutt: \ vim/plugin/mail_mutt.vim \ vim/doc/mail_mutt.txt \ diff --git a/vim/bundle/copy_linebreak b/vim/bundle/copy_linebreak new file mode 160000 index 00000000..3448f6ae --- /dev/null +++ b/vim/bundle/copy_linebreak @@ -0,0 +1 @@ +Subproject commit 3448f6ae2bc974af48fb16aaabff85fe1bc250e5 diff --git a/vim/doc/copy_linebreak.txt b/vim/doc/copy_linebreak.txt deleted file mode 100644 index 581c6166..00000000 --- a/vim/doc/copy_linebreak.txt +++ /dev/null @@ -1,56 +0,0 @@ -*copy_linebreak.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *copy_linebreak* - -This plugin provides mapping targets for a user to set, unset, or toggle -|'linebreak'|-related settings when |'wrap'| is enabled, to switch between -human-readable output and a format friendly for copy-pasting with terminal -emulators or screen/tmux. - -REQUIREMENTS *copy_linebreak-requirements* - -This plugin is only available if 'compatible' is not set. - -MAPPINGS *copy_linebreak-mappings* - -Mapping targets provided are: - -|CopyLinebreakEnable|: *CopyLinebreakEnable* - Enable copy-paste friendly line break options. -|CopyLinebreakDisable|: *CopyLinebreakDisable* - Revert to human-readable line break options. -|CopyLinebreakToggle|: *CopyLinebreakToggle* - Toggle between the above two states. - -There are no default key mappings to any of these targers; you should define -them yourself in your |vimrc|. For example: -> - :nmap b CopyLinebreakToggle -< -COMMANDS *copy_linebreak-commands* - -If the |+user_commands| feature is available, commands provided are: - -`:CopyLinebreakEnable`: *:CopyLinebreakEnable* - Enable copy-paste friendly line break options. -`:CopyLinebreakDisable`: *:CopyLinebreakDisable* - Revert to human-readable line break options. -`:CopyLinebreakToggle`: *:CopyLinebreakToggle* - Toggle between the above two states. - -AUTHOR *copy_linebreak-author* - -Written and maintained by Tom Ryder . - -LICENSE *copy_linebreak-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *copy_linebreak-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/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim deleted file mode 100644 index a7d8a3e5..00000000 --- a/vim/plugin/copy_linebreak.vim +++ /dev/null @@ -1,68 +0,0 @@ -" -" copy_linebreak.vim: Bind user-defined key sequences to toggle a group of -" options that make text wrapped with 'wrap' copy-paste friendly. Also creates -" user commands if it can. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_copy_linebreak') || &compatible - finish -endif -if !has('linebreak') - finish -endif -let g:loaded_copy_linebreak = 1 - -" Enable copy-friendly linebreak options -function! s:CopyLinebreakEnable() - setlocal nolinebreak linebreak? - let s:showbreak_save = &showbreak - set showbreak= - if exists('+breakindent') - setlocal nobreakindent - endif -endfunction - -" Disable copy-friendly linebreak options -function! s:CopyLinebreakDisable() - setlocal linebreak linebreak? - let &showbreak = s:showbreak_save - if exists('+breakindent') - setlocal breakindent< - endif -endfunction - -" Toggle copy-friendly linebreak options, using the current setting for the -" 'linebreak' option as the pivot -function! s:CopyLinebreakToggle() - if &linebreak - call CopyLinebreakEnable() - else - call CopyLinebreakDisable() - endif -endfunction - -" Provide mappings to the function just defined -noremap - \ CopyLinebreakEnable - \ :call CopyLinebreakEnable() -noremap - \ CopyLinebreakDisable - \ :call CopyLinebreakDisable() -noremap - \ CopyLinebreakToggle - \ :call CopyLinebreakToggle() - -" Provide user commands if we can -if has('user_commands') - command -nargs=0 - \ CopyLinebreakEnable - \ call CopyLinebreakEnable - command -nargs=0 - \ CopyLinebreakDisable - \ call CopyLinebreakDisable - command -nargs=0 - \ CopyLinebreakToggle - \ call CopyLinebreakToggle -endif -- cgit v1.2.3 From 19448ce894eb2c25af150157234b5fc526dc017f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 10:40:52 +1200 Subject: Spin off mail_mutt Vim plugin --- .gitmodules | 3 +++ Makefile | 7 ----- vim/bundle/mail_mutt | 1 + vim/doc/mail_mutt.txt | 66 ------------------------------------------------ vim/plugin/mail_mutt.vim | 56 ---------------------------------------- 5 files changed, 4 insertions(+), 129 deletions(-) create mode 160000 vim/bundle/mail_mutt delete mode 100644 vim/doc/mail_mutt.txt delete mode 100644 vim/plugin/mail_mutt.vim diff --git a/.gitmodules b/.gitmodules index 6bc0a4e9..c57005ed 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,6 +8,9 @@ [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/mail_mutt"] + path = vim/bundle/mail_mutt + url = https://sanctum.geek.nz/code/vim-mail-mutt.git [submodule "vim/bundle/toggle_option_flags"] path = vim/bundle/toggle_option_flags url = https://sanctum.geek.nz/code/vim-toggle-option-flags.git diff --git a/Makefile b/Makefile index d73dcc84..ff8b493c 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,6 @@ dist-vim-plugin-auto-undodir \ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ - dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace .SUFFIXES: @@ -667,7 +666,6 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-undodir \ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ - dist-vim-plugin-mail-mutt \ dist-vim-plugin-strip-trailing-whitespace dist-vim-plugin-auto-backupdir: \ @@ -695,11 +693,6 @@ dist-vim-plugin-command-typos: \ vim/doc/command_typos.txt \ VERSION sh dist/vim-plugin.sh command_typos -dist-vim-plugin-mail-mutt: \ - vim/plugin/mail_mutt.vim \ - vim/doc/mail_mutt.txt \ - VERSION - sh dist/vim-plugin.sh mail_mutt dist-vim-plugin-strip-trailing-whitespace: \ vim/plugin/strip_trailing_whitespace.vim \ vim/doc/strip_trailing_whitespace.txt \ diff --git a/vim/bundle/mail_mutt b/vim/bundle/mail_mutt new file mode 160000 index 00000000..8f417d2a --- /dev/null +++ b/vim/bundle/mail_mutt @@ -0,0 +1 @@ +Subproject commit 8f417d2ac92b1247b24103963e64bf63d627de39 diff --git a/vim/doc/mail_mutt.txt b/vim/doc/mail_mutt.txt deleted file mode 100644 index 1129651d..00000000 --- a/vim/doc/mail_mutt.txt +++ /dev/null @@ -1,66 +0,0 @@ -*mail_mutt.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *mail_mutt* - -This plugin allows you to quickly start writing an email message in Mutt with -a range of lines from the current buffer as the initial mail content. - -REQUIREMENTS *mail_mutt-requirements* - -This plugin is only available if 'compatible' is not set. - -You will want to have the mutt(1) command from the Mutt distribution installed -to use this plugin. Mutt is available from . - -COMMANDS *mail_mutt-commands* *:MailMutt* - -This plugin provides a single command `:MailMutt` command which accepts a line -range prefix defaulting to the entire buffer, writing these lines to a -temporary file that is then provided to the -i option of the Mutt mail user -agent, as the initial content of a new message. -> - :MailMutt - :.MailMutt - :3,6MailMutt - :95,$MailMutt -< -MAPPINGS *mail_mutt-mappings* - -Three mapping targets are also provided for convenience. No attempt is -made to map key sequences to these mappings within the plugin; you must do -this explicitly in your |vimrc|. - - *MailMuttLine* -Th MailMuttLine mapping runs `:MailMutt` on the current line in normal -mode. A binding example might be: -> - :nmap ml MailMuttLine -< - *MailMuttBuffer* -The MailMuttBuffer mapping runs `:MailMutt` on the whole buffer in -normal mode. A binding example might be: -> - :nmap mb MailMuttBuffer -< - *MailMuttSelected* -The MailMuttSelected mapping runs `:MailMutt` on the selected lines in -visual or selection mode. A binding example might be: -> - :vmap ms MailMuttSelected -< -AUTHOR *mail_mutt-author* - -Written and maintained by Tom Ryder . - -LICENSE *mail_mutt-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *mail_mutt-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/mail_mutt.vim b/vim/plugin/mail_mutt.vim deleted file mode 100644 index 63cae2f6..00000000 --- a/vim/plugin/mail_mutt.vim +++ /dev/null @@ -1,56 +0,0 @@ -" -" mail_mutt.vim: Start a mutt(1) message with the lines in the given range, -" defaulting to the entire buffer. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_mail_mutt') || &compatible - finish -endif -if !has('user_commands') - finish -endif -let g:loaded_mail_mutt = 1 - -" Declare function -function! s:MailMutt(start, end) - - " Check we'll have mutt(1) to execute - if !executable('mutt') - echoerr 'mutt not found in $PATH' - finish - endif - - " Create a temporary file - let l:tf = tempname() - - " Write the contents of the buffer to it - let l:range = a:start . ',' . a:end - let l:command = 'write ' . fnameescape(l:tf) - execute l:range . l:command - - " Run mutt(1) with that file as its input - execute '!mutt -i ' . shellescape(l:tf) - -endfunction - -" Create a command to wrap around that function -command -nargs=0 -range=% - \ MailMutt - \ call MailMutt(, ) - -" Mapping to mail current line in normal mode -nnoremap - \ MailMuttLine - \ :.MailMutt - -" Mapping to mail whole buffer in normal mode -nnoremap - \ MailMuttBuffer - \ :%MailMutt - -" Mapping to mail selected lines in visual/select mode -vnoremap - \ MailMuttSelected - \ :MailMutt -- cgit v1.2.3 From c68fcb332238ae6cb78a7bb01fc9f6eb413f2bc1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 13:56:43 +1200 Subject: Spin off strip_trailing_whitespace Vim plugin --- .gitmodules | 3 ++ Makefile | 9 +--- vim/bundle/strip_trailing_whitespace | 1 + vim/doc/strip_trailing_whitespace.txt | 46 -------------------- vim/plugin/strip_trailing_whitespace.vim | 75 -------------------------------- 5 files changed, 5 insertions(+), 129 deletions(-) create mode 160000 vim/bundle/strip_trailing_whitespace delete mode 100644 vim/doc/strip_trailing_whitespace.txt delete mode 100644 vim/plugin/strip_trailing_whitespace.vim diff --git a/.gitmodules b/.gitmodules index c57005ed..5c6c56d7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,6 +11,9 @@ [submodule "vim/bundle/mail_mutt"] path = vim/bundle/mail_mutt url = https://sanctum.geek.nz/code/vim-mail-mutt.git +[submodule "vim/bundle/strip_trailing_whitespace"] + path = vim/bundle/strip_trailing_whitespace + url = https://sanctum.geek.nz/code/vim-strip-trailing-whitespace.git [submodule "vim/bundle/toggle_option_flags"] path = vim/bundle/toggle_option_flags url = https://sanctum.geek.nz/code/vim-toggle-option-flags.git diff --git a/Makefile b/Makefile index ff8b493c..5e006452 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,6 @@ dist-vim-plugin-auto-undodir \ dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ - dist-vim-plugin-strip-trailing-whitespace .SUFFIXES: .SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh @@ -665,8 +664,7 @@ dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-swapdir \ dist-vim-plugin-auto-undodir \ dist-vim-plugin-big-file-options \ - dist-vim-plugin-command-typos \ - dist-vim-plugin-strip-trailing-whitespace + dist-vim-plugin-command-typos dist-vim-plugin-auto-backupdir: \ vim/plugin/auto_backupdir.vim \ @@ -693,8 +691,3 @@ dist-vim-plugin-command-typos: \ vim/doc/command_typos.txt \ VERSION sh dist/vim-plugin.sh command_typos -dist-vim-plugin-strip-trailing-whitespace: \ - vim/plugin/strip_trailing_whitespace.vim \ - vim/doc/strip_trailing_whitespace.txt \ - VERSION - sh dist/vim-plugin.sh strip_trailing_whitespace diff --git a/vim/bundle/strip_trailing_whitespace b/vim/bundle/strip_trailing_whitespace new file mode 160000 index 00000000..d64a7405 --- /dev/null +++ b/vim/bundle/strip_trailing_whitespace @@ -0,0 +1 @@ +Subproject commit d64a7405e3bbfcb10cef99eb2795130504bce3ae diff --git a/vim/doc/strip_trailing_whitespace.txt b/vim/doc/strip_trailing_whitespace.txt deleted file mode 100644 index 2b220231..00000000 --- a/vim/doc/strip_trailing_whitespace.txt +++ /dev/null @@ -1,46 +0,0 @@ -*strip_trailing_whitespace.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *strip_trailing_whitespace* - -This plugin provides a mapping target and an optional custom command with the -author's approach to stripping trailing whitespace from an entire buffer, -including removing empty or whitespace-only lines at the end of the buffer, -without making command noise and without moving the cursor from its current -position. - -REQUIREMENTS *strip_trailing_whitespace-requirements* - -This plugin is only available if 'compatible' is not set. - -COMMANDS *strip_trailing_whitespace-commands* - - *:StripTrailingWhitespace* -The plugin provides a single `:StripTrailingWhitespace` command if Vim has the -|+user_commands| feature, but this is not required. It operates on the entire -buffer, and accepts neither a range nor arguments. - -MAPPINGS *strip_trailing_whitespace-mappings* - - *StripTrailingWhitespace* -The single mapping target provided is |StripTrailingWhitespace|, -mappable in any mode. There is no default key mapping to the target; you -should define this yourself in your |vimrc|. For example: -> - :nmap x StripTrailingWhitespace> -< -AUTHOR *strip_trailing_whitespace-author* - -Written and maintained by Tom Ryder . - -LICENSE *strip_trailing_whitespace-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *strip_trailing_whitespace-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/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim deleted file mode 100644 index 1b6d2f38..00000000 --- a/vim/plugin/strip_trailing_whitespace.vim +++ /dev/null @@ -1,75 +0,0 @@ -" -" strip_trailing_whitespace.vim: User-defined key mapping and optional command -" to strip trailing whitespace in the whole document. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_strip_trailing_whitespace') || &compatible - finish -endif -let g:loaded_strip_trailing_whitespace = 1 - -" Define function for stripping whitespace -function! s:StripTrailingWhitespace() - - " Iterating line number - let l:li = 1 - - " Line number of last line that had non-whitespace characters on it - let l:lw = 0 - - " Line number of the file's last line - let l:ll = line('$') - - " Iterate over the lines - while l:li <= l:ll - - " Get the line text - let l:line = getline(l:li) - - " Replace the line with a subsitution of its text stripping extraneous - " whitespace - call setline(l:li, substitute(l:line, '\m\C\s\+$', '', 'g')) - - " If this line has any non-whitespace characters on it, update l:lw with - " its index - if l:line =~# '\m\S' - let l:lw = l:li - endif - - " Increment the line counter for the next iteration - let l:li = l:li + 1 - - endwhile - - " If the last non-whitespace line was before the last line proper, we can - " delete all lines after it - if l:lw < l:ll - - " Get the current line and column so we can return to it - " (Yes I know about winsaveview() and winrestview(); I want this to work - " even on very old versions of Vim if possible) - let l:lc = line('.') - let l:cc = col('.') - - " Delete the lines, which will move the cursor - silent execute l:lw + 1 . ',$ delete' - - " Return the cursor to the saved position - call cursor(l:lc, l:cc) - endif - -endfunction - -" Create mapping proxy to the function just defined -noremap - \ StripTrailingWhitespace - \ :call StripTrailingWhitespace() - -" Define a user command too, if we can -if has('user_commands') - command -nargs=0 - \ StripTrailingWhiteSpace - \ call StripTrailingWhitespace() -endif -- cgit v1.2.3 From 8982add573a3a4e1a0d8a10b1cc1807d9cf5a3fa Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 14:07:23 +1200 Subject: Update Vim plugins --- vim/bundle/juvenile | 2 +- vim/bundle/sahara | 2 +- vim/bundle/surround | 2 +- vim/bundle/unimpaired | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vim/bundle/juvenile b/vim/bundle/juvenile index bf574171..bf56b156 160000 --- a/vim/bundle/juvenile +++ b/vim/bundle/juvenile @@ -1 +1 @@ -Subproject commit bf57417175c40c060fde63f020559f3483c3c9ea +Subproject commit bf56b15638d60102fbb1a6931a0da44ebd533940 diff --git a/vim/bundle/sahara b/vim/bundle/sahara index 4f85b7c8..162e27ee 160000 --- a/vim/bundle/sahara +++ b/vim/bundle/sahara @@ -1 +1 @@ -Subproject commit 4f85b7c8fe1953479a2253cadd1ab82017a4d7ec +Subproject commit 162e27eeb0e30345ec62862a38f08b1c9352a049 diff --git a/vim/bundle/surround b/vim/bundle/surround index e49d6c24..643a4245 160000 --- a/vim/bundle/surround +++ b/vim/bundle/surround @@ -1 +1 @@ -Subproject commit e49d6c2459e0f5569ff2d533b4df995dd7f98313 +Subproject commit 643a42454bc8c2b2735de14f309523ce733a5358 diff --git a/vim/bundle/unimpaired b/vim/bundle/unimpaired index 86823a13..fe7d2241 160000 --- a/vim/bundle/unimpaired +++ b/vim/bundle/unimpaired @@ -1 +1 @@ -Subproject commit 86823a13a7b6dd70afd2316a3cf469192de79635 +Subproject commit fe7d2241df475de631b8891fdccd20bf9a7574de -- cgit v1.2.3 From 307a7ee2f97f472e5ee11e020b753b4290fe5b1b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 17:51:04 +1200 Subject: Spin off big_file_options Vim plugin --- .gitmodules | 3 ++ Makefile | 7 ----- vim/bundle/big_file_options | 1 + vim/doc/big_file_options.txt | 28 ----------------- vim/plugin/big_file_options.vim | 66 ----------------------------------------- 5 files changed, 4 insertions(+), 101 deletions(-) create mode 160000 vim/bundle/big_file_options delete mode 100644 vim/doc/big_file_options.txt delete mode 100644 vim/plugin/big_file_options.vim diff --git a/.gitmodules b/.gitmodules index 5c6c56d7..8bbe37e5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,7 @@ # My Vim plugins +[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/copy_linebreak"] path = vim/bundle/copy_linebreak url = https://sanctum.geek.nz/code/vim-copy-linebreak.git diff --git a/Makefile b/Makefile index 5e006452..cfa4e86b 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,6 @@ dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-swapdir \ dist-vim-plugin-auto-undodir \ - dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos \ .SUFFIXES: @@ -663,7 +662,6 @@ lint-xinit: check-xinit dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-swapdir \ dist-vim-plugin-auto-undodir \ - dist-vim-plugin-big-file-options \ dist-vim-plugin-command-typos dist-vim-plugin-auto-backupdir: \ @@ -681,11 +679,6 @@ dist-vim-plugin-auto-undodir: \ vim/doc/auto_undodir.txt \ VERSION sh dist/vim-plugin.sh auto_undodir -dist-vim-plugin-big-file-options: \ - vim/plugin/big_file_options.vim \ - vim/doc/big_file_options.txt \ - VERSION - sh dist/vim-plugin.sh big_file_options dist-vim-plugin-command-typos: \ vim/plugin/command_typos.vim \ vim/doc/command_typos.txt \ diff --git a/vim/bundle/big_file_options b/vim/bundle/big_file_options new file mode 160000 index 00000000..e70de132 --- /dev/null +++ b/vim/bundle/big_file_options @@ -0,0 +1 @@ +Subproject commit e70de13287c7a7a0a408075b7954e9d14ed606bf diff --git a/vim/doc/big_file_options.txt b/vim/doc/big_file_options.txt deleted file mode 100644 index cab0664e..00000000 --- a/vim/doc/big_file_options.txt +++ /dev/null @@ -1,28 +0,0 @@ -*big_file_options.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *big_file_options* - -This plugin adds an |autocmd| hook to check the file size of an incoming -buffer, and if it's over a certain threshold, disables certain options in order -to make the file a bit easier to edit. - -REQUIREMENTS *big_file_options-requirements* - -This plugin is only available if 'compatible' is not set. - -AUTHOR *big_file_options-author* - -Written and maintained by Tom Ryder . - -LICENSE *big_file_options-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *big_file_options-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/big_file_options.vim b/vim/plugin/big_file_options.vim deleted file mode 100644 index f7fa0281..00000000 --- a/vim/plugin/big_file_options.vim +++ /dev/null @@ -1,66 +0,0 @@ -" -" big_file_options.vim: When opening a large file, take some measures to keep -" things loading quickly. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_big_file_options') || &compatible - finish -endif -if !has('autocmd') - finish -endif -let g:loaded_big_file_options = 1 - -" Default threshold is 10 MiB -if !exists('g:big_file_size') - let g:big_file_size = 10 * 1024 * 1024 -endif - -" Default to leaving syntax highlighting off -if !exists('g:big_file_syntax') - let g:big_file_syntax = 0 -endif - -" Cut 'synmaxcol' down to this or smaller for big files -if !exists('g:big_file_synmaxcol') - let g:big_file_synmaxcol = 256 -endif - -" Declare function for turning off slow options -function! s:BigFileOptions() - - " Don't do anything if the buffer size is under the threshold - if line2byte(line('$') + 1) <= g:big_file_size - return - endif - - " Turn off backups, swap files, and undo files - setlocal nobackup - setlocal nowritebackup - setlocal noswapfile - if has('persistent_undo') - setlocal noundofile - endif - - " Limit the number of columns of syntax highlighting - if exists('+synmaxcol') - \ && &synmaxcol > g:big_file_synmaxcol - execute 'setlocal synmaxcol=' . g:big_file_synmaxcol - endif - - " Disable syntax highlighting if configured to do so - if !g:big_file_syntax - setlocal syntax=OFF - endif - -endfunction - -" Define autocmd for calling to check filesize -augroup big_file_options_bufreadpost - autocmd! - autocmd BufReadPost - \ * - \ call s:BigFileOptions() -augroup end -- cgit v1.2.3 From 1672dd8d4d41cfce4b2beb70685399a23eaa0956 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 18:09:33 +1200 Subject: Spin off command_typos Vim plugin Renamed as uncap_ex.vim. --- .gitmodules | 3 +++ Makefile | 11 ++--------- vim/bundle/uncap_ex | 1 + vim/doc/command_typos.txt | 28 --------------------------- vim/plugin/command_typos.vim | 45 -------------------------------------------- 5 files changed, 6 insertions(+), 82 deletions(-) create mode 160000 vim/bundle/uncap_ex delete mode 100644 vim/doc/command_typos.txt delete mode 100644 vim/plugin/command_typos.vim diff --git a/.gitmodules b/.gitmodules index 8bbe37e5..e5d27293 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,6 +20,9 @@ [submodule "vim/bundle/toggle_option_flags"] path = vim/bundle/toggle_option_flags url = https://sanctum.geek.nz/code/vim-toggle-option-flags.git +[submodule "vim/bundle/uncap_ex"] + path = vim/bundle/uncap_ex + url = https://sanctum.geek.nz/code/vim-uncap-ex.git # My Vim colorschemes [submodule "vim/bundle/juvenile"] diff --git a/Makefile b/Makefile index cfa4e86b..810da7a7 100644 --- a/Makefile +++ b/Makefile @@ -77,8 +77,7 @@ dist-vim-plugin \ dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-swapdir \ - dist-vim-plugin-auto-undodir \ - dist-vim-plugin-command-typos \ + dist-vim-plugin-auto-undodir .SUFFIXES: .SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh @@ -661,8 +660,7 @@ lint-xinit: check-xinit dist-vim-plugin: dist-vim-plugin-auto-backupdir \ dist-vim-plugin-auto-swapdir \ - dist-vim-plugin-auto-undodir \ - dist-vim-plugin-command-typos + dist-vim-plugin-auto-undodir dist-vim-plugin-auto-backupdir: \ vim/plugin/auto_backupdir.vim \ @@ -679,8 +677,3 @@ dist-vim-plugin-auto-undodir: \ vim/doc/auto_undodir.txt \ VERSION sh dist/vim-plugin.sh auto_undodir -dist-vim-plugin-command-typos: \ - vim/plugin/command_typos.vim \ - vim/doc/command_typos.txt \ - VERSION - sh dist/vim-plugin.sh command_typos diff --git a/vim/bundle/uncap_ex b/vim/bundle/uncap_ex new file mode 160000 index 00000000..2fceff8f --- /dev/null +++ b/vim/bundle/uncap_ex @@ -0,0 +1 @@ +Subproject commit 2fceff8fe5ff7cd0d2282c5f46b448443438e666 diff --git a/vim/doc/command_typos.txt b/vim/doc/command_typos.txt deleted file mode 100644 index 938fef27..00000000 --- a/vim/doc/command_typos.txt +++ /dev/null @@ -1,28 +0,0 @@ -*command_typos.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *command_typos* - -This plugin defines custom commands like :W, :Qa, and :Wq to match their -lowercase analogues, to forgive me when my pinky finger doesn't roll off the -Shift key quite soon enough after pressing the colon key. - -REQUIREMENTS *command_typos-requirements* - -This plugin is only available if 'compatible' is not set. - -AUTHOR *command_typos-author* - -Written and maintained by Tom Ryder . - -LICENSE *command_typos-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *command_typos-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/command_typos.vim b/vim/plugin/command_typos.vim deleted file mode 100644 index 6f34c680..00000000 --- a/vim/plugin/command_typos.vim +++ /dev/null @@ -1,45 +0,0 @@ -" -" command_typos.vim: Tolerate typos like :Wq, :Q, or :Qa and do what I mean, -" including any arguments or modifiers; I fat-finger these commands a lot -" because I type them so rapidly, and they don't correspond to any other -" commands I use -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_command_typos') || &compatible - finish -endif -if !has('user_commands') - finish -endif -let g:loaded_command_typos = 1 - -" Define commands -command -bang -complete=file -nargs=? - \ E - \ edit -command -bang -complete=file -nargs=? - \ W - \ write -command -bang -complete=file -nargs=? - \ WQ - \ wq -command -bang -complete=file -nargs=? - \ Wq - \ wq -command -bang - \ Q - \ quit -command -bang - \ Qa - \ qall -command -bang - \ QA - \ qall -command -bang - \ Wa - \ wall -command -bang - \ WA - \ wa -- cgit v1.2.3 From 06c48b4ff414cf779d12d82529bc1f5d724f773d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 18:15:25 +1200 Subject: Update README.md to reflect Vim plugin state --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index abf6f6de..e470b17a 100644 --- a/README.md +++ b/README.md @@ -351,10 +351,15 @@ structures like functions, I like to implement it as a plugin in `~/.vim/plugin` and/or `~/.vim/autoload`. There's documentation for each of those in `~/.vim/doc`. -Any/all of those plugins may eventually be spun off into their own repositories -in the future, but for the moment they live here. You can create distribution -packages for them with `make dist-vim-plugin`; they will be created in -`vim/dist`. +They eventually get either discarded or spun off into their own repositories, +added to this repository as submodules intead, and uploaded to +[vim.org](https://www.vim.org/account/profile.php?user_id=73687). + +You can create distribution packages for whatever's still in here with `make +dist-vim-plugin`; they will be created in `vim/dist`. + +All plugins and colorschemes with their own repositories are installed as +submodules in `~/.vim/bundle`. They are installed into `~/.vim` as normal. I also define a few rules specific to file types I often edit in `~/.vim/after/ftplugin`, including some local mappings for checking, linting, @@ -362,9 +367,6 @@ 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`). -Third-party plugins are in submodules in `~/.vim/bundle`. They are installed -into `~/.vim` as normal. - #### Neovim I test my configuration every now and then with the [Neovim -- cgit v1.2.3 From b853fbd6cc65744307bcfb73541c252ad7025870 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 18:16:05 +1200 Subject: Rebuild dotfiles(7) manual from source --- man/man7/dotfiles.7df | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index 046e35db..a30d0028 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -490,12 +490,19 @@ structures like functions, I like to implement it as a plugin in \f[C]~/.vim/plugin\f[] and/or \f[C]~/.vim/autoload\f[]. There's documentation for each of those in \f[C]~/.vim/doc\f[]. .PP -Any/all of those plugins may eventually be spun off into their own -repositories in the future, but for the moment they live here. -You can create distribution packages for them with +They eventually get either discarded or spun off into their own +repositories, added to this repository as submodules intead, and +uploaded to +vim.org (https://www.vim.org/account/profile.php?user_id=73687). +.PP +You can create distribution packages for whatever's still in here with \f[C]make\ dist\-vim\-plugin\f[]; they will be created in \f[C]vim/dist\f[]. .PP +All plugins and colorschemes with their own repositories are installed +as submodules in \f[C]~/.vim/bundle\f[]. +They are installed into \f[C]~/.vim\f[] as normal. +.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 @@ -503,9 +510,6 @@ checking, linting, and tidying, and a few more in There are also a few tweaks to core syntax files in \f[C]~/.vim/after/syntax\f[], especially for shell script (\f[C]sh.vim\f[]). -.PP -Third\-party plugins are in submodules in \f[C]~/.vim/bundle\f[]. -They are installed into \f[C]~/.vim\f[] as normal. .SS Neovim .PP I test my configuration every now and then with the Neovim -- cgit v1.2.3 From f528dc2e02de11d241936c2c2de30c4d65f0ee10 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 18:17:13 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 09daa252..8f737ff2 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v0.36.0 -Wed May 30 11:55:57 UTC 2018 +tejr dotfiles v0.37.0 +Thu May 31 06:17:09 UTC 2018 -- cgit v1.2.3