diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-04 02:20:55 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-04 02:20:55 +1300 |
commit | 7ed0559c10d4bac62ef315560eaa592d9699ae32 (patch) | |
tree | 6667e0567f5f1c0ae619ee10527091425ea6eaad /vim | |
parent | Rename a misnamed variable in big_file.vim (diff) | |
download | dotfiles-7ed0559c10d4bac62ef315560eaa592d9699ae32.tar.gz dotfiles-7ed0559c10d4bac62ef315560eaa592d9699ae32.zip |
Use <Plug> prefix, make space strip configurable
This properly abstracts out the StripTrailingWhitespace mapping rather
than forcing it to <leader>x within the plugin itself. A bit nicer this
way.
Diffstat (limited to 'vim')
-rw-r--r-- | vim/config/whitespace.vim | 2 | ||||
-rw-r--r-- | vim/plugin/strip_trailing_whitespace.vim | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim new file mode 100644 index 00000000..75ab7173 --- /dev/null +++ b/vim/config/whitespace.vim @@ -0,0 +1,2 @@ +" \x strips trailing whitespace via a custom plugin +nmap <leader>x <Plug>StripTrailingWhitespace diff --git a/vim/plugin/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim index cc2554bd..6a83eb53 100644 --- a/vim/plugin/strip_trailing_whitespace.vim +++ b/vim/plugin/strip_trailing_whitespace.vim @@ -1,4 +1,5 @@ -" Strip trailing whitespace with \x in the whole document +" User-defined key mapping to strip trailing whitespace in the whole document +" Suggested mapping: <leader>\x if has('eval') " Define function for stripping whitespace @@ -51,7 +52,8 @@ if has('eval') endif endfunction - " Map \x to the function just defined - nnoremap <silent> <leader>x :<C-U>call <SID>StripTrailingWhitespace()<CR> - + " Create mapping proxy to the function just defined + " Suggested mapping: <leader>x + noremap <Plug>StripTrailingWhitespace + \ :<C-U>call <SID>StripTrailingWhitespace()<CR> endif |