aboutsummaryrefslogtreecommitdiff
path: root/vim/ftplugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 11:48:42 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 11:48:42 +1300
commit0ec73d6242582783ae1a9d457dfe04a5bc852199 (patch)
tree1eb9a1ed2320e5ecdd2cf49659c59f241f2d28a7 /vim/ftplugin
parentSet whitespace options for VimL locally (diff)
downloaddotfiles-0ec73d6242582783ae1a9d457dfe04a5bc852199.tar.gz
dotfiles-0ec73d6242582783ae1a9d457dfe04a5bc852199.zip
Move vim/after/ftplugin files into vim/ftplugin
None of the settings in here need to be run after the core configuration files are loaded, so I'll put them in a slightly more accessible or logical place. This adds a new target `install-vim-ftplugin`, and makes that a prerequisite of the `install-vim` target.
Diffstat (limited to 'vim/ftplugin')
-rw-r--r--vim/ftplugin/html.vim11
-rw-r--r--vim/ftplugin/mail.vim2
-rw-r--r--vim/ftplugin/perl.vim6
-rw-r--r--vim/ftplugin/sh.vim11
-rw-r--r--vim/ftplugin/vim.vim4
5 files changed, 34 insertions, 0 deletions
diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim
new file mode 100644
index 00000000..38b71656
--- /dev/null
+++ b/vim/ftplugin/html.vim
@@ -0,0 +1,11 @@
+" Run tidy -eq -utf8 on file for the current buffer
+nnoremap <leader>v :exe "!tidy -eq -utf8 " . shellescape(expand("%"))<CR>
+
+" Make a bare URL into a link to itself
+function! UrlLink()
+ normal yiW
+ execute "normal i<a href=\"\<C-R>0\">\<Esc>"
+ normal E
+ execute "normal a</a>\<Esc>"
+endfunction
+nnoremap <silent> <leader>r :<C-U>call UrlLink()<CR>
diff --git a/vim/ftplugin/mail.vim b/vim/ftplugin/mail.vim
new file mode 100644
index 00000000..35432b96
--- /dev/null
+++ b/vim/ftplugin/mail.vim
@@ -0,0 +1,2 @@
+" Use trailing whitespace to denote continued paragraph
+setlocal formatoptions+=w
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim
new file mode 100644
index 00000000..dad2ce35
--- /dev/null
+++ b/vim/ftplugin/perl.vim
@@ -0,0 +1,6 @@
+" Run perl -c on file for the current buffer
+nnoremap <leader>pc :exe "!perl -c " . shellescape(expand("%"))<CR>
+" Run perlcritic on the file for the current buffer
+nnoremap <leader>pl :exe "!perlcritic " . shellescape(expand("%"))<CR>
+" Run the current buffer through perltidy
+nnoremap <leader>pt :%!perltidy<CR>
diff --git a/vim/ftplugin/sh.vim b/vim/ftplugin/sh.vim
new file mode 100644
index 00000000..2b73611e
--- /dev/null
+++ b/vim/ftplugin/sh.vim
@@ -0,0 +1,11 @@
+" Default to POSIX shell, as I never write Bourne, and if I write Bash or Ksh
+" it'll be denoted with either a shebang or an appropriate extension. At the
+" time of writing, changing this also prompts sh.vim to set g:is_kornshell,
+" which is absurd, and requires a bit more massaging in after/syntax/sh.vim to
+" turn off some unwanted stuff.
+let g:is_posix = 1
+
+" Use han(1df) as a man(1) wrapper for Bash files if available
+if exists('b:is_bash') && executable('han')
+ setlocal keywordprg=han
+endif
diff --git a/vim/ftplugin/vim.vim b/vim/ftplugin/vim.vim
new file mode 100644
index 00000000..b958fe54
--- /dev/null
+++ b/vim/ftplugin/vim.vim
@@ -0,0 +1,4 @@
+" Observe VimL conventions for two-space indents
+setlocal shiftwidth=2
+setlocal softtabstop=2
+setlocal tabstop=2