Add formatters
This commit is contained in:
parent
4d6215cfd3
commit
7903d53ba0
2 changed files with 19 additions and 8 deletions
2
home.nix
2
home.nix
|
|
@ -129,7 +129,7 @@ in
|
|||
# ./modules/bspwm.nix
|
||||
./modules/dircolors.nix
|
||||
./modules/direnv.nix
|
||||
./modules/dunst.nix
|
||||
# ./modules/dunst.nix
|
||||
# ./modules/fzf.nix
|
||||
./modules/git.nix
|
||||
./modules/go.nix
|
||||
|
|
|
|||
|
|
@ -115,29 +115,40 @@ in
|
|||
enable = true;
|
||||
highlightCursor = true;
|
||||
};
|
||||
keyMappings = [
|
||||
keyMappings = with pkgs; [
|
||||
{ mode = "normal"; docstring = "Edit file"; key = "<c-e>"; effect = ":edit<space>"; }
|
||||
{ mode = "user"; docstring = "Code actions"; key = "a"; effect = ":lsp-code-actions<ret>"; }
|
||||
{ mode = "user"; docstring = "Comment block"; key = "b"; effect = ":comment-block<ret>"; }
|
||||
{ mode = "user"; docstring = "Comment line"; key = "l"; effect = ":comment-line<ret>"; }
|
||||
{ mode = "user"; docstring = "Copy to clipboard"; key = "y"; effect = "<a-|>${pkgs.xclip}/bin/xclip -i -selection clipboard<ret>"; }
|
||||
{ mode = "user"; docstring = "Format code"; key = "F"; effect = ":lsp-formatting-sync<ret>"; }
|
||||
{ mode = "user"; docstring = "Copy to clipboard"; key = "y"; effect = "<a-|>${xclip}/bin/xclip -i -selection clipboard<ret>"; }
|
||||
{ mode = "user"; docstring = "Format code with formatter"; key = "f"; effect = ":format<ret>"; }
|
||||
{ mode = "user"; docstring = "Format code with LSP"; key = "F"; effect = ":lsp-formatting-sync<ret>"; }
|
||||
{ mode = "user"; docstring = "Jump to definition"; key = "d"; effect = ":lsp-definition<ret>"; }
|
||||
{ mode = "user"; docstring = "Jump to type definition"; key = "t"; effect = ":lsp-type-definition<ret>"; }
|
||||
{ mode = "user"; docstring = "List project diagnostics"; key = "i"; effect = ":lsp-diagnostics<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (after)"; key = "P"; effect = "<a-!>${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (before)"; key = "p"; effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (after)"; key = "P"; effect = "<a-!>${xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Paste from clipboard (before)"; key = "p"; effect = "!${xclip}/bin/xclip -selection clipboard -o<ret>"; }
|
||||
{ mode = "user"; docstring = "Show hover info"; key = "q"; effect = ":lsp-hover<ret>"; }
|
||||
{ mode = "user"; docstring = "Spellcheck English"; key = "S"; effect = ":spell en<ret>"; }
|
||||
{ mode = "user"; docstring = "Spellcheck"; key = "s"; effect = ":spell "; }
|
||||
{ mode = "normal"; docstring = "Try next snippet placeholder"; key = "<c-n>"; effect = "<a-;>: insert-c-n<ret>"; }
|
||||
];
|
||||
hooks = [
|
||||
hooks = with pkgs; [
|
||||
{ name = "BufCreate"; option = ".*"; commands = "editorconfig-load"; }
|
||||
{ name = "ModuleLoaded"; option = "auto-pairs"; commands = "auto-pairs-enable"; }
|
||||
{ name = "ModuleLoaded"; option = "powerline"; commands = builtins.concatStringsSep "\n" [ "powerline-enable" ]; }
|
||||
# { name = "WinSetOption"; option = "filetype=(rust|python|c|cpp|latex|javascript|go|nix)"; commands = builtins.concatStringsSep "\n" [ "lsp-enable-window" ]; }
|
||||
];
|
||||
] ++ (
|
||||
lib.optionals cfg.enableLatexSupport [
|
||||
{ name = "BufSetOption"; option = "filetype=latex"; commands = "set-option buffer formatcmd ${texlive.bin.latexindent}/bin/latexindent"; }
|
||||
|
||||
]
|
||||
) ++ (
|
||||
lib.optionals cfg.enableDataSupport [
|
||||
{ name = "BufSetOption"; option = "filetype=markdown"; commands = "set-option buffer formatcmd ${python3.pkgs.mdformat}/bin/mdformat"; }
|
||||
]
|
||||
);
|
||||
# TODO add more formatters from https://github.com/mawww/kakoune/wiki/Format
|
||||
};
|
||||
extraConfig = builtins.concatStringsSep "\n" [
|
||||
"# Custom commands"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue