summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-03 01:26:09 -0500
committerdoy <doy@tozt.net>2009-01-03 01:26:09 -0500
commiteed03516376ec595b6cc0c57f13c5e0a57e20480 (patch)
tree0cd7c20385c57ac40eb0e4ab183eb1691482702e
parenta65a2e3e1e74e1fb79ec98cc1c33a7ebc301f131 (diff)
downloadconf-eed03516376ec595b6cc0c57f13c5e0a57e20480.tar.gz
conf-eed03516376ec595b6cc0c57f13c5e0a57e20480.zip
move all of the FileType autocommands into files under ftplugin/
-rw-r--r--vim/ftplugin/help.vim3
-rw-r--r--vim/ftplugin/lua.vim11
-rw-r--r--vim/ftplugin/perl.vim14
-rw-r--r--vim/ftplugin/tex.vim37
-rw-r--r--vim/ftplugin/vim.vim1
-rw-r--r--vimrc77
6 files changed, 66 insertions, 77 deletions
diff --git a/vim/ftplugin/help.vim b/vim/ftplugin/help.vim
new file mode 100644
index 0000000..1fbe614
--- /dev/null
+++ b/vim/ftplugin/help.vim
@@ -0,0 +1,3 @@
+setlocal keywordprg=:help
+nnoremap <buffer> <CR> <C-]>
+nnoremap <buffer> <BS> <C-T>
diff --git a/vim/ftplugin/lua.vim b/vim/ftplugin/lua.vim
new file mode 100644
index 0000000..fc0d0fc
--- /dev/null
+++ b/vim/ftplugin/lua.vim
@@ -0,0 +1,11 @@
+" :make does a syntax check
+setlocal makeprg=luac\ -p\ %
+setlocal errorformat=luac:\ %f:%l:\ %m
+
+" set commentstring
+setlocal commentstring=--%s
+
+" treat require lines as include lines (for tab completion, etc)
+setlocal include=\\s*require\\s*
+setlocal includeexpr=substitute(v:fname,'\\.','/','g').'.lua'
+exe "setlocal path=" . system("lua -e 'local fpath = \"\" for path in package.path:gmatch(\"[^;]*\") do if path:match(\"\?\.lua$\") then fpath = fpath .. path:gsub(\"\?\.lua$\", \"\") .. \",\" end end print(fpath:gsub(\",,\", \",.,\"):sub(0, -2))'")
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim
new file mode 100644
index 0000000..ecd8f31
--- /dev/null
+++ b/vim/ftplugin/perl.vim
@@ -0,0 +1,14 @@
+" :make does a syntax check
+setlocal makeprg=$VIMRUNTIME/tools/efm_perl.pl\ -c\ %\ $*
+setlocal errorformat=%f:%l:%m
+
+" look up words in perldoc rather than man for K
+setlocal keywordprg=perldoc\ -f
+
+" treat use lines as include lines (for tab completion, etc)
+" XXX: it would be really sweet to make gf work with this, but unfortunately
+" that checks the filename directly first, so things like 'use Moose' bring
+" up the $LIB/Moose/ directory, since it exists, before evaluating includeexpr
+setlocal include=\\s*use\\s*
+setlocal includeexpr=substitute(v:fname,'::','/','g').'.pm'
+exe "setlocal path=" . system("perl -e 'print join \",\", @INC;'") . ",lib"
diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim
new file mode 100644
index 0000000..78ce3cc
--- /dev/null
+++ b/vim/ftplugin/tex.vim
@@ -0,0 +1,37 @@
+" :make converts to pdf
+if strlen(system('which xpdf')) && strlen(expand('$DISPLAY'))
+ setlocal makeprg=(cd\ %:h\ &&\ pdflatex\ %:t\ &&\ xpdf\ $(echo\ %:t\ \\\|\ sed\ \'s/\\(\\.[^.]*\\)\\?$/.pdf/\'))
+elseif strlen(system('which evince')) && strlen(expand('$DISPLAY'))
+ setlocal makeprg=(cd\ %:h\ &&\ pdflatex\ %:t\ &&\ evince\ $(echo\ %:t\ \\\|\ sed\ \'s/\\(\\.[^.]*\\)\\?$/.pdf/\'))
+else
+ setlocal makeprg=(cd\ %:h\ &&\ pdflatex\ %:t)
+endif
+" see :help errorformat-LaTeX
+setlocal errorformat=
+ \%E!\ LaTeX\ %trror:\ %m,
+ \%E!\ %m,
+ \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
+ \%+W%.%#\ at\ lines\ %l--%*\\d,
+ \%WLaTeX\ %.%#Warning:\ %m,
+ \%Cl.%l\ %m,
+ \%+C\ \ %m.,
+ \%+C%.%#-%.%#,
+ \%+C%.%#[]%.%#,
+ \%+C[]%.%#,
+ \%+C%.%#%[{}\\]%.%#,
+ \%+C<%.%#>%.%#,
+ \%C\ \ %m,
+ \%-GSee\ the\ LaTeX%m,
+ \%-GType\ \ H\ <return>%m,
+ \%-G\ ...%.%#,
+ \%-G%.%#\ (C)\ %.%#,
+ \%-G(see\ the\ transcript%.%#),
+ \%-G\\s%#,
+ \%+O(%f)%r,
+ \%+P(%f%r,
+ \%+P\ %\\=(%f%r,
+ \%+P%*[^()](%f%r,
+ \%+P[%\\d%[^()]%#(%f%r,
+ \%+Q)%r,
+ \%+Q%*[^()])%r,
+ \%+Q[%\\d%*[^()])%r
diff --git a/vim/ftplugin/vim.vim b/vim/ftplugin/vim.vim
new file mode 100644
index 0000000..24dd22c
--- /dev/null
+++ b/vim/ftplugin/vim.vim
@@ -0,0 +1 @@
+setlocal keywordprg=:help
diff --git a/vimrc b/vimrc
index 45e68dd..98f65bc 100644
--- a/vimrc
+++ b/vimrc
@@ -272,89 +272,12 @@ au BufWritePost *.{sh,pl} silent exe "!chmod +x %"
" Update ctags after writing {{{
autocmd BufWritePost * if filereadable('tags') | silent exe "!ctags -a %" | redraw | endif
" }}}
-" Language specific things {{{
-" Perl {{{
-" :make does a syntax check
-autocmd FileType perl setlocal makeprg=$VIMRUNTIME/tools/efm_perl.pl\ -c\ %\ $*
-autocmd FileType perl setlocal errorformat=%f:%l:%m
-
-" look up words in perldoc rather than man for K
-autocmd FileType perl setlocal keywordprg=perldoc\ -f
-
-" treat use lines as include lines (for tab completion, etc)
-" XXX: it would be really sweet to make gf work with this, but unfortunately
-" that checks the filename directly first, so things like 'use Moose' bring
-" up the $LIB/Moose/ directory, since it exists, before evaluating includeexpr
-autocmd FileType perl setlocal include=\\s*use\\s*
-autocmd FileType perl setlocal includeexpr=substitute(v:fname,'::','/','g').'.pm'
-autocmd FileType perl exe "setlocal path=" . system("perl -e 'print join \",\", @INC;'") . ",lib"
-" }}}
-" Latex {{{
-" :make converts to pdf
-if strlen(system('which xpdf')) && strlen(expand('$DISPLAY'))
- autocmd FileType tex setlocal makeprg=(cd\ %:h\ &&\ pdflatex\ %:t\ &&\ xpdf\ $(echo\ %:t\ \\\|\ sed\ \'s/\\(\\.[^.]*\\)\\?$/.pdf/\'))
-elseif strlen(system('which evince')) && strlen(expand('$DISPLAY'))
- autocmd FileType tex setlocal makeprg=(cd\ %:h\ &&\ pdflatex\ %:t\ &&\ evince\ $(echo\ %:t\ \\\|\ sed\ \'s/\\(\\.[^.]*\\)\\?$/.pdf/\'))
-else
- autocmd FileType tex setlocal makeprg=(cd\ %:h\ &&\ pdflatex\ %:t)
-endif
-" see :help errorformat-LaTeX
-autocmd FileType tex setlocal errorformat=
- \%E!\ LaTeX\ %trror:\ %m,
- \%E!\ %m,
- \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
- \%+W%.%#\ at\ lines\ %l--%*\\d,
- \%WLaTeX\ %.%#Warning:\ %m,
- \%Cl.%l\ %m,
- \%+C\ \ %m.,
- \%+C%.%#-%.%#,
- \%+C%.%#[]%.%#,
- \%+C[]%.%#,
- \%+C%.%#%[{}\\]%.%#,
- \%+C<%.%#>%.%#,
- \%C\ \ %m,
- \%-GSee\ the\ LaTeX%m,
- \%-GType\ \ H\ <return>%m,
- \%-G\ ...%.%#,
- \%-G%.%#\ (C)\ %.%#,
- \%-G(see\ the\ transcript%.%#),
- \%-G\\s%#,
- \%+O(%f)%r,
- \%+P(%f%r,
- \%+P\ %\\=(%f%r,
- \%+P%*[^()](%f%r,
- \%+P[%\\d%[^()]%#(%f%r,
- \%+Q)%r,
- \%+Q%*[^()])%r,
- \%+Q[%\\d%*[^()])%r
-" }}}
-" Lua {{{
-" :make does a syntax check
-autocmd FileType lua setlocal makeprg=luac\ -p\ %
-autocmd FileType lua setlocal errorformat=luac:\ %f:%l:\ %m
-
-" set commentstring
-autocmd FileType lua setlocal commentstring=--%s
-
-" treat require lines as include lines (for tab completion, etc)
-autocmd FileType lua setlocal include=\\s*require\\s*
-autocmd FileType lua setlocal includeexpr=substitute(v:fname,'\\.','/','g').'.lua'
-autocmd FileType lua exe "setlocal path=" . system("lua -e 'local fpath = \"\" for path in package.path:gmatch(\"[^;]*\") do if path:match(\"\?\.lua$\") then fpath = fpath .. path:gsub(\"\?\.lua$\", \"\") .. \",\" end end print(fpath:gsub(\",,\", \",.,\"):sub(0, -2))'")
-" }}}
-" Vim {{{
-autocmd FileType {vim,help} setlocal keywordprg=:help
-" }}}
-" }}}
" Misc {{{
autocmd BufWritePost .conkyrc silent exe "!killall -HUP conky"
autocmd QuickFixCmdPost * copen 3
" }}}
" }}}
" Remappings {{{
-" Help file remappings for easy navigation {{{
-autocmd FileType help nnoremap <buffer> <CR> <C-]>
-autocmd FileType help nnoremap <buffer> <BS> <C-T>
-" }}}
" darcs convenience mappings {{{
nmap \da :execute 'w <bar> !darcs add %'<CR>
nmap \dA :execute 'wa <bar> !darcs amend-record'<CR>