~gpanders/dotfiles

e3d3e517f91684e9bb3caf3f66ef3f3c2efa603d — Greg Anders 2 years ago b4cf2e9
[vim] Improve compiler options for python and shell scripts
M vim/.vim/after/ftplugin/python.vim => vim/.vim/after/ftplugin/python.vim +3 -0
@@ 7,3 7,6 @@ setlocal keywordprg=pydoc

" gz opens a split window with a python shell
nmap <buffer> gz <Plug>(PytermOpen)

" Use pytest compiler by default
compiler pytest

M vim/.vim/after/ftplugin/sh.vim => vim/.vim/after/ftplugin/sh.vim +2 -0
@@ 6,3 6,5 @@ endif
" Z! execute line as shell command
" Inspired by the Shdo buffers from vim-dirvish
nnoremap <buffer> Z! ^"zyg_:!<C-R>z<CR>

compiler shellcheck

M vim/.vim/after/plugin/dispatch.vim => vim/.vim/after/plugin/dispatch.vim +9 -5
@@ 2,9 2,13 @@ if !exists('g:loaded_dispatch')
  finish
endif

" C/C++
autocmd FileType c,cpp let b:dispatch = 'cppcheck %'
augroup Dispatch
  autocmd!

" Python
autocmd FileType python let b:start = 'python'
autocmd FileType python let b:dispatch = 'pylint -f parseable %'
  " C/C++
  autocmd FileType c,cpp let b:dispatch = 'cppcheck %:S'

  " " Python
  autocmd FileType python let b:start = 'ipython'
                      \ | let b:dispatch = 'pylint -f parseable -s no -- %:S'
augroup END

M vim/.vim/after/plugin/qf.vim => vim/.vim/after/plugin/qf.vim +2 -0
@@ 10,3 10,5 @@ nmap [q <Plug>(qf_qf_previous)
nmap ]q <Plug>(qf_qf_next)
nmap [l <Plug>(qf_loc_previous)
nmap ]l <Plug>(qf_loc_next)

nmap <C-Q> <Plug>(qf_qf_toggle)

A vim/.vim/compiler/bash.vim => vim/.vim/compiler/bash.vim +2 -0
@@ 0,0 1,2 @@
CompilerSet makeprg=bash\ -n\ --\ %:S
CompilerSet errorformat=%f:\ line\ %l:\ %m

A vim/.vim/compiler/pytest.vim => vim/.vim/compiler/pytest.vim +37 -0
@@ 0,0 1,37 @@
" Vim compiler file
" Compiler: Py.test <http://pytest.org/>
" Maintainer: Whyme Lyu <5longluna at gmail.com>
" URL: https://github.com/5long/pytest-vim-compiler

if exists("current_compiler")
  finish
endif
let current_compiler = "pytest"

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
  command -nargs=* CompilerSet setlocal <args>
endif

let s:cpo_save = &cpo
set cpo-=C

CompilerSet makeprg=py.test\ --tb=short\ -q

CompilerSet errorformat=
      \%-G=%#\ ERRORS\ =%#,
      \%-G=%#\ FAILURES\ =%#,
      \%-G%\\s%\\*%\\d%\\+\ tests\ deselected%.%#,
      \ERROR:\ %m,
      \%E_%\\+\ %m\ _%\\+,
      \%Cfile\ %f\\,\ line\ %l,
      \%CE\ %#%m,
      \%EE\ \ \ \ \ File\ \"%f\"\\,\ line\ %l,
      \%ZE\ \ \ %[%^\ ]%\\@=%m,
      \%Z%f:%l:\ %m,
      \%Z%f:%l,
      \%C%.%#,
      \%-G%.%#\ seconds,
      \%-G%.%#,

let &cpo = s:cpo_save
unlet s:cpo_save

A vim/.vim/compiler/shellcheck.vim => vim/.vim/compiler/shellcheck.vim +2 -0
@@ 0,0 1,2 @@
CompilerSet makeprg=shellcheck\ -f\ gcc\ --\ %:S
CompilerSet errorformat=%f:%l:%c:\ %m\ [SC%n]