From 937458202c8311ecbed7a51a4cec1d1941a6bfd0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 20:57:13 +1300 Subject: Bind norm J on fixed_join.vim load if appropriate If there are no mappings to the FixedJoin target that the fixed_join.vim plugin provides at the time it is loaded, and the line-joining function of normal-mode J is not already mapped, the plugin will try to map it itself, for a more plug-and-play. --- vim/config/whitespace.vim | 7 ------- vim/doc/fixed_join.txt | 9 ++++++--- vim/plugin/fixed_join.vim | 6 ++++++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim index 12d41a4e..981def81 100644 --- a/vim/config/whitespace.vim +++ b/vim/config/whitespace.vim @@ -24,12 +24,5 @@ set shiftround " despite the noble Steve Losh's exhortations set nojoinspaces -" Rebind normal J to run plugin-defined join that doesn't jump around, but -" only if we have the eval feature, because otherwise this mapping won't exist -" and we should keep the default behaviour -if has('eval') - nmap J FixedJoin -endif - " \x strips trailing whitespace via a custom plugin nmap x StripTrailingWhitespace diff --git a/vim/doc/fixed_join.txt b/vim/doc/fixed_join.txt index df0df251..834a3569 100644 --- a/vim/doc/fixed_join.txt +++ b/vim/doc/fixed_join.txt @@ -4,10 +4,13 @@ Author: Tom Ryder License: Same terms as Vim itself (see |license|) 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. +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. -If also provides a :FixedJoin command if you have +user_commands, but this is -not required. +The plugin also provides a :FixedJoin command if you have +user_commands, but +this is not required. This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun off into a separate distribution as it solidifies and this documentation diff --git a/vim/plugin/fixed_join.vim b/vim/plugin/fixed_join.vim index 83977c2f..2e7f2abd 100644 --- a/vim/plugin/fixed_join.vim +++ b/vim/plugin/fixed_join.vim @@ -31,6 +31,12 @@ 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 -- cgit v1.2.3 From 341c4a40cfd7e9902359e30baf3911cf57510984 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 21:27:25 +1300 Subject: Remove stray blank line from mail_mutt.vim --- vim/plugin/mail_mutt.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/vim/plugin/mail_mutt.vim b/vim/plugin/mail_mutt.vim index 24ce01dd..13389309 100644 --- a/vim/plugin/mail_mutt.vim +++ b/vim/plugin/mail_mutt.vim @@ -27,7 +27,6 @@ function! s:MailMutt(start, 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) -- cgit v1.2.3 From 20f65a0c35c641bdbaf93a92d499f01874211feb Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 21:35:18 +1300 Subject: Complete mail_mutt.vim documentation --- vim/doc/mail_mutt.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/vim/doc/mail_mutt.txt b/vim/doc/mail_mutt.txt index dbaf72ac..bf86a57f 100644 --- a/vim/doc/mail_mutt.txt +++ b/vim/doc/mail_mutt.txt @@ -1,13 +1,69 @@ -*mail_mutt.txt* Start a mutt(1) email message with a range of lines +*mail_mutt.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *mail_mutt* -This plugin provides a :MailMutt command which accepts a range of lines -defaulting to the entire buffer, writing these lines to a temporary file that -is then provided to the -i option of the mutt(1) MUA as the initial content of -a new message. +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. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +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|. + +CURRENT LINE *MailMuttLine* + +Th MailMuttLine mapping runs `:MailMutt` on the current line in normal +mode. For example: +> + :nmap ml MailMuttLine +< +WHOLE BUFFER *MailMuttBuffer* + +The MailMuttBuffer mapping runs `:MailMutt` on the whole buffer in +normal mode. For example: +> + :nmap mb MailMuttBuffer +< +SELECTED LINES *MailMuttSelected* + +The MailMuttSelected mapping runs `:MailMutt` on the selected lines in +visual or selection mode. For example: +> + :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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: -- cgit v1.2.3 From 7485a9129c4dae9c6dbe54dd2f78443ccc654f55 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 22:14:43 +1300 Subject: Add path rules for detecting Vim help files This matches .txt files in any 'doc' directory with 'vim' or '.vim' in its ancestry. --- vim/ftdetect/help.vim | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 vim/ftdetect/help.vim diff --git a/vim/ftdetect/help.vim b/vim/ftdetect/help.vim new file mode 100644 index 00000000..b516ed7e --- /dev/null +++ b/vim/ftdetect/help.vim @@ -0,0 +1,4 @@ +" Custom Vim help documentation filetype detection +autocmd BufNewFile,BufRead + \ **/vim/**/doc/*.txt,**/.vim/**/doc/*.txt + \ setlocal filetype=help -- cgit v1.2.3 From d82c507a79c6dd1aeb9dfaaab261846a6e8dabb1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 22:19:25 +1300 Subject: Update and correct detect_background.vim help --- vim/doc/detect_background.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vim/doc/detect_background.txt b/vim/doc/detect_background.txt index ad42221c..ed122aee 100644 --- a/vim/doc/detect_background.txt +++ b/vim/doc/detect_background.txt @@ -3,11 +3,17 @@ Author: Tom Ryder License: Same terms as Vim itself (see |license|) -This plugin inspects the $COLORFGBG environment variable to determine whether -the user is using a terminal with a light background. It reverses Vim's -built-in attempts to do this, which have the opposite default. +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'. -It does not inspect the value of the $TERM variable or |'term'| at all. +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. This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun off into a separate distribution as it solidifies and this documentation -- cgit v1.2.3 From 9e31143b66cc44a93f3e369b671ace64e38bb8a5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 22:41:23 +1300 Subject: Apply boilerplate to Vim plugin docs The DESCRIPTION heading for each of these is filled out now, but some of them probably need a bit more explanation. The mail_mutt.txt plugin is good, though. --- vim/doc/auto_backupdir.txt | 26 ++++++++++++++++++----- vim/doc/auto_swapdir.txt | 30 ++++++++++++++++++++------ vim/doc/auto_undodir.txt | 32 +++++++++++++++++++++------- vim/doc/big_file_options.txt | 26 ++++++++++++++++++----- vim/doc/command_typos.txt | 28 ++++++++++++++++++------ vim/doc/copy_linebreak.txt | 32 +++++++++++++++++++++------- vim/doc/detect_background.txt | 28 ++++++++++++++++++------ vim/doc/fixed_join.txt | 30 ++++++++++++++++++++------ vim/doc/strip_trailing_whitespace.txt | 26 ++++++++++++++++++----- vim/doc/toggle_option_flag.txt | 40 +++++++++++++++++++++++++---------- 10 files changed, 230 insertions(+), 68 deletions(-) diff --git a/vim/doc/auto_backupdir.txt b/vim/doc/auto_backupdir.txt index c5b6ebad..2990332e 100644 --- a/vim/doc/auto_backupdir.txt +++ b/vim/doc/auto_backupdir.txt @@ -1,12 +1,28 @@ -*auto_backupdir.txt* Automatically create 'backupdir' in 'realtimepath' +*auto_backupdir.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *auto_backupdir* This plugin attempts to create a directory "backup" in the directory named by the first element of 'realtimepath', and enables 'backup' with that as the 'backupdir' if it succeeds or if the directory already exists. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +REQUIREMENTS *auto_backupdir-requirements* + +This plugin is only available if 'compatible' is not set. + +AUTHOR *auto_backupdir-author* + +Written and maintained by Tom Ryder . + +LICENSE *auto_backupdir-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + +DISTRIBUTION *auto_backupdir-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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/auto_swapdir.txt b/vim/doc/auto_swapdir.txt index f88cfcf3..a5b8f274 100644 --- a/vim/doc/auto_swapdir.txt +++ b/vim/doc/auto_swapdir.txt @@ -1,12 +1,28 @@ -*auto_swapdir.txt* Automatically create 'swapdir' in 'realtimepath' +*auto_swapdir.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *auto_swapdir* -This plugin attempts to create a directory "swap" in the directory named by the -first element of 'realtimepath', and enables 'swapfile' with that as the +This plugin attempts to create a directory "swap" in the directory named by +the first element of 'runtimepath', and enables 'swapfile' with that as the 'directory' if it succeeds or if the directory already exists. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +REQUIREMENTS *auto_swapdir-requirements* + +This plugin is only available if 'compatible' is not set. + +AUTHOR *auto_swapdir-author* + +Written and maintained by Tom Ryder . + +LICENSE *auto_swapdir-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + +DISTRIBUTION *auto_swapdir-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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/auto_undodir.txt b/vim/doc/auto_undodir.txt index c782a70e..451bea66 100644 --- a/vim/doc/auto_undodir.txt +++ b/vim/doc/auto_undodir.txt @@ -1,14 +1,30 @@ -*auto_undodir.txt* Automatically create 'undodir' in 'realtimepath' +*auto_undodir.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *auto_undodir* -This plugin attempts to create a directory "undo" in the directory named by the -first element of 'realtimepath', and enables 'undofile' with that as the +This plugin attempts to create a directory "undo" in the directory named by +the first element of 'runtimepath', and enables 'undofile' with that as the 'undodir' if it succeeds or if the directory already exists. -It requires the +persistent_undo feature. +It requires the |+persistent_undo| feature. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +REQUIREMENTS *auto_undodir-requirements* + +This plugin is only available if 'compatible' is not set. + +AUTHOR *auto_undodir-author* + +Written and maintained by Tom Ryder . + +LICENSE *auto_undodir-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + +DISTRIBUTION *auto_undodir-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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/big_file_options.txt b/vim/doc/big_file_options.txt index 706ba5a7..cab0664e 100644 --- a/vim/doc/big_file_options.txt +++ b/vim/doc/big_file_options.txt @@ -1,12 +1,28 @@ -*big_file_options.txt* Disable slow options for big files for faster load +*big_file_options.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +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. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +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. +improves. See 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 index 93f37df9..0bd7c336 100644 --- a/vim/doc/command_typos.txt +++ b/vim/doc/command_typos.txt @@ -1,12 +1,28 @@ -*command_typos.txt* Bind capital-letter versions of common commands +*command_typos.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *command_typos* -This plugin defines custom commands like :W, :Qa, and :Wq to match their +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. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +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. +improves. See 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 index 15e4b1b0..f9aacfb4 100644 --- a/vim/doc/copy_linebreak.txt +++ b/vim/doc/copy_linebreak.txt @@ -1,7 +1,6 @@ -*copy_linebreak.txt* Mapping to toggle copy-paste friendly linebreak options +*copy_linebreak.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +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 @@ -9,17 +8,34 @@ human-readable output and a format friendly for copy-pasting with terminal emulators or screen/tmux. Mappings: - +> CopyLinebreakEnable CopyLinebreakDisable CopyLinebreakToggle - +< Commands: - +> :CopyLinebreakEnable :CopyLinebreakDisable :CopyLinebreakToggle -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +REQUIREMENTS *copy_linebreak-requirements* + +This plugin is only available if 'compatible' is not set. + +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. +improves. See 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 index ed122aee..55992288 100644 --- a/vim/doc/detect_background.txt +++ b/vim/doc/detect_background.txt @@ -1,9 +1,8 @@ -*detect_background.txt* Figure out 'background' with a bias towards "dark" +*detect_background.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *detect_background* -The detect_background#DetectBackground() function provided by this plugin +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'. @@ -15,6 +14,23 @@ 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. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/fixed_join.txt b/vim/doc/fixed_join.txt index 834a3569..7bfb6c8b 100644 --- a/vim/doc/fixed_join.txt +++ b/vim/doc/fixed_join.txt @@ -1,17 +1,33 @@ -*fixed_join.txt* Join lines in normal mode without moving cursor +*fixed_join.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *fixed_join* 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 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. -The plugin also provides a :FixedJoin command if you have +user_commands, but +The plugin also provides a `:FixedJoin` command if you have |+user_commands|, but this is not required. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +REQUIREMENTS *fixed_join-requirements* + +This plugin is only available if 'compatible' is not set. + +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. +improves. See 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 index d50fbfb7..f7ea1a95 100644 --- a/vim/doc/strip_trailing_whitespace.txt +++ b/vim/doc/strip_trailing_whitespace.txt @@ -1,7 +1,6 @@ -*strip_trailing_whitespace.txt* Strip trailing whitespace from whole buffer +*strip_trailing_whitespace.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *strip_trailing_whitespace* This plugin is the author's approach to stripping trailing whitespace from an entire buffer, including empty lines at the end, without making command noise @@ -10,6 +9,23 @@ and without moving the cursor from its current position. If also provides a :StripTrailingWhitespace command if you have +user_commands, but this is not required. -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +REQUIREMENTS *strip_trailing_whitespace-requirements* + +This plugin is only available if 'compatible' is not set. + +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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/toggle_option_flag.txt b/vim/doc/toggle_option_flag.txt index 9415ae6b..928a233b 100644 --- a/vim/doc/toggle_option_flag.txt +++ b/vim/doc/toggle_option_flag.txt @@ -1,17 +1,35 @@ -*toggle_option_flag.txt* Commands to toggle option flags +*toggle_option_flag.txt* For Vim version 7.0 Last change: 2017 November 12 -Author: Tom Ryder -License: Same terms as Vim itself (see |license|) +DESCRIPTION *toggle_option_flag* -This plugin provides commands :ToggleOptionFlag and :ToggleOptionFlagLocal to -toggle the values of options like |'formatoptions'| or |'complete'| that have -values comprised of single-character or comma-separated flags. The author +This plugin provides commands `:ToggleOptionFlag` and `:ToggleOptionFlagLocal` +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. - :ToggleOptionFlag formatoptions a - :ToggleOptionFlag switchbuf useopen - :ToggleOptionFlagLocal shortmess I +EXAMPLES *toggle_option_flag-examples* +> + :ToggleOptionFlag formatoptions a + :ToggleOptionFlag switchbuf useopen + :ToggleOptionFlagLocal shortmess I +< +REQUIREMENTS *toggle_option_flag-requirements* -This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun +This plugin is only available if 'compatible' is not set. + +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. +improves. See for more +information. + + vim:tw=78:ts=8:ft=help:norl: -- cgit v1.2.3 From 1696bb44071423e93ecbe3847306a4cac864eb16 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:18:55 +1300 Subject: Move Vim doc requirement to correct section --- vim/doc/auto_undodir.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vim/doc/auto_undodir.txt b/vim/doc/auto_undodir.txt index 451bea66..af7a49bf 100644 --- a/vim/doc/auto_undodir.txt +++ b/vim/doc/auto_undodir.txt @@ -6,11 +6,10 @@ This plugin attempts to create a directory "undo" in the directory named by the first element of 'runtimepath', and enables 'undofile' with that as the 'undodir' if it succeeds or if the directory already exists. -It requires the |+persistent_undo| feature. - REQUIREMENTS *auto_undodir-requirements* -This plugin is only available if 'compatible' is not set. +This plugin is only available if 'compatible' is not set. It also requires the +|+persistent_undo| Vim feature. AUTHOR *auto_undodir-author* -- cgit v1.2.3 From b95b95c43da6d44239005cb2a2b83c9584b45058 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:19:10 +1300 Subject: Remove nonexistent keyword references from Vim doc --- vim/doc/command_typos.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/doc/command_typos.txt b/vim/doc/command_typos.txt index 0bd7c336..938fef27 100644 --- a/vim/doc/command_typos.txt +++ b/vim/doc/command_typos.txt @@ -2,7 +2,7 @@ DESCRIPTION *command_typos* -This plugin defines custom commands like `:W`, `:Qa`, and `:Wq` to match their +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. -- cgit v1.2.3 From 3d5021d659d2864e484fe03f35d52adf2cb0c98b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:19:33 +1300 Subject: Flesh out copy_linebreak.vim interface docs --- vim/doc/copy_linebreak.txt | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/vim/doc/copy_linebreak.txt b/vim/doc/copy_linebreak.txt index f9aacfb4..7efbad4b 100644 --- a/vim/doc/copy_linebreak.txt +++ b/vim/doc/copy_linebreak.txt @@ -7,22 +7,37 @@ This plugin provides mapping targets for a user to set, unset, or toggle human-readable output and a format friendly for copy-pasting with terminal emulators or screen/tmux. -Mappings: -> - CopyLinebreakEnable - CopyLinebreakDisable - CopyLinebreakToggle -< -Commands: -> - :CopyLinebreakEnable - :CopyLinebreakDisable - :CopyLinebreakToggle - 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 . -- cgit v1.2.3 From 54b493bba73106276b568115b7485c4d5afd84e4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:19:49 +1300 Subject: Add help tag for detect_background.vim function --- vim/doc/detect_background.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/doc/detect_background.txt b/vim/doc/detect_background.txt index 55992288..570ac47b 100644 --- a/vim/doc/detect_background.txt +++ b/vim/doc/detect_background.txt @@ -1,6 +1,7 @@ *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 -- cgit v1.2.3 From ab4c81f6082ea9c34dc76119c669fc6821c1780f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:20:39 +1300 Subject: Flesh out fixed_join.vim interface documentation --- vim/doc/fixed_join.txt | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/vim/doc/fixed_join.txt b/vim/doc/fixed_join.txt index 7bfb6c8b..d12985ef 100644 --- a/vim/doc/fixed_join.txt +++ b/vim/doc/fixed_join.txt @@ -2,19 +2,38 @@ DESCRIPTION *fixed_join* -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. - -The plugin also provides a `:FixedJoin` command if you have |+user_commands|, but -this is not required. +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 . -- cgit v1.2.3 From 79aa32fcca87fed383c9f4baff9a001caed12356 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:21:11 +1300 Subject: Adjust layout of headings/links in Vim plugin help --- vim/doc/mail_mutt.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vim/doc/mail_mutt.txt b/vim/doc/mail_mutt.txt index bf86a57f..355f54f2 100644 --- a/vim/doc/mail_mutt.txt +++ b/vim/doc/mail_mutt.txt @@ -30,22 +30,19 @@ 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|. -CURRENT LINE *MailMuttLine* - + *MailMuttLine* Th MailMuttLine mapping runs `:MailMutt` on the current line in normal mode. For example: > :nmap ml MailMuttLine < -WHOLE BUFFER *MailMuttBuffer* - + *MailMuttBuffer* The MailMuttBuffer mapping runs `:MailMutt` on the whole buffer in normal mode. For example: > :nmap mb MailMuttBuffer < -SELECTED LINES *MailMuttSelected* - + *MailMuttSelected* The MailMuttSelected mapping runs `:MailMutt` on the selected lines in visual or selection mode. For example: > -- cgit v1.2.3 From 6419944328afdd25690131d3eb73e677029e2db4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:21:33 +1300 Subject: Specify type of example in mail_mutt.vim doc --- vim/doc/mail_mutt.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vim/doc/mail_mutt.txt b/vim/doc/mail_mutt.txt index 355f54f2..c3f8afaa 100644 --- a/vim/doc/mail_mutt.txt +++ b/vim/doc/mail_mutt.txt @@ -32,19 +32,19 @@ this explicitly in your |vimrc|. *MailMuttLine* Th MailMuttLine mapping runs `:MailMutt` on the current line in normal -mode. For example: +mode. A binding example might be: > :nmap ml MailMuttLine < *MailMuttBuffer* The MailMuttBuffer mapping runs `:MailMutt` on the whole buffer in -normal mode. For example: +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. For example: +visual or selection mode. A binding example might be: > :vmap ms MailMuttSelected < -- cgit v1.2.3 From fe513487fbf20772641b45ba0ff9ddc0a586d296 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:21:50 +1300 Subject: Flesh out strip_trailing_whitespace.vim help --- vim/doc/strip_trailing_whitespace.txt | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/vim/doc/strip_trailing_whitespace.txt b/vim/doc/strip_trailing_whitespace.txt index f7ea1a95..9e2907d4 100644 --- a/vim/doc/strip_trailing_whitespace.txt +++ b/vim/doc/strip_trailing_whitespace.txt @@ -2,17 +2,32 @@ DESCRIPTION *strip_trailing_whitespace* -This plugin is the author's approach to stripping trailing whitespace from an -entire buffer, including empty lines at the end, without making command noise -and without moving the cursor from its current position. - -If also provides a :StripTrailingWhitespace command if you have +user_commands, -but this is not required. +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 . -- cgit v1.2.3 From b9edd9073ca84e6efb78e9ed014744488682da57 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:22:27 +1300 Subject: Add help links to toggle_option_flag.vim interface --- vim/doc/toggle_option_flag.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/doc/toggle_option_flag.txt b/vim/doc/toggle_option_flag.txt index 928a233b..7587abd0 100644 --- a/vim/doc/toggle_option_flag.txt +++ b/vim/doc/toggle_option_flag.txt @@ -2,6 +2,7 @@ DESCRIPTION *toggle_option_flag* + *:ToggleOptionFlag* *:ToggleOptionFlagLocal* This plugin provides commands `:ToggleOptionFlag` and `:ToggleOptionFlagLocal` to toggle the values of options like |'formatoptions'| or |'complete'| that have values comprised of single-character or comma-separated flags. The author -- cgit v1.2.3 From 93d353a2b568a28102729945dfa3504a21d3fb63 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:22:46 +1300 Subject: Adjust first sentence of format_option_toggle.txt --- vim/doc/toggle_option_flag.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/doc/toggle_option_flag.txt b/vim/doc/toggle_option_flag.txt index 7587abd0..c8bf7678 100644 --- a/vim/doc/toggle_option_flag.txt +++ b/vim/doc/toggle_option_flag.txt @@ -3,7 +3,7 @@ DESCRIPTION *toggle_option_flag* *:ToggleOptionFlag* *:ToggleOptionFlagLocal* -This plugin provides commands `:ToggleOptionFlag` and `: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. -- cgit v1.2.3 From fa93fdc38b3456eab847d1f3190492583b705f8d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:23:16 +1300 Subject: Mention req of toggle_option_flag.vim --- vim/doc/toggle_option_flag.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vim/doc/toggle_option_flag.txt b/vim/doc/toggle_option_flag.txt index c8bf7678..be035221 100644 --- a/vim/doc/toggle_option_flag.txt +++ b/vim/doc/toggle_option_flag.txt @@ -16,7 +16,8 @@ EXAMPLES *toggle_option_flag-examples* < REQUIREMENTS *toggle_option_flag-requirements* -This plugin is only available if 'compatible' is not set. +This plugin is only available if 'compatible' is not set. It also requires the +|+user_commands| Vim feature. AUTHOR *toggle_option_flag-author* -- cgit v1.2.3 From c53b11072fc2de94b1bc6d13fb1c308b1002efc8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:30:58 +1300 Subject: Document each 'backspace' flag in Vim config --- vim/config/backspace.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vim/config/backspace.vim b/vim/config/backspace.vim index a4089a68..db842e12 100644 --- a/vim/config/backspace.vim +++ b/vim/config/backspace.vim @@ -1,3 +1,8 @@ -" Let me backspace over pretty much anything, even if it's not text I inserted -" in the current session -set backspace=indent,eol,start +" Let me backspace over pretty much anything +set backspace= +" Allow backspacing over autoindent +set backspace+=indent +" Allow backspacing over line breaks +set backspace+=eol +" Allow backspacing over the start of the insert operation +set backspace+=start -- cgit v1.2.3 From 4fc03c3970e9ccfcb6a792fed5b8c7d34e93da1e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:31:27 +1300 Subject: Correct nonexistent 'wildmode' value in Vim config There is no such setting as "longest:list". What I meant was "list:longest". --- vim/config/completion.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/config/completion.vim b/vim/config/completion.vim index a8a5c201..566a3a7c 100644 --- a/vim/config/completion.vim +++ b/vim/config/completion.vim @@ -9,7 +9,7 @@ if has('wildmenu') " Use the wild menu, both completing and showing all possible completions " with a single Tab press, just as I've configured Bash to do set wildmenu - set wildmode=longest:list + set wildmode=list:longest " Don't complete certain files that I'm not likely to want to manipulate " from within Vim: -- cgit v1.2.3 From c9cbeacdd2eb87200e7f43721adf3d61e804bde3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:37:31 +1300 Subject: Use :set not :setlocal for 'hlsearch'/'incsearch' They don't have local analogues; they're global options. --- vim/config/search.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vim/config/search.vim b/vim/config/search.vim index 69f3f472..967146d4 100644 --- a/vim/config/search.vim +++ b/vim/config/search.vim @@ -5,13 +5,13 @@ if has('extra_search') set incsearch nnoremap \ i - \ :setlocal incsearch! incsearch? + \ :set incsearch! incsearch? " Highlight search results, \h toggles this set hlsearch nnoremap \ h - \ :setlocal hlsearch! hlsearch? + \ :set hlsearch! hlsearch? " Pressing ^L will clear highlighting until the next search-related " operation; quite good because the highlighting gets distracting after @@ -27,10 +27,10 @@ if has('extra_search') autocmd! autocmd InsertEnter \ * - \ setlocal nohlsearch + \ set nohlsearch autocmd InsertLeave \ * - \ setlocal hlsearch + \ set hlsearch augroup END endif -- cgit v1.2.3 From 03919f1c03f89e17c90e398a7eaceabb21f1268c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 12 Nov 2017 23:58:43 +1300 Subject: Separate g:loaded/&cp tests from feat tests Keeping the tests at the beginning of plugins on one line without continuations is needed to work around &cpo-=C. --- vim/plugin/auto_undodir.vim | 5 ++++- vim/plugin/big_file_options.vim | 5 ++++- vim/plugin/command_typos.vim | 5 ++++- vim/plugin/copy_linebreak.vim | 5 ++++- vim/plugin/mail_mutt.vim | 5 ++++- vim/plugin/toggle_option_flag.vim | 5 ++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/vim/plugin/auto_undodir.vim b/vim/plugin/auto_undodir.vim index 9a686fb1..cf8d896a 100644 --- a/vim/plugin/auto_undodir.vim +++ b/vim/plugin/auto_undodir.vim @@ -5,7 +5,10 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_auto_undodir') || &compatible || !has('persistent_undo') +if exists('g:loaded_auto_undodir') || &compatible + finish +endif +if !has('persistent_undo') finish endif let g:loaded_auto_undodir = 1 diff --git a/vim/plugin/big_file_options.vim b/vim/plugin/big_file_options.vim index cbbacc42..f7fa0281 100644 --- a/vim/plugin/big_file_options.vim +++ b/vim/plugin/big_file_options.vim @@ -5,7 +5,10 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_big_file_options') || &compatible || !has('autocmd') +if exists('g:loaded_big_file_options') || &compatible + finish +endif +if !has('autocmd') finish endif let g:loaded_big_file_options = 1 diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim index afc04ed3..6f34c680 100644 --- a/vim/plugin/command_typos.vim +++ b/vim/plugin/command_typos.vim @@ -7,7 +7,10 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_command_typos') || &compatible || !has('user_commands') +if exists('g:loaded_command_typos') || &compatible + finish +endif +if !has('user_commands') finish endif let g:loaded_command_typos = 1 diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim index 158282bf..9d241d5a 100644 --- a/vim/plugin/copy_linebreak.vim +++ b/vim/plugin/copy_linebreak.vim @@ -6,7 +6,10 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_copy_linebreak') || &compatible || !has('linebreak') +if exists('g:loaded_copy_linebreak') || &compatible + finish +endif +if !has('linebreak') finish endif let g:loaded_copy_linebreak = 1 diff --git a/vim/plugin/mail_mutt.vim b/vim/plugin/mail_mutt.vim index 13389309..5170fb52 100644 --- a/vim/plugin/mail_mutt.vim +++ b/vim/plugin/mail_mutt.vim @@ -5,7 +5,10 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_mail_mutt') || &compatible || !has('user_commands') +if exists('g:loaded_mail_mutt') || &compatible + finish +endif +if !has('user_commands') finish endif let g:loaded_mail_mutt = 1 diff --git a/vim/plugin/toggle_option_flag.vim b/vim/plugin/toggle_option_flag.vim index 5c848368..bc7ccd78 100644 --- a/vim/plugin/toggle_option_flag.vim +++ b/vim/plugin/toggle_option_flag.vim @@ -5,7 +5,10 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('g:loaded_toggle_option_flag') || &compatible || !has('user_commands') +if exists('g:loaded_toggle_option_flag') || &compatible + finish +endif +if !has('user_commands') finish endif let g:loaded_toggle_option_flag = 1 -- cgit v1.2.3 From 54caf02bd794e45ed5b4b181f1e314e924809b1e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 13 Nov 2017 00:02:47 +1300 Subject: Move 'hlsearch' insert-mode suspension into plugin It's easily repackaged and it makes the configuration that much shorter, so I may as well. This version also correctly handles 'hlsearch' not being on in the first place. --- vim/config/search.vim | 14 ---------- vim/doc/insert_suspend_hlsearch.txt | 28 ++++++++++++++++++++ vim/plugin/insert_suspend_hlsearch.vim | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 vim/doc/insert_suspend_hlsearch.txt create mode 100644 vim/plugin/insert_suspend_hlsearch.vim diff --git a/vim/config/search.vim b/vim/config/search.vim index 967146d4..fc861801 100644 --- a/vim/config/search.vim +++ b/vim/config/search.vim @@ -20,18 +20,4 @@ if has('extra_search') \ \ :nohlsearch - " Clear search highlighting as soon as I enter insert mode, and restore it - " once I leave it - if has('autocmd') && v:version >= 701 - augroup dotfiles_highlight - autocmd! - autocmd InsertEnter - \ * - \ set nohlsearch - autocmd InsertLeave - \ * - \ set hlsearch - augroup END - endif - endif diff --git a/vim/doc/insert_suspend_hlsearch.txt b/vim/doc/insert_suspend_hlsearch.txt new file mode 100644 index 00000000..edb51e38 --- /dev/null +++ b/vim/doc/insert_suspend_hlsearch.txt @@ -0,0 +1,28 @@ +*insert_suspend_hlsearch.txt* For Vim version 7.0 Last change: 2017 November 12 + +DESCRIPTION *insert_suspend_hlsearch* + +This plugin quietly disables 'hlsearch' search highlighting if enabled when an +insert operation is started, and puts it back once done, to avoid the +distracting effect the highlighting can cause while writing. + +REQUIREMENTS *insert_suspend_hlsearch-requirements* + +This plugin is only available if 'compatible' is not set. + +AUTHOR *insert_suspend_hlsearch-author* + +Written and maintained by Tom Ryder . + +LICENSE *insert_suspend_hlsearch-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + +DISTRIBUTION *insert_suspend_hlsearch-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/insert_suspend_hlsearch.vim b/vim/plugin/insert_suspend_hlsearch.vim new file mode 100644 index 00000000..378febc8 --- /dev/null +++ b/vim/plugin/insert_suspend_hlsearch.vim @@ -0,0 +1,48 @@ +" +" insert_suspend_hlsearch.vim: If 'hlsearch' is enabled, switch it off when +" the user starts an insert mode operation, and back on again when they're +" done. +" +" Author: Tom Ryder +" License: Same as Vim itself +" +if exists('g:loaded_insert_suspend_hlsearch') || &compatible + finish +endif +" InsertEnter isn't an autocmd event until 7.0 +if !has('autocmd') || v:version < 700 + finish +endif +let g:loaded_insert_suspend_hlsearch = 1 + +" When entering insert mode, copy the current value of the 'hlsearch' option +" into a script variable; if it's enabled, suspend it +function s:InsertEnter() + let s:hlsearch = &hlsearch + echo &hlsearch + if s:hlsearch + set nohlsearch + endif + return +endfunction + +" When leaving insert mode, if 'hlsearch' was enabled when this operation +" started, restore it +function s:InsertLeave() + if s:hlsearch + set hlsearch + endif + return +endfunction + +" Clear search highlighting as soon as I enter insert mode, and restore it +" once I leave it +augroup insert_suspend_hlsearch + autocmd! + autocmd InsertEnter + \ * + \ call InsertEnter() + autocmd InsertLeave + \ * + \ call InsertLeave() +augroup END -- cgit v1.2.3 From ed0f0acb3f2c78b1f600db370b634c0e6bf269d7 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 13 Nov 2017 00:09:53 +1300 Subject: Limit \f mapping to normal mode --- vim/config/format.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/config/format.vim b/vim/config/format.vim index 97ebcb11..86557a8c 100644 --- a/vim/config/format.vim +++ b/vim/config/format.vim @@ -7,7 +7,7 @@ set nrformats-=octal silent! set formatoptions+=j " Show the current formatoptions at a glance -noremap +nnoremap \ f \ :setlocal formatoptions? -- cgit v1.2.3 From 99d40d4d31f85ce4b34fec5a6e7964e6335d6b8c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 13 Nov 2017 00:15:35 +1300 Subject: Bump version number to 0.15.0 --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 95d1b4f7..cf4f3cda 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v0.14.0 -Sun Nov 12 07:48:11 UTC 2017 +tejr dotfiles v0.15.0 +Sun Nov 12 11:15:22 UTC 2017 -- cgit v1.2.3