{ config, systemConfig, pkgs, lib, ... }: { options.programs.micro.lsp-servers = lib.mkOption { default = { }; type = lib.types.attrsOf ( lib.types.submodule { options = { command = lib.mkOption { type = lib.types.str; }; options = lib.mkOption { type = (pkgs.formats.json { }).type; default = { }; }; }; } ); }; config.programs.sherlock.settings.ignore = "Micro"; config.programs.micro = { enable = true; package = if systemConfig.modules.presets.graphical.enable then pkgs.micro-with-wl-clipboard else pkgs.micro; settings = { "*.nix".tabstospaces = true; "*.nix".tabmovement = true; "*.nix".tabsize = 2; "*.nim".tabstospaces = true; "*.nim".tabmovement = true; "*.nim".tabsize = 2; clipboard = "terminal"; scrollbar = true; eofnewline = false; wordwrap = true; softwrap = true; ignorecase = true; savehistory = false; "lsp.formatOnSave" = true; "lsp.tabcompletion" = true; "lsp.autocompleteDetails" = false; "lsp.server" = if systemConfig.modules.presets.graphical.enable != true then "" else (lib.concatMapAttrsStringSep "," ( name: value: lib.concatStringsSep "=" ( [ name value.command ] ++ (lib.optionals (lib.hasAttr "options" value) [ (builtins.toJSON (value.options)) ]) ) ) config.programs.micro.lsp-servers); }; }; config.home = { sessionVariables.EDITOR = "micro"; shellAliases.nano = "micro"; file = { # keybindings "${config.xdg.configHome}/micro/bindings.json".source = pkgs.writeText "micro-keybindings.json" ( builtins.toJSON { "Alt-," = "PreviousTab"; "Alt-." = "NextTab"; "Alt-Backspace" = "DeleteWordLeft"; "Alt-CtrlH" = "DeleteWordLeft"; "Alt-F" = "FindLiteral"; "Alt-[" = "DiffPrevious|CursorStart"; "Alt-]" = "DiffNext|CursorEnd"; "Alt-a" = "StartOfLine"; "Alt-b" = "WordLeft"; "Alt-c" = "RemoveAllMultiCursors"; "Alt-e" = "EndOfLine"; "Alt-f" = "WordRight"; "Alt-g" = "ToggleKeyMenu"; "Alt-m" = "SpawnMultiCursorSelect"; "Alt-n" = "SpawnMultiCursor"; "Alt-p" = "RemoveMultiCursor"; "Alt-x" = "SkipMultiCursor"; "Alt-{" = "ParagraphPrevious"; "Alt-}" = "ParagraphNext"; "AltDown" = "MoveLinesDown"; "AltLeft" = "StartOfTextToggle"; "AltRight" = "EndOfLine"; "AltShiftDown" = "SpawnMultiCursorDown"; "AltShiftLeft" = "SelectToStartOfTextToggle"; "AltShiftRight" = "SelectToEndOfLine"; "AltShiftUp" = "SpawnMultiCursorUp"; "AltUp" = "MoveLinesUp"; "Backspace" = "Backspace"; "Backtab" = "OutdentSelection|OutdentLine"; "Ctrl-MouseLeft" = "MouseMultiCursor"; "Ctrl-a" = "SelectAll"; "Ctrl-b" = "ShellMode"; "Ctrl-c" = "Copy|CopyLine"; "Ctrl-d" = "DuplicateLine"; "Ctrl-e" = "CommandMode"; "Ctrl-f" = "Find"; "Ctrl-g" = "ToggleHelp"; "Ctrl-h" = "Backspace"; "Ctrl-j" = "PlayMacro"; "Ctrl-k" = "CutLine"; "Ctrl-l" = "command-edit:goto "; "Ctrl-n" = "FindNext"; "Ctrl-o" = "OpenFile"; "Ctrl-p" = "FindPrevious"; "Ctrl-q" = "Quit"; "Ctrl-r" = "ToggleRuler"; "Ctrl-s" = "Save"; "Ctrl-t" = "AddTab"; "Ctrl-u" = "ToggleMacro"; "Ctrl-v" = "Paste"; "Ctrl-w" = "NextSplit"; "Ctrl-x" = "Cut|CutLine"; "Ctrl-y" = "Redo"; "Ctrl-z" = "Undo"; "CtrlDown" = "CursorEnd"; "CtrlEnd" = "CursorEnd"; "CtrlHome" = "CursorStart"; "CtrlPageDown" = "NextTab"; "CtrlPageUp" = "PreviousTab"; "AltPageDown" = "NextTab"; "AltPageUp" = "PreviousTab"; "CtrlShiftDown" = "SelectToEnd"; "CtrlShiftLeft" = "SelectWordLeft"; "CtrlShiftRight" = "SelectWordRight"; "CtrlShiftUp" = "SelectToStart"; "CtrlUp" = "CursorStart"; "Delete" = "Delete"; "Down" = "CursorDown"; "End" = "EndOfLine"; "Enter" = "InsertNewline"; "Esc" = "Escape"; "F10" = "Quit"; "F2" = "Save"; "F3" = "Find"; "F4" = "Quit"; "F7" = "Find"; "Home" = "StartOfText"; "Insert" = "ToggleOverwriteMode"; "Left" = "CursorLeft"; "MouseLeft" = "MousePress"; "MouseLeftDrag" = "MouseDrag"; "MouseLeftRelease" = "MouseRelease"; "MouseMiddle" = "PastePrimary"; "MouseWheelDown" = "ScrollDown"; "MouseWheelUp" = "ScrollUp"; "PageDown" = "CursorPageDown"; "PageUp" = "CursorPageUp"; "Right" = "CursorRight"; "ShiftDown" = "SelectDown"; "ShiftEnd" = "SelectToEndOfLine"; "ShiftHome" = "SelectToStartOfTextToggle"; "ShiftLeft" = "SelectLeft"; "ShiftPageDown" = "SelectPageDown"; "ShiftPageUp" = "SelectPageUp"; "ShiftRight" = "SelectRight"; "ShiftUp" = "SelectUp"; "Tab" = "Autocomplete|IndentSelection|InsertTab"; "Up" = "CursorUp"; # plugins "Alt-/" = "lua:comment.comment"; "Alt-d" = "command:definition"; # "Alt-f" = "command:format"; "Alt-k" = "command:hover"; "Alt-r" = "command:references"; "CtrlSpace" = "command:lspcompletion"; "CtrlUnderscore" = "lua:comment.comment"; "F1" = "command:cheat"; # "F4" = "command:jumptag"; "F5" = "lua:wc.wordCount"; } ); # plugins "${config.xdg.configHome}/micro/plug/lsp".source = pkgs.fetchFromGitHub { owner = "AndCake"; repo = "micro-plugin-lsp"; rev = "v0.6.3"; sha256 = "sha256-rZ9Vw9WPGNaJBGHKU40F6cBIYQ1JFtSKPDrheazKkPY="; }; "${config.xdg.configHome}/micro/plug/detectindent".source = pkgs.fetchFromGitHub { owner = "dmaluka"; repo = "micro-detectindent"; rev = "v1.1.0"; sha256 = "sha256-5bKEkOnhz0pyBR2UNw5vvYiTtpd96fBPTYW9jnETvq4="; }; "${config.xdg.configHome}/micro/plug/wc".source = pkgs.fetchFromGitHub { owner = "adamnpeace"; repo = "micro-wc-plugin"; rev = "b2c9957e521770eadc1ecae9d54c0a30f40a0a3d"; sha256 = "sha256-Z6MC2cet8+7XHv41G+SlAZViCqlh/9dk0CSt7HklnTg="; }; }; }; }