diff --git a/config/kakoune/config.kak b/config/kakoune/config.kak index 6603bf3..2dce93d 100644 --- a/config/kakoune/config.kak +++ b/config/kakoune/config.kak @@ -68,21 +68,37 @@ map global normal '' '(?Si)' map global normal X x_ # Tab jumps to next snippet entry by default in insert mode -map global insert ':lsp-snippets-select-next-placeholdersi' -map global insert ':lsp-snippets-select-next-placeholdersi' +# map global insert ':lsp-snippets-select-next-placeholdersi' +# map global insert ':lsp-snippets-select-next-placeholdersi' # When completion menu shows, remap tab to cycle completions — but only if not in a snippet +# hook global InsertCompletionShow .* %{ +# try %{ +# execute-keys -draft 'h\h' +# try %{ +# eval %sh{ [ -n '${kak_opt_lsp_snippets_placeholder_groups}' ] && echo 'fail' } +# map window insert +# map window insert +# hook -once -always window InsertCompletionHide .* %{ +# unmap window insert +# unmap window insert +# } +# } +# } +# } + hook global InsertCompletionShow .* %{ try %{ + # this command temporarily removes cursors preceded by whitespace; + # if there are no cursors left, it raises an error, does not + # continue to execute the mapping commands, and the error is eaten + # by the `try` command so no warning appears. execute-keys -draft 'h\h' - try %{ - eval %sh{ [ -n '${kak_opt_lsp_snippets_placeholder_groups}' ] && echo 'fail' } - map window insert - map window insert - hook -once -always window InsertCompletionHide .* %{ - unmap window insert - unmap window insert - } + map window insert + map window insert + hook -once -always window InsertCompletionHide .* %{ + unmap window insert + unmap window insert } } } diff --git a/config/kakoune/config.nix b/config/kakoune/config.nix index 5185951..1c895b7 100644 --- a/config/kakoune/config.nix +++ b/config/kakoune/config.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: { imports = [ ./colors.nix ]; @@ -19,6 +19,7 @@ (builtins.readFile ./colemak.kak) (builtins.readFile ./config.kak) (builtins.readFile ./plugins.kak) + "map global window-mode t ':kitty-terminal-window ${config.shellpath}' -docstring 'create terminal window'" ]; plugins = import ./plugins.nix { inherit pkgs lib; }; diff --git a/config/kitty/config.nix b/config/kitty/config.nix index 5e37bad..c074203 100644 --- a/config/kitty/config.nix +++ b/config/kitty/config.nix @@ -11,8 +11,18 @@ in package = pkgs.aporetic-bin; size = 16; }; + + keybindings = { + "kitty_mod+n" = "previous_window"; + "kitty_mod+e" = "next_window"; + "kitty_mod+shift+n" = "move_window_backward"; + "kitty_mod+shift+e" = "move_window_forward"; + "kitty_mod+enter" = "new_window"; + }; + settings = { - shell = "${config.home.homeDirectory}/.nix-profile/bin/bash"; + shell = config.shellpath; + kitty_mod = "alt"; cursor_shape = "beam"; cursor_shape_unfocused = "unchanged"; cursor_stop_blinking_after = 0; @@ -27,11 +37,6 @@ in tab_bar_style = "separator"; tab_bar_align = "center"; tab_separator = " | "; - active_tab_background = "#${c.base08}"; - active_tab_font_style = "bold"; - inactive_tab_foreground = "#${c.base06}"; - inactive_tab_background = "#${c.base07}"; - tab_bar_background = "#${c.base07}"; tab_bar_margin_width = 24; tab_bar_margin_height = "14 0"; notify_on_cmd_finish = "unfocused 60"; @@ -49,6 +54,12 @@ in selection_background = "#${c.base02}"; selection_foreground = "#${c.base05}"; + active_tab_background = "#${c.base08}"; + active_tab_font_style = "bold"; + inactive_tab_foreground = "#${c.base06}"; + inactive_tab_background = "#${c.base07}"; + tab_bar_background = "#${c.base07}"; + color0 = "#${c.base00}"; color1 = "#${c.base08}"; color2 = "#${c.base0B}"; @@ -58,8 +69,8 @@ in color6 = "#${c.base0C}"; color7 = "#${c.base05}"; - color8 = "#${c.base03}"; - color9 = "#${c.base08}"; + color8 = "#${c.base03}"; + color9 = "#${c.base08}"; color10 = "#${c.base0B}"; color11 = "#${c.base0A}"; color12 = "#${c.base0D}"; diff --git a/config/shell/config.nix b/config/shell/config.nix index cba9604..4cd18a8 100644 --- a/config/shell/config.nix +++ b/config/shell/config.nix @@ -1,62 +1,70 @@ -{ pkgs, lib, ... }: +{ config, pkgs, lib, ... }: { - programs.bash.enable = true; - programs.bat = { - enable = true; - extraPackages = with pkgs.bat-extras; [ batdiff batman ]; + options.shellpath = lib.mkOption { + type = lib.types.str; + default = "${config.home.homeDirectory}/.nix-profile/bin/bash"; + description = "Local path to shell"; }; - programs.eza = { - enable = true; - icons = null; - }; - programs.starship = { - enable = true; - settings = { - format = lib.concatStringsSep " " [ - "$nix_shell" - "$directory" - "$git_branch" - "$git_status" - "$git_commit" - "$status" - "$fill" - "$lua" - "$rust" - "$golang" - "$haskell" - "$jobs" - "$cmd_duration" - "$line_break" - "$character"]; - nix_shell.format = "[nix]($style)"; - directory.truncation_length = 2; - git_branch = { - format = "[$branch(:$remote_branch)]($style)"; - ignore_branches = ["master" "main"]; - }; - git_status.format = "([\\[$all_status$ahead_behind\\]]($style))"; - git_commit.format = "[\\[#$hash$tag\\]]($style)"; - status = { - format = "[\\[$status\\]]($style)"; - disabled = false; - }; - fill.symbol = " "; - lua = { - format = "[($version)]($style)"; - version_format = "$major.$minor"; - detect_files = [".lua-version" ".luarc.json"]; - }; - rust = { - format = "[($version)]($style)"; - version_format = "$major.$minor"; - }; - haskell.format = "[($ghc_version)]($style)"; - cmd_duration.format = "[$duration]($style) "; - character = { - success_symbol = "[>](bold #a6e3a1)"; - error_symbol = "[>](bold #f38ba8)"; + config = { + programs.bash.enable = true; + programs.bat = { + enable = true; + extraPackages = with pkgs.bat-extras; [ batdiff batman ]; + }; + programs.eza = { + enable = true; + icons = null; + }; + programs.starship = { + enable = true; + settings = { + format = lib.concatStringsSep " " [ + "$nix_shell" + "$directory" + "$git_branch" + "$git_status" + "$git_commit" + "$status" + "$fill" + "$lua" + "$rust" + "$golang" + "$haskell" + "$jobs" + "$cmd_duration" + "$line_break" + "$character"]; + + nix_shell.format = "[nix]($style)"; + directory.truncation_length = 2; + git_branch = { + format = "[$branch(:$remote_branch)]($style)"; + ignore_branches = ["master" "main"]; + }; + git_status.format = "([\\[$all_status$ahead_behind\\]]($style))"; + git_commit.format = "[\\[#$hash$tag\\]]($style)"; + status = { + format = "[\\[$status\\]]($style)"; + disabled = false; + }; + fill.symbol = " "; + lua = { + format = "[($version)]($style)"; + version_format = "$major.$minor"; + detect_files = [".lua-version" ".luarc.json"]; + }; + rust = { + format = "[($version)]($style)"; + version_format = "$major.$minor"; + }; + haskell.format = "[($ghc_version)]($style)"; + cmd_duration.format = "[$duration]($style) "; + character = { + success_symbol = "[>](bold #a6e3a1)"; + error_symbol = "[>](bold #f38ba8)"; + }; }; }; }; diff --git a/config/yazi/config.nix b/config/yazi/config.nix new file mode 100644 index 0000000..dc278b9 --- /dev/null +++ b/config/yazi/config.nix @@ -0,0 +1,79 @@ +{ pkgs, ... }: +{ + programs.yazi = { + enable = true; + keymap = { + mgr.prepend_keymap = [ + { run = "arrow -1"; on = [ "e" ]; } + { run = "arrow 1"; on = [ "n" ]; } + { run = "arrow -5"; on = [ "E" ]; } + { run = "arrow 5"; on = [ "N" ]; } + { run = "leave"; on = [ "h" ]; } + { run = "enter"; on = [ "i" ]; } + { run = "back"; on = [ "H" ]; } + { run = "forward"; on = [ "I" ]; } + { run = "seek -5"; on = [ "" ]; } + { run = "seek 5"; on = [ "" ]; } + { run = "link"; on = [ "k" ]; } + { run = "link --relative"; on = [ "K" ]; } + { run = "find_arrow"; on = [ "j" ]; } + { run = "find_arrow --previous"; on = [ "J" ]; } + ]; + + tasks.prepend_keymap = [ + { run = "close"; on = [ "W" ]; } + { run = "arrow -1"; on = [ "e" ]; } + { run = "arrow 1"; on = [ "n" ]; } + ]; + + spot.prepend_keymap = [ + { run = "arrow -1"; on = [ "e" ]; } + { run = "arrow 1"; on = [ "n" ]; } + { run = "arrow -5"; on = [ "E" ]; } + { run = "arrow 5"; on = [ "N" ]; } + ]; + + input.prepend_keymap = [ + { run = "insert"; on = [ "l" ]; } + { run = [ "move -999" "insert" ]; on = [ "" ]; } + { run = [ "move 999" "insert --append" ]; on = [ "" ]; } + { run = "move -1"; on = [ "h" ]; } + { run = "move 1"; on = [ "i" ]; } + { run = "forward --end-of-word"; on = [ "=" ]; } + { run = "move -999"; on = [ "H" ]; } + { run = "move 999"; on = [ "I" ]; } + { run = [ "delete" "move 1 --in-operating" ]; on = [ "x" ]; } + { run = "undo"; on = [ "u" ]; } + { run = "redo"; on = [ "U" ]; } + ]; + + cmp.prepend_keymap = [ + { run = "arrow -1"; on = [ "" ]; } + { run = "arrow 1"; on = [ "" ]; } + ]; + + help.prepend_keymap = [ + { run = "arrow -1"; on = [ "e" ]; } + { run = "arrow 1"; on = [ "n" ]; } + { run = "arrow -5"; on = [ "E" ]; } + { run = "arrow 5"; on = [ "N" ]; } + ]; + }; + + settings = { + mgr = { + sort_by = "mtime"; + sort_reverse = true; + show_hidden = true; + linemode = "size"; + scrolloff = 12; + ratio = [ 1 2 0 ]; + }; + opener = { + edit = [ + { run = "kak %s"; block = true; for = "unix"; } + ]; + }; + }; + }; +} diff --git a/flake.nix b/flake.nix index 1980717..5dedab2 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ outputs = { nixpkgs, home-manager, nix-colors, ... }: let - system = "aarch64-darwin"; + system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; in { diff --git a/home.nix b/home.nix index 03da97c..0dfff8c 100644 --- a/home.nix +++ b/home.nix @@ -5,12 +5,16 @@ home.homeDirectory = if pkgs.stdenv.hostPlatform.isDarwin then "/Users/venomade" else "/home/venomade"; + targets.genericLinux.enable = true; + targets.genericLinux.gpu.enable = true; + imports = [ ./config/programming/config.nix ./config/colors/config.nix ./config/shell/config.nix ./config/kakoune/config.nix ./config/kitty/config.nix + ./config/yazi/config.nix ]; home.stateVersion = "26.05";