From 79d6eef63ff4984fa3f8631aec6da26fa19a6f34 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Nov 2017 20:16:43 +1300 Subject: Adjust plugin code layout a lot Including renaming big_file.vim and accompanying functions yet again, to big_file_options.vim. Trying to keep complex autocmd and mapping definitions on long lines broken up semantically; definition and options on one line, patterns or mapping key on the next, and the command to run on the last. Also trying to make sure that , , and are applied in the correct places, and that all mapping commands are using the : idiom for the command prefix. --- vim/ftplugin/html.vim | 15 ++++++++++----- vim/ftplugin/perl.vim | 15 +++++++++------ vim/ftplugin/sh.vim | 6 ++++-- vim/ftplugin/vim.vim | 5 +++-- 4 files changed, 26 insertions(+), 15 deletions(-) (limited to 'vim/ftplugin') diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim index c756eb80..3db5dcca 100644 --- a/vim/ftplugin/html.vim +++ b/vim/ftplugin/html.vim @@ -1,10 +1,12 @@ " Run `tidy -errors -quiet` over buffer -nnoremap c - \ :write !tidy -errors -quiet +nnoremap + \ c + \ :write !tidy -errors -quiet " Filter buffer through `tidy` -nnoremap t - \ :%!tidy -quiet +nnoremap + \ t + \ :%!tidy -quiet " Make a bare URL into a link to itself function! s:UrlLink() @@ -21,5 +23,8 @@ function! s:UrlLink() normal! a endfunction -nnoremap r + +" Mapping for the function above +nnoremap + \ r \ :call UrlLink() diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim index 2ea4676b..07cf9a1f 100644 --- a/vim/ftplugin/perl.vim +++ b/vim/ftplugin/perl.vim @@ -1,11 +1,14 @@ " Run `perl -c` over buffer -nnoremap c - \ :write !perl -c +nnoremap + \ c + \ :write !perl -c " Run `perlcritic` over buffer -nnoremap l - \ :write !perlcritic +nnoremap + \ l + \ :write !perlcritic " Filter buffer through `perltidy` -nnoremap t - \ :%!perltidy +nnoremap + \ t + \ :%!perltidy diff --git a/vim/ftplugin/sh.vim b/vim/ftplugin/sh.vim index c09e4fe8..ae1974a0 100644 --- a/vim/ftplugin/sh.vim +++ b/vim/ftplugin/sh.vim @@ -33,7 +33,8 @@ elseif exists('b:is_ksh') && b:is_ksh else let b:check = 'sh -n' endif -nnoremap c +nnoremap + \ c \ :execute ':write !' . b:check " Map linter based on shell family @@ -44,5 +45,6 @@ elseif exists('b:is_ksh') && b:is_ksh else let b:lint = 'shellcheck -s sh -' endif -nnoremap l +nnoremap + \ l \ :execute ':write !' . b:lint diff --git a/vim/ftplugin/vim.vim b/vim/ftplugin/vim.vim index e023553e..d4e55ace 100644 --- a/vim/ftplugin/vim.vim +++ b/vim/ftplugin/vim.vim @@ -1,5 +1,6 @@ " Run `vint` over buffer " /dev/stdin is not optimal here; it's widely implemented, but not POSIX. " `vint` does not seem to have another way to parse standard input. -nnoremap l - \ :write !vint -s /dev/stdin +nnoremap + \ l + \ :write !vint -s /dev/stdin -- cgit v1.2.3