use custom zellij keybindings instead of tmux, old version of fish

This commit is contained in:
sloane 2025-02-18 10:35:54 -05:00
parent be3150c1dd
commit 03fc240bb4
Signed by: sloanelybutsurely
SSH key fingerprint: SHA256:8SBnwhl+RY3oEyQxy1a9wByPzxWM0x+/Ejc+sIlY5qQ
6 changed files with 136 additions and 59 deletions

View file

@ -249,22 +249,6 @@
"type": "github"
}
},
"nixpkgs-old-fish": {
"locked": {
"lastModified": 1703624527,
"narHash": "sha256-e5XNMNJ2Z61MEnXeMbGkLqWr0FfgH3y5X+9nV15pJak=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c407032be28ca2236f45c49cfb2b8b3885294f7f",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c407032be28ca2236f45c49cfb2b8b3885294f7f",
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
@ -321,7 +305,6 @@
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs",
"nixpkgs-old-fish": "nixpkgs-old-fish",
"nixvim": "nixvim"
}
},

View file

@ -3,7 +3,6 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-old-fish.url = "github:NixOS/nixpkgs/c407032be28ca2236f45c49cfb2b8b3885294f7f";
nix-darwin.url = "github:LnL7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
@ -12,13 +11,12 @@
nixvim.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs, nixpkgs-old-fish, home-manager, nixvim }:
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim }:
{
darwinConfigurations."tid27880sperrau" = nix-darwin.lib.darwinSystem {
modules = [
{
system.configurationRevision = self.rev or self.dirtyRev or null;
programs.fish.package = nixpkgs-old-fish.legacyPackages.aarch64-darwin.fish;
}
./nix-darwin
./nix-darwin/hosts/tid27880sperrau
@ -31,7 +29,6 @@
backupFileExtension = "before-home-manager";
extraSpecialArgs = {
inherit nixvim;
inherit nixpkgs-old-fish;
};
users.sperrault = import ./home-manager/users/sperrault.nix;
};

View file

@ -13,9 +13,9 @@
};
packages = with pkgs; [
watchman
difftastic
maple-mono-NF
ripgrep
watchman
];
};
@ -34,11 +34,8 @@
interactiveShellInit = ''
fish_vi_key_bindings
# start or attach to default tmux session
if not set -q TMUX
set -g TMUX tmux new-session -d -s default
eval $TMUX
tmux attach-session -d -t default
if not set -q ZELLIJ
zellij attach --create default
end
'';
shellAbbrs = {
@ -59,26 +56,91 @@
enableFishIntegration = true;
};
programs.tmux = {
programs.zellij = {
enable = true;
keyMode = "vi";
mouse = true;
prefix = "C-a";
sensibleOnTop = true;
plugins = with pkgs.tmuxPlugins; [
prefix-highlight
vim-tmux-navigator
catppuccin
];
extraConfig = ''
set -g @catppuccin_flavor 'frappe'
enableFishIntegration = false;
};
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
home.file.".config/zellij/config.kdl" = {
enable = true;
text = ''
pane_frames false
theme "catppuccin-mocha"
set -gu default-command
set -g default-shell "$SHELL"
ui {
pane_frames {
hide_session_name true
}
}
keybinds clear-defaults=true {
normal {
bind "Ctrl a" { SwitchToMode "tmux"; }
}
tmux {
bind "Esc" { SwitchToMode "Normal"; }
bind "1" { GoToTab 1; SwitchToMode "Normal"; }
bind "2" { GoToTab 2; SwitchToMode "Normal"; }
bind "3" { GoToTab 3; SwitchToMode "Normal"; }
bind "4" { GoToTab 4; SwitchToMode "Normal"; }
bind "5" { GoToTab 5; SwitchToMode "Normal"; }
bind "6" { GoToTab 6; SwitchToMode "Normal"; }
bind "7" { GoToTab 7; SwitchToMode "Normal"; }
bind "8" { GoToTab 8; SwitchToMode "Normal"; }
bind "9" { GoToTab 9; SwitchToMode "Normal"; }
bind "c" { NewTab; SwitchToMode "Normal"; }
bind "n" { GoToNextTab; SwitchToMode "Normal"; }
bind "p" { GoToPreviousTab; SwitchToMode "Normal"; }
bind "h" { MoveFocus "Left"; }
bind "j" { MoveFocus "Down"; }
bind "k" { MoveFocus "Up"; }
bind "l" { MoveFocus "Right"; }
bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
bind "d" { Detach; }
bind "\"" { NewPane "Down"; SwitchToMode "Normal"; }
bind "%" { NewPane "Right"; SwitchToMode "Normal"; }
}
shared_except "locked" {
bind "Ctrl h" {
MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" {
name "move_focus_or_tab";
payload "left";
move_mod "ctrl";
};
}
bind "Ctrl j" {
MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" {
name "move_focus";
payload "down";
move_mod "ctrl";
};
}
bind "Ctrl k" {
MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" {
name "move_focus";
payload "up";
move_mod "ctrl";
};
}
bind "Ctrl l" {
MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" {
name "move_focus_or_tab";
payload "right";
move_mod "ctrl";
};
}
}
}
'';
};

View file

@ -23,6 +23,11 @@
action = ":";
mode = ["n" "v"];
}
{
key = "q;";
action = "q:";
mode = ["n" "v"];
}
{
key = "<leader>y";
action = ''"+y'';
@ -88,6 +93,26 @@
action = "<cmd>Telescope live_grep<cr>";
mode = ["n"];
}
{
key = "<C-h>";
action = "<cmd>ZellijNavigateLeft<cr>";
mode = ["n"];
}
{
key = "<C-j>";
action = "<cmd>ZellijNavigateDown<cr>";
mode = ["n"];
}
{
key = "<C-k>";
action = "<cmd>ZellijNavigateUp<cr>";
mode = ["n"];
}
{
key = "<C-l>";
action = "<cmd>ZellijNavigateRight<cr>";
mode = ["n"];
}
];
extraPlugins = with pkgs.vimPlugins; [
@ -119,6 +144,7 @@
vim
yaml
elixir
heex
javascript
typescript
css
@ -146,39 +172,47 @@
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "snippy"; }
{ name = "path"; }
{ name = "buffer"; }
];
mappings = {
"<C-n>" = ''
cmp.mapping(function()
function(fallback) do
if cmp.visible() then
cmp.select_next_item({behavior = 'insert'})
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
else
cmp.complete()
fallback()
end
end)
end
'';
"<C-p>" = ''
cmp.mapping(function()
function(fallback) do
if cmp.visible() then
cmp.select_prev_item({behavior = 'insert'})
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
else
cmp.complete()
fallback()
end
end)
end
'';
"<CR>" = ''
function(fallback)
if cmp.visible() then
cmp.confirm({ select = true })
else
fallback()
end
end
'';
};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
require('snippy').expand_snippet(args.body)
end
'';
};
};
plugins.tmux-navigator.enable = true;
plugins.zellij-nav.enable = true;
};
}

View file

@ -1,7 +1,6 @@
{ nixpkgs-old-fish, ... }:
{ ... }:
{
imports = [ ../default.nix ];
programs.fish.package = nixpkgs-old-fish.legacyPackages.aarch64-darwin.fish;
home = {
username = "sperrault";
homeDirectory = "/Users/sperrault";

View file

@ -53,6 +53,8 @@
brews = [
"mas"
"openssl"
"wxwidgets"
];
casks = [