diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-05-31 18:17:25 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-05-31 18:17:25 +1200 |
commit | 98b681e69e17a8011c1bfbef2ba74315e9c1174e (patch) | |
tree | 934685d88af8a47075e81925ee98456e61dcafae | |
parent | Merge branch 'release/v0.36.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-98b681e69e17a8011c1bfbef2ba74315e9c1174e.tar.gz dotfiles-98b681e69e17a8011c1bfbef2ba74315e9c1174e.zip |
Merge branch 'release/v0.37.0'v0.37.0
* release/v0.37.0:
Bump VERSION
Rebuild dotfiles(7) manual from source
Update README.md to reflect Vim plugin state
Spin off command_typos Vim plugin
Spin off big_file_options Vim plugin
Update Vim plugins
Spin off strip_trailing_whitespace Vim plugin
Spin off mail_mutt Vim plugin
Spin off copy_linebreak Vim plugin
Junk detect_background.vim and thereby autoload
-rw-r--r-- | .gitmodules | 15 | ||||
-rw-r--r-- | Makefile | 51 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | lint/vim.sh | 1 | ||||
-rw-r--r-- | man/man7/dotfiles.7df | 16 | ||||
-rw-r--r-- | vim/autoload/detect_background.vim | 37 | ||||
m--------- | vim/bundle/big_file_options | 0 | ||||
m--------- | vim/bundle/copy_linebreak | 0 | ||||
m--------- | vim/bundle/juvenile | 0 | ||||
m--------- | vim/bundle/mail_mutt | 0 | ||||
m--------- | vim/bundle/sahara | 0 | ||||
m--------- | vim/bundle/strip_trailing_whitespace | 0 | ||||
m--------- | vim/bundle/surround | 0 | ||||
m--------- | vim/bundle/uncap_ex | 0 | ||||
m--------- | vim/bundle/unimpaired | 0 | ||||
-rw-r--r-- | vim/config/syntax.vim | 15 | ||||
-rw-r--r-- | vim/doc/big_file_options.txt | 28 | ||||
-rw-r--r-- | vim/doc/command_typos.txt | 28 | ||||
-rw-r--r-- | vim/doc/copy_linebreak.txt | 56 | ||||
-rw-r--r-- | vim/doc/detect_background.txt | 37 | ||||
-rw-r--r-- | vim/doc/mail_mutt.txt | 66 | ||||
-rw-r--r-- | vim/doc/strip_trailing_whitespace.txt | 46 | ||||
-rw-r--r-- | vim/plugin/big_file_options.vim | 66 | ||||
-rw-r--r-- | vim/plugin/command_typos.vim | 45 | ||||
-rw-r--r-- | vim/plugin/copy_linebreak.vim | 68 | ||||
-rw-r--r-- | vim/plugin/mail_mutt.vim | 56 | ||||
-rw-r--r-- | vim/plugin/strip_trailing_whitespace.vim | 75 |
28 files changed, 43 insertions, 683 deletions
diff --git a/.gitmodules b/.gitmodules index 49355178..e5d27293 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,13 +1,28 @@ # 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 [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 +[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 +[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"] @@ -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 \ @@ -78,12 +77,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-copy-linebreak \ - dist-vim-plugin-mail-mutt \ - dist-vim-plugin-strip-trailing-whitespace + dist-vim-plugin-auto-undodir .SUFFIXES: .SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh @@ -499,7 +493,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 +521,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 \ @@ -671,13 +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-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 + dist-vim-plugin-auto-undodir dist-vim-plugin-auto-backupdir: \ vim/plugin/auto_backupdir.vim \ @@ -694,33 +677,3 @@ 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 \ - 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-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 \ - 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 \ - VERSION - sh dist/vim-plugin.sh strip_trailing_whitespace @@ -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 @@ -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 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/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 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 <tom@sanctum.geek.nz> -" 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/bundle/big_file_options b/vim/bundle/big_file_options new file mode 160000 +Subproject e70de13287c7a7a0a408075b7954e9d14ed606b diff --git a/vim/bundle/copy_linebreak b/vim/bundle/copy_linebreak new file mode 160000 +Subproject 3448f6ae2bc974af48fb16aaabff85fe1bc250e diff --git a/vim/bundle/juvenile b/vim/bundle/juvenile -Subproject bf57417175c40c060fde63f020559f3483c3c9e +Subproject bf56b15638d60102fbb1a6931a0da44ebd53394 diff --git a/vim/bundle/mail_mutt b/vim/bundle/mail_mutt new file mode 160000 +Subproject 8f417d2ac92b1247b24103963e64bf63d627de3 diff --git a/vim/bundle/sahara b/vim/bundle/sahara -Subproject 4f85b7c8fe1953479a2253cadd1ab82017a4d7e +Subproject 162e27eeb0e30345ec62862a38f08b1c9352a04 diff --git a/vim/bundle/strip_trailing_whitespace b/vim/bundle/strip_trailing_whitespace new file mode 160000 +Subproject d64a7405e3bbfcb10cef99eb2795130504bce3a diff --git a/vim/bundle/surround b/vim/bundle/surround -Subproject e49d6c2459e0f5569ff2d533b4df995dd7f9831 +Subproject 643a42454bc8c2b2735de14f309523ce733a535 diff --git a/vim/bundle/uncap_ex b/vim/bundle/uncap_ex new file mode 160000 +Subproject 2fceff8fe5ff7cd0d2282c5f46b448443438e66 diff --git a/vim/bundle/unimpaired b/vim/bundle/unimpaired -Subproject 86823a13a7b6dd70afd2316a3cf469192de7963 +Subproject fe7d2241df475de631b8891fdccd20bf9a7574d 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/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 <tom@sanctum.geek.nz>. - -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 <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more -information. - - vim:tw=78:ts=8:ft=help:norl: 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 <tom@sanctum.geek.nz>. - -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 <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more -information. - - vim:tw=78:ts=8:ft=help:norl: 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: - -|<Plug>CopyLinebreakEnable|: *<Plug>CopyLinebreakEnable* - Enable copy-paste friendly line break options. -|<Plug>CopyLinebreakDisable|: *<Plug>CopyLinebreakDisable* - Revert to human-readable line break options. -|<Plug>CopyLinebreakToggle|: *<Plug>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 <Leader>b <Plug>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 <tom@sanctum.geek.nz>. - -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 <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more -information. - - vim:tw=78:ts=8:ft=help:norl: 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 <tom@sanctum.geek.nz>. - -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 <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more -information. - - vim:tw=78:ts=8:ft=help:norl: 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 <http://www.mutt.org/>. - -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 <Plug> 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|. - - *<Plug>MailMuttLine* -Th <Plug>MailMuttLine mapping runs `:MailMutt` on the current line in normal -mode. A binding example might be: -> - :nmap <Leader>ml <Plug>MailMuttLine -< - *<Plug>MailMuttBuffer* -The <Plug>MailMuttBuffer mapping runs `:MailMutt` on the whole buffer in -normal mode. A binding example might be: -> - :nmap <Leader>mb <Plug>MailMuttBuffer -< - *<Plug>MailMuttSelected* -The <Plug>MailMuttSelected mapping runs `:MailMutt` on the selected lines in -visual or selection mode. A binding example might be: -> - :vmap <Leader>ms <Plug>MailMuttSelected -< -AUTHOR *mail_mutt-author* - -Written and maintained by Tom Ryder <tom@sanctum.geek.nz>. - -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 <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more -information. - - vim:tw=78:ts=8:ft=help:norl: 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* - - *<Plug>StripTrailingWhitespace* -The single mapping target provided is |<Plug>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 <Leader>x <Plug>StripTrailingWhitespace> -< -AUTHOR *strip_trailing_whitespace-author* - -Written and maintained by Tom Ryder <tom@sanctum.geek.nz>. - -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 <https://sanctum.geek.nz/cgit/dotfiles.git/about/> 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 <tom@sanctum.geek.nz> -" 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 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 <tom@sanctum.geek.nz> -" 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<bang> <args> -command -bang -complete=file -nargs=? - \ W - \ write<bang> <args> -command -bang -complete=file -nargs=? - \ WQ - \ wq<bang> <args> -command -bang -complete=file -nargs=? - \ Wq - \ wq<bang> <args> -command -bang - \ Q - \ quit<bang> -command -bang - \ Qa - \ qall<bang> -command -bang - \ QA - \ qall<bang> -command -bang - \ Wa - \ wall<bang> -command -bang - \ WA - \ wa<bang> 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 <tom@sanctum.geek.nz> -" 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 <SID>CopyLinebreakEnable() - else - call <SID>CopyLinebreakDisable() - endif -endfunction - -" Provide mappings to the function just defined -noremap <silent> <unique> - \ <Plug>CopyLinebreakEnable - \ :<C-U>call <SID>CopyLinebreakEnable()<CR> -noremap <silent> <unique> - \ <Plug>CopyLinebreakDisable - \ :<C-U>call <SID>CopyLinebreakDisable()<CR> -noremap <silent> <unique> - \ <Plug>CopyLinebreakToggle - \ :<C-U>call <SID>CopyLinebreakToggle()<CR> - -" Provide user commands if we can -if has('user_commands') - command -nargs=0 - \ CopyLinebreakEnable - \ call <SID>CopyLinebreakEnable - command -nargs=0 - \ CopyLinebreakDisable - \ call <SID>CopyLinebreakDisable - command -nargs=0 - \ CopyLinebreakToggle - \ call <SID>CopyLinebreakToggle -endif 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 <tom@sanctum.geek.nz> -" 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 <SID>MailMutt(<line1>, <line2>) - -" Mapping to mail current line in normal mode -nnoremap <silent> <unique> - \ <Plug>MailMuttLine - \ :<C-U>.MailMutt<CR> - -" Mapping to mail whole buffer in normal mode -nnoremap <silent> <unique> - \ <Plug>MailMuttBuffer - \ :<C-U>%MailMutt<CR> - -" Mapping to mail selected lines in visual/select mode -vnoremap <silent> <unique> - \ <Plug>MailMuttSelected - \ :MailMutt<CR> 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 <tom@sanctum.geek.nz> -" 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 <silent> <unique> - \ <Plug>StripTrailingWhitespace - \ :<C-U>call <SID>StripTrailingWhitespace()<CR> - -" Define a user command too, if we can -if has('user_commands') - command -nargs=0 - \ StripTrailingWhiteSpace - \ call <SID>StripTrailingWhitespace() -endif |