summaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-10-24 02:40:06 -0400
committerJesse Luehrs <doy@tozt.net>2017-10-24 03:31:57 -0400
commitba2de93f8527cd65a27bd1846c938c671eddf228 (patch)
tree607c45ed10a81eece299c16f89a07d0ea1b3eadb /vim
parent2cdd9d6858367976bfccc78a40ef2efdd82b8139 (diff)
downloadconf-ba2de93f8527cd65a27bd1846c938c671eddf228.tar.gz
conf-ba2de93f8527cd65a27bd1846c938c671eddf228.zip
clean up some ftplugins
Diffstat (limited to 'vim')
-rw-r--r--vim/ftplugin/go.vim2
-rw-r--r--vim/ftplugin/perl.vim37
-rw-r--r--vim/ftplugin/rust.vim6
-rw-r--r--vim/ftplugin/tex.vim22
-rw-r--r--vim/ftplugin/xs.vim2
5 files changed, 21 insertions, 48 deletions
diff --git a/vim/ftplugin/go.vim b/vim/ftplugin/go.vim
index 8c0ee12..6375c53 100644
--- a/vim/ftplugin/go.vim
+++ b/vim/ftplugin/go.vim
@@ -1 +1 @@
-set ts=4
+setlocal ts=4
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim
index 9492f1d..085e940 100644
--- a/vim/ftplugin/perl.vim
+++ b/vim/ftplugin/perl.vim
@@ -1,43 +1,12 @@
let b:ale_linters = { 'perl': ['perlcritic'] }
-" :make does a syntax check
-if expand("%:e") == "psgi"
- exe 'setlocal makeprg=plackup\ -Ilib\ -a\ ' . expand("%")
-else
- setlocal makeprg=$VIMRUNTIME/tools/efm_perl.pl\ -c\ %\ $*
- setlocal errorformat=%f:%l:%m
-endif
-
" look up words in perldoc rather than man for K
function! s:perldoc(word)
let perldoc_pager = $PERLDOC_PAGER
let $PERLDOC_PAGER = 'cat'
exe 'silent read! perldoc -f "' . a:word . '" 2>/dev/null || perldoc "' . a:word . '"'
let $PERLDOC_PAGER = perldoc_pager
- set ft=man
-endfunction
-nmap <buffer> <silent>K :call Help(0, [':'], '<SID>perldoc')<CR>
-vmap <buffer> <silent>K :call Help(1, [':'], '<SID>perldoc')<CR>
-
-function! s:unpostfix()
- let postop_pattern = '\<\(if\|unless\|while\|until\|for\)\>'
- let indent = repeat(' ', &sw)
-
- if getline('.') =~ postop_pattern
- normal kJ
- else
- normal J
- endif
-
- " XXX this doesn't insert newlines properly
- " let line = getline('.')
- " let line = substitute(
- " \line,
- " \'\(\s*\)\(.*\) ' . postop_pattern . ' \(.*\);',
- " \'\1\3 (\4) {\1' . indent . '\2;\n\1}',
- " \''
- " \)
- " call setline('.', line)
- exe 's/\(\s*\)\(.*\) ' . postop_pattern . ' \(.*\);/\1\3 (\4) {\r\1' . indent . '\2;\r\1}/'
+ setlocal ft=man
endfunction
-map <buffer> <silent> <Leader>i :call <SID>unpostfix()<CR>
+nnoremap <buffer> <silent>K :call Help(0, [':'], '<SID>perldoc')<CR>
+vnoremap <buffer> <silent>K :call Help(1, [':'], '<SID>perldoc')<CR>
diff --git a/vim/ftplugin/rust.vim b/vim/ftplugin/rust.vim
index b899d50..d090a5c 100644
--- a/vim/ftplugin/rust.vim
+++ b/vim/ftplugin/rust.vim
@@ -1,8 +1,8 @@
+let b:ale_rust_cargo_use_check = 1
+
if filereadable("Cargo.toml")
- compiler cargo
+ compiler cargo
setlocal makeprg=cargo\ build
else
setlocal makeprg=rustc\ %
endif
-
-let b:ale_rust_cargo_use_check = 1
diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim
index 827f95d..37fe35d 100644
--- a/vim/ftplugin/tex.vim
+++ b/vim/ftplugin/tex.vim
@@ -13,11 +13,13 @@ function! s:xpdf()
endfor
call system('xpdf -remote localhost ' . pdf . ' &')
endfunction
+
" evince treats opening the same file twice as meaning 'reload'
function! s:evince()
let pdf = '/tmp/' . expand('<afile>:t:r') . '.pdf'
system('evince ' . pdf . ' &')
endfunction
+
" don't load the pdf if the make failed
function! s:make_errors()
let qf = getqflist()
@@ -28,6 +30,7 @@ function! s:make_errors()
endfor
return 0
endfunction
+
let b:automake_enabled = 0
function! s:automake()
let old_shellpipe = &shellpipe
@@ -38,18 +41,19 @@ function! s:automake()
let &shellpipe = old_shellpipe
endtry
endfunction
+
augroup _tex
-autocmd!
-if executable('xpdf') && strlen(expand('$DISPLAY'))
- autocmd QuickFixCmdPost make if !s:make_errors() | call s:xpdf() | endif
-elseif executable('evince') && strlen(expand('$DISPLAY'))
- autocmd QuickFixCmdPost make if !s:make_errors() | call s:evince() | endif
-endif
-autocmd CursorHold,CursorHoldI,InsertLeave <buffer> if b:automake_enabled | call s:automake() | endif
+ autocmd!
+ if executable('xpdf') && strlen(expand('$DISPLAY'))
+ autocmd QuickFixCmdPost make if !s:make_errors() | call s:xpdf() | endif
+ elseif executable('evince') && strlen(expand('$DISPLAY'))
+ autocmd QuickFixCmdPost make if !s:make_errors() | call s:evince() | endif
+ endif
+ autocmd CursorHold,CursorHoldI,InsertLeave <buffer> if b:automake_enabled | call s:automake() | endif
augroup END
-noremap <silent><F6> :let b:automake_enabled = !b:automake_enabled<CR><F5>
-inoremap <silent><F6> <C-O>:let b:automake_enabled = !b:automake_enabled<CR><C-O><F5>
+noremap <buffer> <silent><F6> :let b:automake_enabled = !b:automake_enabled<CR><F5>
+inoremap <buffer> <silent><F6> <C-O>:let b:automake_enabled = !b:automake_enabled<CR><C-O><F5>
" see :help errorformat-LaTeX
setlocal errorformat=
diff --git a/vim/ftplugin/xs.vim b/vim/ftplugin/xs.vim
index 955a8b4..be6cce2 100644
--- a/vim/ftplugin/xs.vim
+++ b/vim/ftplugin/xs.vim
@@ -1 +1 @@
-set cindent
+setlocal cindent