From 4f0d32db753db660a2062578f67eb72e18dd634d Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 6 Jun 2023 18:20:46 -0400 Subject: .vim/vimrc: Update format programs Use emacs from vim with emacs-batch-indent to format lisp code --- .vim/vimrc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to '.vim') diff --git a/.vim/vimrc b/.vim/vimrc index 9d985ea..db24101 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -292,7 +292,7 @@ augroup AutoCommands autocmd FileType markdown autocmd! BufWritePost :only | :term ++rows=10 sh -c "cat % | vale --ext .md" autocmd FileType css autocmd! BufWritePost exe 'Notify(''prettier --write --parser css ' . expand('%') . ' 2>&1'')' | :e autocmd FileType html autocmd! BufWritePost exe 'Notify(''prettier --write --parser html ' . expand('%') . ' 2>&1'')' | :e - autocmd FileType python autocmd! BufWritePost exe 'Notify(''black ' . expand('%') . ' 2>&1 && pylint ' . expand('%') . ' 2>&1'')' | :e + autocmd FileType python autocmd! BufWritePost exe 'Notify(''ruff --no-cache ' . expand('%') . ' 2>&1 && black ' . expand('%') . ' 2>&1'')' | :e autocmd FileType nim autocmd! BufWritePost exe 'Notify(''nimpretty ' . expand('%') . ' 2>&1 && printf "Nim OK: ' . expand('%') . '"'')' | :e autocmd FileType rust autocmd! BufWritePost exe 'Notify(''rustfmt ' . expand('%') . ' 2>&1 && printf "rustfmt OK: ' . expand('%') . '"'')' | :e autocmd FileType json autocmd! BufWritePost exe 'Notify(''jsonlint -i ' . expand('%') . ' 2>&1 && printf "JSON OK: ' . expand('%') . '"'')' | :e @@ -326,21 +326,22 @@ augroup AutoCommands " File type function under cursor lookups. autocmd FileType go noremap df :exe ':term ++rows=10 go doc ' . expand('') - autocmd FileType nix noremap df :exe ':term ++rows=10 nixos-option ' . expand('') autocmd FileType elixir noremap df :exe ':term ++rows=10 sh -c "echo ''h(' . expand('') . ')'' \| iex"' " REPL commands. + autocmd FileType bash noremap cc :REPL bash -x + autocmd FileType elixir noremap cc :REPL iex autocmd FileType go noremap cc :REPL gore + autocmd FileType javascript noremap cc :REPL node autocmd FileType lua noremap cc :REPL lua - autocmd FileType php noremap cc :REPL psysh - autocmd FileType elixir noremap cc :REPL iex - autocmd FileType sh noremap cc :REPL dash -x - autocmd FileType rust noremap cc :REPL evcxr autocmd FileType nix noremap cc :REPL nix repl - autocmd FileType bash noremap cc :REPL bash -x - autocmd FileType python noremap cc :REPL python autocmd FileType perl noremap cc :REPL perl -de0 - autocmd FileType javascript noremap cc :REPL node + autocmd FileType php noremap cc :REPL psysh + autocmd FileType python noremap cc :REPL python + autocmd FileType rust noremap cc :REPL evcxr + autocmd FileType scheme noremap cc :REPL guile + autocmd FileType sh noremap cc :REPL dash -x + autocmd FileType typescript noremap cc :REPL deno autocmd FileType awk noremap cc :term ++rows=10 ++close awk -f % " Selective formatting using visual select + gq. @@ -348,9 +349,12 @@ augroup AutoCommands autocmd FileType sh set formatprg=shfmt\ - autocmd FileType typescriptreact set formatprg=deno\ fmt\ - autocmd FileType typescript set formatprg=deno\ fmt\ - + autocmd FileType python set formatprg=black\ --quiet\ - + autocmd FileType scheme set formatprg=emacs-batch-indent\ scheme + autocmd FileType css set formatprg=prettier\ --parser\ css\ --stdin-filepath\ % autocmd FileType html set formatprg=prettier\ --parser\ html\ --stdin-filepath\ % - autocmd FileType javascript set formatprg=swc\ compile\ --filename\ %\ \|\ tail\ --lines\ +2 autocmd FileType markdown set formatprg=prettier\ --parser\ markdown\ --stdin-filepath\ % + autocmd FileType javascript set formatprg=swc\ compile\ --filename\ %\ \|\ tail\ --lines\ +2 autocmd FileType ruby set formatprg=rubocop\ --autocorrect\ --stderr\ --stdin\ %\ 2>\ \/dev\/null " Set file types. -- cgit v1.2.3