From 2bcce63572e062f34527fbe42bb0f5756a08d8b8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jun 2018 00:36:55 +1200 Subject: Refactor ftplugins into single files Each thereby effectively becomes its own .vimrc for that type. --- Makefile | 5 +--- vim/after/ftplugin/awk.vim | 17 ++++++++++++ vim/after/ftplugin/awk/comments.vim | 22 --------------- vim/after/ftplugin/c.vim | 14 ++++++++++ vim/after/ftplugin/c/include.vim | 22 --------------- vim/after/ftplugin/cpp.vim | 14 ++++++++++ vim/after/ftplugin/cpp/include.vim | 22 --------------- vim/after/ftplugin/diff.vim | 22 +++++++++++++++ vim/after/ftplugin/diff/maps.vim | 28 ------------------- vim/after/ftplugin/gitcommit.vim | 14 ++++++++++ vim/after/ftplugin/gitcommit/quote.vim | 25 ----------------- vim/after/ftplugin/html.vim | 27 +++++++++++++++++++ vim/after/ftplugin/html/lint.vim | 33 ----------------------- vim/after/ftplugin/html/maps.vim | 30 --------------------- vim/after/ftplugin/html/tidy.vim | 33 ----------------------- vim/after/ftplugin/html/url_link.vim | 49 ---------------------------------- vim/after/ftplugin/mail.vim | 15 +++++++++++ vim/after/ftplugin/mail/flowed.vim | 21 --------------- vim/after/ftplugin/make.vim | 20 ++++++++++++++ vim/after/ftplugin/make/maps.vim | 26 ------------------ vim/after/ftplugin/markdown.vim | 15 +++++++++++ vim/after/ftplugin/markdown/spell.vim | 21 --------------- vim/after/ftplugin/perl.vim | 24 +++++++++++++++++ vim/after/ftplugin/perl/check.vim | 28 ------------------- vim/after/ftplugin/perl/lint.vim | 28 ------------------- vim/after/ftplugin/perl/maps.vim | 30 --------------------- vim/after/ftplugin/perl/tidy.vim | 28 ------------------- vim/after/ftplugin/php.vim | 28 +++++++++++++++++++ vim/after/ftplugin/php/check.vim | 28 ------------------- vim/after/ftplugin/php/comments.vim | 22 --------------- vim/after/ftplugin/php/maps.vim | 26 ------------------ vim/after/ftplugin/sed.vim | 17 ++++++++++++ vim/after/ftplugin/sed/comments.vim | 22 --------------- vim/after/ftplugin/sh.vim | 46 +++++++++++++++++++++++++++++++ vim/after/ftplugin/sh/check.vim | 37 ------------------------- vim/after/ftplugin/sh/comments.vim | 22 --------------- vim/after/ftplugin/sh/han.vim | 26 ------------------ vim/after/ftplugin/sh/lint.vim | 28 ------------------- vim/after/ftplugin/sh/maps.vim | 28 ------------------- vim/after/ftplugin/text.vim | 15 +++++++++++ vim/after/ftplugin/text/spell.vim | 21 --------------- vim/after/ftplugin/vim.vim | 37 +++++++++++++++++++++++++ vim/after/ftplugin/vim/lint.vim | 28 ------------------- vim/after/ftplugin/vim/maps.vim | 42 ----------------------------- vim/after/ftplugin/zsh.vim | 21 +++++++++++++++ vim/after/ftplugin/zsh/check.vim | 28 ------------------- vim/after/ftplugin/zsh/maps.vim | 26 ------------------ vim/autoload/html.vim | 15 +++++++++++ 48 files changed, 362 insertions(+), 834 deletions(-) create mode 100644 vim/after/ftplugin/awk.vim delete mode 100644 vim/after/ftplugin/awk/comments.vim create mode 100644 vim/after/ftplugin/c.vim delete mode 100644 vim/after/ftplugin/c/include.vim create mode 100644 vim/after/ftplugin/cpp.vim delete mode 100644 vim/after/ftplugin/cpp/include.vim create mode 100644 vim/after/ftplugin/diff.vim delete mode 100644 vim/after/ftplugin/diff/maps.vim create mode 100644 vim/after/ftplugin/gitcommit.vim delete mode 100644 vim/after/ftplugin/gitcommit/quote.vim create mode 100644 vim/after/ftplugin/html.vim delete mode 100644 vim/after/ftplugin/html/lint.vim delete mode 100644 vim/after/ftplugin/html/maps.vim delete mode 100644 vim/after/ftplugin/html/tidy.vim delete mode 100644 vim/after/ftplugin/html/url_link.vim create mode 100644 vim/after/ftplugin/mail.vim delete mode 100644 vim/after/ftplugin/mail/flowed.vim create mode 100644 vim/after/ftplugin/make.vim delete mode 100644 vim/after/ftplugin/make/maps.vim create mode 100644 vim/after/ftplugin/markdown.vim delete mode 100644 vim/after/ftplugin/markdown/spell.vim create mode 100644 vim/after/ftplugin/perl.vim delete mode 100644 vim/after/ftplugin/perl/check.vim delete mode 100644 vim/after/ftplugin/perl/lint.vim delete mode 100644 vim/after/ftplugin/perl/maps.vim delete mode 100644 vim/after/ftplugin/perl/tidy.vim create mode 100644 vim/after/ftplugin/php.vim delete mode 100644 vim/after/ftplugin/php/check.vim delete mode 100644 vim/after/ftplugin/php/comments.vim delete mode 100644 vim/after/ftplugin/php/maps.vim create mode 100644 vim/after/ftplugin/sed.vim delete mode 100644 vim/after/ftplugin/sed/comments.vim create mode 100644 vim/after/ftplugin/sh.vim delete mode 100644 vim/after/ftplugin/sh/check.vim delete mode 100644 vim/after/ftplugin/sh/comments.vim delete mode 100644 vim/after/ftplugin/sh/han.vim delete mode 100644 vim/after/ftplugin/sh/lint.vim delete mode 100644 vim/after/ftplugin/sh/maps.vim create mode 100644 vim/after/ftplugin/text.vim delete mode 100644 vim/after/ftplugin/text/spell.vim create mode 100644 vim/after/ftplugin/vim.vim delete mode 100644 vim/after/ftplugin/vim/lint.vim delete mode 100644 vim/after/ftplugin/vim/maps.vim create mode 100644 vim/after/ftplugin/zsh.vim delete mode 100644 vim/after/ftplugin/zsh/check.vim delete mode 100644 vim/after/ftplugin/zsh/maps.vim create mode 100644 vim/autoload/html.vim diff --git a/Makefile b/Makefile index 81d2e711..7c4ebdf3 100644 --- a/Makefile +++ b/Makefile @@ -510,10 +510,7 @@ install-vim-after: install-vim-after-ftplugin \ install-vim-after-ftplugin: mkdir -p $(VIMDIR)/after/ftplugin - for type in vim/after/ftplugin/* ; do \ - mkdir -p -- $(VIMDIR)/after/ftplugin/"$${type##*/}" ; \ - cp -p -- "$$type"/* $(VIMDIR)/after/ftplugin/"$${type##*/}" ; \ - done + cp -p -- vim/after/ftplugin/*.vim $(VIMDIR)/after/ftplugin install-vim-after-indent: mkdir -p $(VIMDIR)/after/indent diff --git a/vim/after/ftplugin/awk.vim b/vim/after/ftplugin/awk.vim new file mode 100644 index 00000000..d4e16d9a --- /dev/null +++ b/vim/after/ftplugin/awk.vim @@ -0,0 +1,17 @@ +" Extra configuration for 'awk' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'awk' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments<' + \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/awk/comments.vim b/vim/after/ftplugin/awk/comments.vim deleted file mode 100644 index caf11679..00000000 --- a/vim/after/ftplugin/awk/comments.vim +++ /dev/null @@ -1,22 +0,0 @@ -" awk/comments.vim: Set 'comments' and supporting 'formatoptions' for AWK - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_awk_comments') - finish -endif - -" Flag as loaded -let b:did_ftplugin_awk_comments = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_awk_comments' - -" Set comment formats -setlocal comments=:# -setlocal formatoptions+=or -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim new file mode 100644 index 00000000..cc2c0d7f --- /dev/null +++ b/vim/after/ftplugin/c.vim @@ -0,0 +1,14 @@ +" Extra configuration for 'c' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_c') + finish +endif +let b:did_ftplugin_c = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_c' + +" Set comment formats +setlocal include=^\\s*#\\s*include +setlocal path+=/usr/include +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal include<' + \ . '|setlocal path<' diff --git a/vim/after/ftplugin/c/include.vim b/vim/after/ftplugin/c/include.vim deleted file mode 100644 index ce78d495..00000000 --- a/vim/after/ftplugin/c/include.vim +++ /dev/null @@ -1,22 +0,0 @@ -" c/include.vim: Set 'include' and 'path' - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_c_include') - finish -endif - -" Flag as loaded -let b:did_ftplugin_c_include = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_c_include' - -" Use trailing whitespace to denote continued paragraph -setlocal include=^\\s*#\\s*include -setlocal path+=/usr/include -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal include< path<' diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim new file mode 100644 index 00000000..7c68f0e6 --- /dev/null +++ b/vim/after/ftplugin/cpp.vim @@ -0,0 +1,14 @@ +" Extra configuration for 'cpp' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_cpp') + finish +endif +let b:did_ftplugin_cpp = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_cpp' + +" Set comment formats +setlocal include=^\\s*#\\s*include +setlocal path+=/usr/include +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal include<' + \ . '|setlocal path<' diff --git a/vim/after/ftplugin/cpp/include.vim b/vim/after/ftplugin/cpp/include.vim deleted file mode 100644 index 6c039287..00000000 --- a/vim/after/ftplugin/cpp/include.vim +++ /dev/null @@ -1,22 +0,0 @@ -" c/include.vim: Set 'include' and 'path' - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_cpp_include') - finish -endif - -" Flag as loaded -let b:did_ftplugin_cpp_include = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_cpp_include' - -" Use trailing whitespace to denote continued paragraph -setlocal include=^\\s*#\\s*include -setlocal path+=/usr/include -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal include< path<' diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim new file mode 100644 index 00000000..a6d45afe --- /dev/null +++ b/vim/after/ftplugin/diff.vim @@ -0,0 +1,22 @@ +" Extra configuration for 'diff' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'diff' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_diff_maps') + finish +endif + +" Set mappings +nmap p DiffPrune +xmap p DiffPrune +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap p' + \ . '|xunmap p' diff --git a/vim/after/ftplugin/diff/maps.vim b/vim/after/ftplugin/diff/maps.vim deleted file mode 100644 index 9ef5ddbf..00000000 --- a/vim/after/ftplugin/diff/maps.vim +++ /dev/null @@ -1,28 +0,0 @@ -" diff/maps.vim: tejr's mappings for 'diff' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_diff_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_diff_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_diff_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_diff_maps' - -" Set mappings -nmap p DiffPrune -xmap p DiffPrune -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap p' - \ . '|xunmap p' diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim new file mode 100644 index 00000000..8c0d3d17 --- /dev/null +++ b/vim/after/ftplugin/gitcommit.vim @@ -0,0 +1,14 @@ +" Extra configuration for 'gitcommit' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_gitcommit') + finish +endif +let b:did_ftplugin_gitcommit = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_gitcommit' + +" Make angle brackets behave like mail quotes +setlocal comments+=n:> +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments<' + \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/gitcommit/quote.vim b/vim/after/ftplugin/gitcommit/quote.vim deleted file mode 100644 index 61fa0509..00000000 --- a/vim/after/ftplugin/gitcommit/quote.vim +++ /dev/null @@ -1,25 +0,0 @@ -" gitcommit/quote.vim: Make angle-bracket quote characters behave like they do -" in mail messages, inserting the comment leader automatically on new lines -" and auto-formatting them. - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_gitcommit_quote') - finish -endif - -" Flag as loaded -let b:did_ftplugin_gitcommit_quote = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_gitcommit_quote' - -" Use trailing whitespace to denote continued paragraph -setlocal comments+=n:> -setlocal formatoptions+=c -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal comments<' - \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim new file mode 100644 index 00000000..a8e9efcc --- /dev/null +++ b/vim/after/ftplugin/html.vim @@ -0,0 +1,27 @@ +" Extra configuration for 'html' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'html' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_html_maps') + finish +endif + +" Set mappings +nnoremap l + \ :call compiler#Make('tidy') +nnoremap r + \ :call html#UrlLink() +nnoremap t + \ :call filter#Stable('tidy -quiet') +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap l' + \ . '|nunmap r' + \ . '|nunmap t' diff --git a/vim/after/ftplugin/html/lint.vim b/vim/after/ftplugin/html/lint.vim deleted file mode 100644 index 9ab479c0..00000000 --- a/vim/after/ftplugin/html/lint.vim +++ /dev/null @@ -1,33 +0,0 @@ -" html/lint.vim: Use tidy(1) to lint HTML documents for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_lint') - finish -endif - -" Don't load if the primary filetype isn't HTML -if &filetype !=# 'html' - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_lint' - -" Define a mapping target -nnoremap - \ HtmlLint - \ :call compiler#Make('tidy') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap HtmlLint' diff --git a/vim/after/ftplugin/html/maps.vim b/vim/after/ftplugin/html/maps.vim deleted file mode 100644 index a1d51f75..00000000 --- a/vim/after/ftplugin/html/maps.vim +++ /dev/null @@ -1,30 +0,0 @@ -" html/maps.vim: tejr's mappings for 'html' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_maps' - -" Set mappings -nmap l HtmlLint -nmap r HtmlUrlLink -nmap t HtmlTidy -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap l' - \ . '|nunmap r' - \ . '|nunmap t' diff --git a/vim/after/ftplugin/html/tidy.vim b/vim/after/ftplugin/html/tidy.vim deleted file mode 100644 index 9331486b..00000000 --- a/vim/after/ftplugin/html/tidy.vim +++ /dev/null @@ -1,33 +0,0 @@ -" html/tidy.vim: Use tidy(1) to filter HTML documents - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_tidy') - finish -endif - -" Don't load if the primary filetype isn't HTML -if &filetype !=# 'html' - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_tidy = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_tidy' - -" Define a mapping target -nnoremap - \ HtmlTidy - \ :call filter#Stable('tidy -quiet') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap HtmlTidy' diff --git a/vim/after/ftplugin/html/url_link.vim b/vim/after/ftplugin/html/url_link.vim deleted file mode 100644 index e7263e17..00000000 --- a/vim/after/ftplugin/html/url_link.vim +++ /dev/null @@ -1,49 +0,0 @@ -" html/url_link.vim: Make a URL into a link - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_url_link') - finish -endif - -" Don't load if the primary filetype isn't HTML -if &filetype !=# 'html' - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_url_link = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_url_link' - -" Make a bare URL into a link to itself -function! s:HtmlUrlLink() - - " Yank this whole whitespace-separated word - normal! yiW - " Open a link tag - normal! i - " Paste the URL into the quotes - normal! hP - " Move to the end of the link text URL - normal! E - " Close the link tag - normal! a - -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Define a mapping target -nnoremap - \ HtmlUrlLink - \ :call HtmlUrlLink() -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap HtmlUrlLink' diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim new file mode 100644 index 00000000..a25d55b7 --- /dev/null +++ b/vim/after/ftplugin/mail.vim @@ -0,0 +1,15 @@ +" Extra configuration for 'mail' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'mail' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Add a space to the end of wrapped lines for format-flowed mail +setlocal formatoptions+=w +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/mail/flowed.vim b/vim/after/ftplugin/mail/flowed.vim deleted file mode 100644 index 78353360..00000000 --- a/vim/after/ftplugin/mail/flowed.vim +++ /dev/null @@ -1,21 +0,0 @@ -" mail/flowed.vim: Add 'w' flag to 'formatoptions' for mail - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_mail_flowed') - finish -endif - -" Flag as loaded -let b:did_ftplugin_mail_flowed = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_mail_flowed' - -" Use trailing whitespace to denote continued paragraph -setlocal formatoptions+=w -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/make.vim b/vim/after/ftplugin/make.vim new file mode 100644 index 00000000..ca4e41a6 --- /dev/null +++ b/vim/after/ftplugin/make.vim @@ -0,0 +1,20 @@ +" Extra configuration for 'make' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'make' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_make_maps') + finish +endif + +" Set mappings +nmap m MakeTarget +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap m' diff --git a/vim/after/ftplugin/make/maps.vim b/vim/after/ftplugin/make/maps.vim deleted file mode 100644 index 1f9e2078..00000000 --- a/vim/after/ftplugin/make/maps.vim +++ /dev/null @@ -1,26 +0,0 @@ -" make/maps.vim: tejr's mappings for 'make' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_make_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_make_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_make_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_make_maps' - -" Set mappings -nmap m MakeTarget -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap m' diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim new file mode 100644 index 00000000..454e5c4c --- /dev/null +++ b/vim/after/ftplugin/markdown.vim @@ -0,0 +1,15 @@ +" Extra configuration for 'markdown' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'markdown' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Spellcheck documents +setlocal spell +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/markdown/spell.vim b/vim/after/ftplugin/markdown/spell.vim deleted file mode 100644 index 873f9f93..00000000 --- a/vim/after/ftplugin/markdown/spell.vim +++ /dev/null @@ -1,21 +0,0 @@ -" markdown/spell.vim: Turn on spell checking for Markdown files - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_markdown_spell') - finish -endif - -" Flag as loaded -let b:did_ftplugin_markdown_spell = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_markdown_spell' - -" Spellcheck documents by default -setlocal spell -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim new file mode 100644 index 00000000..b007af64 --- /dev/null +++ b/vim/after/ftplugin/perl.vim @@ -0,0 +1,24 @@ +" Extra configuration for 'perl' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'perl' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_perl_maps') + finish +endif + +" Set mappings +nmap c :call compiler#Make('perl') +nmap l :call compiler#Make('perlcritic') +nmap t :call filter#Stable('perltidy') +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' + \ . '|nunmap l' + \ . '|nunmap t' diff --git a/vim/after/ftplugin/perl/check.vim b/vim/after/ftplugin/perl/check.vim deleted file mode 100644 index c810c91f..00000000 --- a/vim/after/ftplugin/perl/check.vim +++ /dev/null @@ -1,28 +0,0 @@ -" perl/check.vim: Use Perl binary to check for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_check') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_check' - -" Define a mapping target -nnoremap - \ PerlCheck - \ :call compiler#Make('perl') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap PerlCheck' diff --git a/vim/after/ftplugin/perl/lint.vim b/vim/after/ftplugin/perl/lint.vim deleted file mode 100644 index 86741f79..00000000 --- a/vim/after/ftplugin/perl/lint.vim +++ /dev/null @@ -1,28 +0,0 @@ -" perl/lint.vim: Use Perl::Critic to lint scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_lint') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_lint' - -" Define a mapping target -nnoremap - \ PerlLint - \ :call compiler#Make('perlcritic') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap PerlLint' diff --git a/vim/after/ftplugin/perl/maps.vim b/vim/after/ftplugin/perl/maps.vim deleted file mode 100644 index 2340ac19..00000000 --- a/vim/after/ftplugin/perl/maps.vim +++ /dev/null @@ -1,30 +0,0 @@ -" perl/maps.vim: tejr's mappings for 'perl' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_maps' - -" Set mappings -nmap c PerlCheck -nmap l PerlLint -nmap t PerlTidy -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' - \ . '|nunmap l' - \ . '|nunmap t' diff --git a/vim/after/ftplugin/perl/tidy.vim b/vim/after/ftplugin/perl/tidy.vim deleted file mode 100644 index c815aba9..00000000 --- a/vim/after/ftplugin/perl/tidy.vim +++ /dev/null @@ -1,28 +0,0 @@ -" perl/tidy.vim: Use Perl::Tidy to format and filter scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_tidy') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_tidy = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_tidy' - -" Define a mapping target -nnoremap - \ PerlTidy - \ :call filter#Stable('perltidy') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap PerlTidy' diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim new file mode 100644 index 00000000..4521ba7d --- /dev/null +++ b/vim/after/ftplugin/php.vim @@ -0,0 +1,28 @@ +" Extra configuration for 'php' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'php' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=s1:/*,m:*,ex:*/,://,:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments<' + \ . '|setlocal formatoptions<' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_php_maps') + finish +endif + +" Set mappings +nnoremap c + \ :call compiler#Make('php') +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' diff --git a/vim/after/ftplugin/php/check.vim b/vim/after/ftplugin/php/check.vim deleted file mode 100644 index ea88d39b..00000000 --- a/vim/after/ftplugin/php/check.vim +++ /dev/null @@ -1,28 +0,0 @@ -" php/check.vim: Use PHP binary to check scripts for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_php_check') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_php_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_php_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_php_check' - -" Define a mapping target -nnoremap - \ PhpCheck - \ :call compiler#Make('php') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap PhpCheck' diff --git a/vim/after/ftplugin/php/comments.vim b/vim/after/ftplugin/php/comments.vim deleted file mode 100644 index 9d233560..00000000 --- a/vim/after/ftplugin/php/comments.vim +++ /dev/null @@ -1,22 +0,0 @@ -" php/comments.vim: Set 'comments' and supporting 'formatoptions' for PHP - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_php_comments') - finish -endif - -" Flag as loaded -let b:did_ftplugin_php_comments = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_php_comments' - -" Set comment formats -setlocal comments=s1:/*,m:*,ex:*/,://,:# -setlocal formatoptions+=or -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/php/maps.vim b/vim/after/ftplugin/php/maps.vim deleted file mode 100644 index 9ccfc586..00000000 --- a/vim/after/ftplugin/php/maps.vim +++ /dev/null @@ -1,26 +0,0 @@ -" php/maps.vim: tejr's mappings for 'php' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_php_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_php_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_php_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_php_maps' - -" Set mappings -nmap c PhpCheck -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' diff --git a/vim/after/ftplugin/sed.vim b/vim/after/ftplugin/sed.vim new file mode 100644 index 00000000..9c9c6c59 --- /dev/null +++ b/vim/after/ftplugin/sed.vim @@ -0,0 +1,17 @@ +" Extra configuration for 'sed' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'sed' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments<' + \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/sed/comments.vim b/vim/after/ftplugin/sed/comments.vim deleted file mode 100644 index 53b1524c..00000000 --- a/vim/after/ftplugin/sed/comments.vim +++ /dev/null @@ -1,22 +0,0 @@ -" sed/comments.vim: Set 'comments' and supporting 'formatoptions' for sed - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sed_comments') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sed_comments = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sed_comments' - -" Set comment formats -setlocal comments=:# -setlocal formatoptions+=or -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim new file mode 100644 index 00000000..a59eeee8 --- /dev/null +++ b/vim/after/ftplugin/sh.vim @@ -0,0 +1,46 @@ +" Extra configuration for 'sh' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'sh' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments<' + +" If subtype is Bash, set 'keywordprg' to han(1df) +if exists('b:is_bash') + setlocal keywordprg=han + let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal keywordprg<' +endif + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_sh_maps') + finish +endif + +" Choose check compiler based on file subtype +if exists('b:is_bash') + let b:sh_check_compiler = 'bash' +elseif exists('b:is_kornshell') + let b:sh_check_compiler = 'ksh' +else + let b:sh_check_compiler = 'sh' +endif + +" Set mappings +nnoremap c + \ :call compiler#Make(b:sh_check_compiler) +nnoremap l + \ :call compiler#Make('shellcheck') +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' + \ . '|nunmap l' diff --git a/vim/after/ftplugin/sh/check.vim b/vim/after/ftplugin/sh/check.vim deleted file mode 100644 index 48bb72d0..00000000 --- a/vim/after/ftplugin/sh/check.vim +++ /dev/null @@ -1,37 +0,0 @@ -" sh/check.vim: Use appropriate shell binary to check scripts for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_check') - finish -endif - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_check' - -" Choose compiler based on file subtype -if exists('b:is_bash') - let b:sh_check_compiler = 'bash' -elseif exists('b:is_kornshell') - let b:sh_check_compiler = 'ksh' -else - let b:sh_check_compiler = 'sh' -endif - -" Define a mapping target -nnoremap - \ ShCheck - \ :call compiler#Make(b:sh_check_compiler) -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap ShCheck' diff --git a/vim/after/ftplugin/sh/comments.vim b/vim/after/ftplugin/sh/comments.vim deleted file mode 100644 index 97e8adc9..00000000 --- a/vim/after/ftplugin/sh/comments.vim +++ /dev/null @@ -1,22 +0,0 @@ -" sh/comments.vim: Set 'comments' and supporting 'formatoptions' for shell script - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_comments') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_comments = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_comments' - -" Set comment formats -setlocal comments=:# -setlocal formatoptions+=or -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/sh/han.vim b/vim/after/ftplugin/sh/han.vim deleted file mode 100644 index 3aacdb7e..00000000 --- a/vim/after/ftplugin/sh/han.vim +++ /dev/null @@ -1,26 +0,0 @@ -" sh/han.vim: Use han(1df) as 'keywordprg' for Bash scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_han') - finish -endif - -" Don't load if this isn't Bash or if han(1df) isn't available -if !exists('b:is_bash') || !executable('han') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_han = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_han' - -" Set 'keywordprg' to han(1df) -setlocal keywordprg=han -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal keywordprg<' diff --git a/vim/after/ftplugin/sh/lint.vim b/vim/after/ftplugin/sh/lint.vim deleted file mode 100644 index a24ba369..00000000 --- a/vim/after/ftplugin/sh/lint.vim +++ /dev/null @@ -1,28 +0,0 @@ -" sh/lint.vim: Use appropriate shell binary to lint scripts for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_lint') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_lint' - -" Define a mapping target -nnoremap - \ ShLint - \ :call compiler#Make('shellcheck') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap ShLint' diff --git a/vim/after/ftplugin/sh/maps.vim b/vim/after/ftplugin/sh/maps.vim deleted file mode 100644 index 19d9300c..00000000 --- a/vim/after/ftplugin/sh/maps.vim +++ /dev/null @@ -1,28 +0,0 @@ -" sh/maps.vim: tejr's mappings for 'sh' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_maps' - -" Set mappings -nmap c ShCheck -nmap l ShLint -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' - \ . '|nunmap l' diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim new file mode 100644 index 00000000..22b1c27b --- /dev/null +++ b/vim/after/ftplugin/text.vim @@ -0,0 +1,15 @@ +" Extra configuration for 'text' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'text' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Spellcheck documents +setlocal spell +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/text/spell.vim b/vim/after/ftplugin/text/spell.vim deleted file mode 100644 index a9f5422b..00000000 --- a/vim/after/ftplugin/text/spell.vim +++ /dev/null @@ -1,21 +0,0 @@ -" text/spell.vim: Turn on spell checking for text files - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_text_spell') - finish -endif - -" Flag as loaded -let b:did_ftplugin_text_spell = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_text_spell' - -" Spellcheck documents by default -setlocal spell -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim new file mode 100644 index 00000000..fa65a65a --- /dev/null +++ b/vim/after/ftplugin/vim.vim @@ -0,0 +1,37 @@ +" Extra configuration for 'vim' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'vim' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_vim_maps') + finish +endif + +" Set mappings +nnoremap l + \ :call compiler#Make('vint') +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap l' + +" Add undo commands to fix clearing buffer-local vim maps that the core +" ftplugin leaves in place +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap [[' + \ . '|vunmap [[' + \ . '|nunmap ]]' + \ . '|vunmap ]]' + \ . '|nunmap []' + \ . '|vunmap []' + \ . '|nunmap ][' + \ . '|vunmap ][' + \ . '|nunmap ]"' + \ . '|vunmap ]"' + \ . '|nunmap ["' + \ . '|vunmap ["' diff --git a/vim/after/ftplugin/vim/lint.vim b/vim/after/ftplugin/vim/lint.vim deleted file mode 100644 index b71a7275..00000000 --- a/vim/after/ftplugin/vim/lint.vim +++ /dev/null @@ -1,28 +0,0 @@ -" vim/lint.vim: Use Vint to lint VimL scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_vim_lint') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_vim_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_vim_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_vim_lint' - -" Define a mapping target -nnoremap - \ VimLint - \ :call compiler#Make('vint') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap VimLint' diff --git a/vim/after/ftplugin/vim/maps.vim b/vim/after/ftplugin/vim/maps.vim deleted file mode 100644 index f527aeda..00000000 --- a/vim/after/ftplugin/vim/maps.vim +++ /dev/null @@ -1,42 +0,0 @@ -" vim/maps.vim: tejr's mappings for 'vim' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_vim_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_vim_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_vim_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_vim_maps' - -" Set mappings -nmap l VimLint -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap l' - -" Add undo commands to fix clearing buffer-local vim maps that the core -" ftplugin leaves in place -let b:undo_ftplugin = b:undo_ftplugin - \ . '|silent! nunmap [[' - \ . '|silent! vunmap [[' - \ . '|silent! nunmap ]]' - \ . '|silent! vunmap ]]' - \ . '|silent! nunmap []' - \ . '|silent! vunmap []' - \ . '|silent! nunmap ][' - \ . '|silent! vunmap ][' - \ . '|silent! nunmap ]"' - \ . '|silent! vunmap ]"' - \ . '|silent! nunmap ["' - \ . '|silent! vunmap ["' diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim new file mode 100644 index 00000000..4e56f428 --- /dev/null +++ b/vim/after/ftplugin/zsh.vim @@ -0,0 +1,21 @@ +" Extra configuration for 'zsh' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'zsh' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') + finish +endif + +" Set mappings +nnoremap c + \ :call compiler#Make('zsh') +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' diff --git a/vim/after/ftplugin/zsh/check.vim b/vim/after/ftplugin/zsh/check.vim deleted file mode 100644 index a439ef8d..00000000 --- a/vim/after/ftplugin/zsh/check.vim +++ /dev/null @@ -1,28 +0,0 @@ -" zsh/check.vim: Use Z shell binary to check for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_zsh_check') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_zsh_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_zsh_check' - -" Define a mapping target -nnoremap - \ ZshCheck - \ :call compiler#Make('zsh') -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap ZshCheck' diff --git a/vim/after/ftplugin/zsh/maps.vim b/vim/after/ftplugin/zsh/maps.vim deleted file mode 100644 index 1d0ec2cc..00000000 --- a/vim/after/ftplugin/zsh/maps.vim +++ /dev/null @@ -1,26 +0,0 @@ -" zsh/maps.zsh: tejr's mappings for 'zsh' filetypes - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_zsh_maps') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_zsh_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_zsh_maps' - -" Set mappings -nmap c ZshCheck -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' diff --git a/vim/autoload/html.vim b/vim/autoload/html.vim new file mode 100644 index 00000000..f46b323f --- /dev/null +++ b/vim/autoload/html.vim @@ -0,0 +1,15 @@ +" Make a bare URL into a link to itself +function! html#UrlLink() abort + + " Yank this whole whitespace-separated word + normal! yiW + " Open a link tag + normal! i + " Paste the URL into the quotes + normal! hP + " Move to the end of the link text URL + normal! E + " Close the link tag + normal! a + +endfunction -- cgit v1.2.3