Add some aliases to kitty

This commit is contained in:
Natsu Kagami 2025-04-08 09:52:34 +02:00
parent c5623b5174
commit 4b53af1bf1
Signed by: nki
GPG key ID: 55A032EB38B49ADB
4 changed files with 94 additions and 66 deletions

View file

@ -173,6 +173,7 @@ in
cat = "bat --theme=GitHub ";
catp = "bat --theme=GitHub -p ";
l = "exa -l --color=always ";
e = "$EDITOR";
"cp+" = "rsync -avzP";
};
@ -207,13 +208,6 @@ in
echo (__original_fish_title) - fish
end
# Set up an editor alias
if test -n "$EDITOR"
alias e="$EDITOR"
else
alias e="kak"
end
# Source iTerm2 integration
if test -e ~/.iterm2_shell_integration.fish; and test $__CFBundleIdentifier = "com.googlecode.iterm2"
source ~/.iterm2_shell_integration.fish

View file

@ -32,7 +32,6 @@ in
# Rebind $VISUAL, $EDITOR and e command
set -gx VISUAL "kak -c $kak_session"
set -gx EDITOR "kak -c $kak_session"
alias e="kak -c $kak_session"
'';
kill-kak-session = ''
@ -47,7 +46,6 @@ in
# Rebind $VISUAL, $EDITOR and e command
set -gx VISUAL "kak"
set -gx EDITOR "kak"
alias e="kak"
'';
};
programs.fish.tide = {

View file

@ -76,11 +76,11 @@ with lib;
};
};
config.linux.graphical = mkIf (cfg.enable && cfg.setDefault) {
config = mkIf cfg.enable {
linux.graphical = mkIf cfg.setDefault {
defaults.terminal.package = cfg.package;
};
config.programs.kitty = mkIf cfg.enable {
programs.kitty = {
enable = true;
package = cfg.package;
@ -129,8 +129,10 @@ with lib;
## Clear screen
"${cfg.cmd}+backspace" = "clear_terminal to_cursor active";
"${cfg.cmd}+shift+backspace" = "clear_terminal reset active";
## Hints
"${cfg.cmd}+shift+p>n" = "kitten hints --type=linenum --linenum-action=tab kak {path} +{line}";
## Command scrolling
"${cfg.cmd}+shift+j" = "scroll_to_prompt 1";
"${cfg.cmd}+shift+k" = "scroll_to_prompt -1";
};
extraConfig =
@ -145,4 +147,35 @@ with lib;
include ${glyphMap}
'';
};
# Open protocol
xdg.configFile."kitty/open-actions.conf".text = ''
protocol file
fragment_matches [0-9]+
action launch --type=overlay --cwd=current -- $\{EDITOR} +$\{FRAGMENT} -- $\{FILE_PATH}
# Open HTML files with xdg-open
protocol file
mime text/html
action launch xdg-open $\{FILE_PATH}
# Open text files without fragments in the editor
protocol file
mime text/*
action launch --type=overlay --cwd=current -- $\{EDITOR} -- $\{FILE_PATH}
# Open other files with xdg-open
protocol file
action launch xdg-open $\{FILE_PATH}
'';
programs.fish.shellAliases = {
e = lib.mkForce "kitten edit-in-kitty";
"ssh+" = "kitten ssh";
"clip" = "kitten clipboard";
"rg" = "kitten hyperlinked-grep";
"icat" = "kitten icat";
"notify" = "kitten notify";
};
};
}

View file

@ -115,6 +115,9 @@
services.dbus.packages = with pkgs; [ gcr ];
services.avahi.enable = true;
networking.firewall.allowedTCPPorts = [ 8010 ];
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];