diff options
author | tdro <tdro@users.noreply.github.com> | 2023-06-06 18:20:46 -0400 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2023-06-06 18:20:46 -0400 |
commit | 4f0d32db753db660a2062578f67eb72e18dd634d (patch) | |
tree | 186b1973810c8f2888ff72cfa82675eb2b24bb51 | |
parent | 430d079e1c278ad430a66afc64f7f2c1e5a973cc (diff) | |
download | dotfiles-4f0d32db753db660a2062578f67eb72e18dd634d.tar.gz dotfiles-4f0d32db753db660a2062578f67eb72e18dd634d.tar.bz2 dotfiles-4f0d32db753db660a2062578f67eb72e18dd634d.zip |
.vim/vimrc: Update format programs
Use emacs from vim with emacs-batch-indent to format lisp code
-rw-r--r-- | .config/nixpkgs/config.nix | 12 | ||||
-rw-r--r-- | .config/nixpkgs/packages/emacs-batch-indent/default.nix | 30 | ||||
-rw-r--r-- | .vim/vimrc | 24 |
3 files changed, 53 insertions, 13 deletions
diff --git a/.config/nixpkgs/config.nix b/.config/nixpkgs/config.nix index 70dc24f..20e78b5 100644 --- a/.config/nixpkgs/config.nix +++ b/.config/nixpkgs/config.nix @@ -27,7 +27,7 @@ in paths = [ Terminal Graphical Xorg Wayland Awesome Fonts Audio LaTeX Dictionary Android JavaScript Python PHP Lua Elixir HTML Shell Haskell Perl Nix C Golang Rust CSS - SQL YAML Ruby Nim Themes Emulators Clojure Lisp + SQL YAML HTTP Ruby Nim Themes Emulators Clojure Lisp ]; }; @@ -66,8 +66,9 @@ in paths = [ (import ./shells/larynx/shell.nix).fhs (import ./shells/larynx-server/shell.nix).fhs - (callPackage ./packages/hugo/default.nix { }) (callPackage ./packages/chromexup/default.nix { }) + (callPackage ./packages/emacs-batch-indent/default.nix { }) + (callPackage ./packages/hugo/default.nix { }) (callPackage ./packages/pdf2htmlex/default.nix { }) (callPackage ./packages/rxvt-unicode/default.nix { }) (callPackage ./packages/systemd2nix/default.nix { }) @@ -84,7 +85,6 @@ in bat bind bleachbit - caddy cava csvkit curlftpfs @@ -452,6 +452,7 @@ in pygments pylint ])) + ruff ]; }; @@ -557,6 +558,11 @@ in paths = [ guile sbcl ]; }; + HTTP = pkgs.buildEnv { + name = "http"; + paths = [ caddy apacheHttpd ]; + }; + CSS = pkgs.buildEnv { name = "css"; paths = [ diff --git a/.config/nixpkgs/packages/emacs-batch-indent/default.nix b/.config/nixpkgs/packages/emacs-batch-indent/default.nix new file mode 100644 index 0000000..92042af --- /dev/null +++ b/.config/nixpkgs/packages/emacs-batch-indent/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchgit }: + +stdenv.mkDerivation rec { + + name = "emacs-batch-indent"; + version = "145e8771b9709a82e3df82cdc06c6d9505de905d"; + url = "https://github.com/cwfoo/emacs-batch-indent"; + + src = fetchgit { + inherit url; + rev = version; + sha256 = "sha256-Qqg/ZLbfTZnH2aO7ZW2XiiVBqEvK2+LMo2Kz6HSnOCE="; + }; + + phases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + runHook preInstall + mkdir --parents $out/bin + cp emacs-batch-indent $out/bin + runHook postInstall + ''; + + meta = with lib; { + homepage = url; + license = licenses.gpl3; + platforms = platforms.linux; + description = "Indent Common Lisp, Emacs Lisp, and Scheme from the command line using Emacs."; + }; +} @@ -292,7 +292,7 @@ augroup AutoCommands autocmd FileType markdown autocmd! BufWritePost <buffer> :only | :term ++rows=10 sh -c "cat % | vale --ext .md" autocmd FileType css autocmd! BufWritePost <buffer> exe 'Notify(''prettier --write --parser css ' . expand('%') . ' 2>&1'')' | :e autocmd FileType html autocmd! BufWritePost <buffer> exe 'Notify(''prettier --write --parser html ' . expand('%') . ' 2>&1'')' | :e - autocmd FileType python autocmd! BufWritePost <buffer> exe 'Notify(''black ' . expand('%') . ' 2>&1 && pylint ' . expand('%') . ' 2>&1'')' | :e + autocmd FileType python autocmd! BufWritePost <buffer> exe 'Notify(''ruff --no-cache ' . expand('%') . ' 2>&1 && black ' . expand('%') . ' 2>&1'')' | :e autocmd FileType nim autocmd! BufWritePost <buffer> exe 'Notify(''nimpretty ' . expand('%') . ' 2>&1 && printf "Nim OK: ' . expand('%') . '"'')' | :e autocmd FileType rust autocmd! BufWritePost <buffer> exe 'Notify(''rustfmt ' . expand('%') . ' 2>&1 && printf "rustfmt OK: ' . expand('%') . '"'')' | :e autocmd FileType json autocmd! BufWritePost <buffer> 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 <buffer> <leader>df :exe ':term ++rows=10 go doc ' . expand('<cexpr>')<cr> - autocmd FileType nix noremap <buffer> <leader>df :exe ':term ++rows=10 nixos-option ' . expand('<cexpr>')<cr> autocmd FileType elixir noremap <buffer> <leader>df :exe ':term ++rows=10 sh -c "echo ''h(' . expand('<cexpr>') . ')'' \| iex"'<cr> " REPL commands. + autocmd FileType bash noremap <buffer> <leader>cc :REPL bash -x<cr> + autocmd FileType elixir noremap <buffer> <leader>cc :REPL iex<cr> autocmd FileType go noremap <buffer> <leader>cc :REPL gore<cr> + autocmd FileType javascript noremap <buffer> <leader>cc :REPL node<cr> autocmd FileType lua noremap <buffer> <leader>cc :REPL lua<cr> - autocmd FileType php noremap <buffer> <leader>cc :REPL psysh<cr> - autocmd FileType elixir noremap <buffer> <leader>cc :REPL iex<cr> - autocmd FileType sh noremap <buffer> <leader>cc :REPL dash -x<cr> - autocmd FileType rust noremap <buffer> <leader>cc :REPL evcxr<cr> autocmd FileType nix noremap <buffer> <leader>cc :REPL nix repl<cr> - autocmd FileType bash noremap <buffer> <leader>cc :REPL bash -x<cr> - autocmd FileType python noremap <buffer> <leader>cc :REPL python<cr> autocmd FileType perl noremap <buffer> <leader>cc :REPL perl -de0<cr> - autocmd FileType javascript noremap <buffer> <leader>cc :REPL node<cr> + autocmd FileType php noremap <buffer> <leader>cc :REPL psysh<cr> + autocmd FileType python noremap <buffer> <leader>cc :REPL python<cr> + autocmd FileType rust noremap <buffer> <leader>cc :REPL evcxr<cr> + autocmd FileType scheme noremap <buffer> <leader>cc :REPL guile<cr> + autocmd FileType sh noremap <buffer> <leader>cc :REPL dash -x<cr> + autocmd FileType typescript noremap <buffer> <leader>cc :REPL deno<cr> autocmd FileType awk noremap <buffer> <leader>cc :term ++rows=10 ++close awk -f %<cr> " 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. |