mirror of
https://github.com/luzifer/vim.git
synced 2024-11-09 16:10:00 +00:00
Automatically execute shfmt on shell script save
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
2fff453c3b
commit
3d2466581a
2 changed files with 11 additions and 0 deletions
10
after/plugin/shfmt.vim
Normal file
10
after/plugin/shfmt.vim
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
if exists('g:loaded_shfmt_wrapper')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_shfmt_wrapper = 1
|
||||||
|
|
||||||
|
function! SHFmt()
|
||||||
|
let save_pos = getpos(".")
|
||||||
|
execute "%!shfmt -s"
|
||||||
|
call setpos(".", save_pos)
|
||||||
|
endfunction
|
1
vimrc
1
vimrc
|
@ -1025,6 +1025,7 @@ let g:go_autodetect_gopath = 0
|
||||||
"
|
"
|
||||||
|
|
||||||
au BufWritePre *.py,*.js :Autoformat
|
au BufWritePre *.py,*.js :Autoformat
|
||||||
|
au FileType sh au BufWritePre <buffer> :call SHFmt()
|
||||||
|
|
||||||
"
|
"
|
||||||
" Custom commands
|
" Custom commands
|
||||||
|
|
Loading…
Reference in a new issue