Add simple formatting tools

This commit is contained in:
Loic Nageleisen 2023-03-07 09:50:29 +01:00
parent 42ba3d457f
commit eb60df1903
Signed by: lloeki
GPG key ID: D05DAEE6889F94C2

16
vimrc
View file

@ -261,6 +261,22 @@ augroup vimrc
autocmd! BufNewFile,BufRead crontab.* setl nobackup | setl nowritebackup " Fix for crontab -e autocmd! BufNewFile,BufRead crontab.* setl nobackup | setl nowritebackup " Fix for crontab -e
augroup END augroup END
" Formatting
function! FormatJSON()
execute ":'<,'>! jq"
endfunction
map <leader>fj :call FormatJSON()<CR>
function! FormatColumnize()
execute "'<,'>! column -t"
endfunction
map <leader>fc :call FormatColumnize()<CR>
function! FormatSort()
execute "'<,'>! sort"
endfunction
map <leader>fs :call FormatSort()<CR>
" Go tools path " Go tools path
let g:go_bin_path = expand('$HOME') . "/.local/libexec/go/bin" let g:go_bin_path = expand('$HOME') . "/.local/libexec/go/bin"