diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-04 22:40:03 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-04 22:40:03 +1300 |
commit | 09f8635dcd7d5a459b7d4b38482b2e1fece607b0 (patch) | |
tree | ad69a45ffecdb890f33258077ea9a884c84c611a | |
parent | Merge branch 'feature/space-dots' into develop (diff) | |
download | dotfiles-09f8635dcd7d5a459b7d4b38482b2e1fece607b0.tar.gz dotfiles-09f8635dcd7d5a459b7d4b38482b2e1fece607b0.zip |
Simplify shell linting code with single vars
Put the entire command line for the determined check and lint into the
variable, so it can just be directly executed.
-rw-r--r-- | vim/ftplugin/sh.vim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vim/ftplugin/sh.vim b/vim/ftplugin/sh.vim index ae1974a0..d13f34da 100644 --- a/vim/ftplugin/sh.vim +++ b/vim/ftplugin/sh.vim @@ -27,24 +27,24 @@ endif " Map checker based on shell family if exists('b:is_bash') && b:is_bash - let b:check = 'bash -n' + let b:check = 'write !bash -n' elseif exists('b:is_ksh') && b:is_ksh - let b:check = 'ksh -n' + let b:check = 'write !ksh -n' else - let b:check = 'sh -n' + let b:check = 'write !sh -n' endif nnoremap <buffer> <silent> \ <LocalLeader>c - \ :<C-U>execute ':write !' . b:check<CR> + \ :<C-U>execute b:check<CR> " Map linter based on shell family if exists('b:is_bash') && b:is_bash - let b:lint = 'shellcheck -s bash -' + let b:lint = 'write shellcheck -s bash -' elseif exists('b:is_ksh') && b:is_ksh - let b:lint = 'shellcheck -s ksh -' + let b:lint = 'write !shellcheck -s ksh -' else - let b:lint = 'shellcheck -s sh -' + let b:lint = 'write !shellcheck -s sh -' endif nnoremap <buffer> <silent> \ <LocalLeader>l - \ :<C-U>execute ':write !' . b:lint<CR> + \ :<C-U>execute b:lint<CR> |