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" "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": { "nixvim": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
@ -321,7 +305,6 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-old-fish": "nixpkgs-old-fish",
"nixvim": "nixvim" "nixvim": "nixvim"
} }
}, },

View file

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

View file

@ -13,9 +13,9 @@
}; };
packages = with pkgs; [ packages = with pkgs; [
watchman
difftastic difftastic
maple-mono-NF ripgrep
watchman
]; ];
}; };
@ -34,11 +34,8 @@
interactiveShellInit = '' interactiveShellInit = ''
fish_vi_key_bindings fish_vi_key_bindings
# start or attach to default tmux session if not set -q ZELLIJ
if not set -q TMUX zellij attach --create default
set -g TMUX tmux new-session -d -s default
eval $TMUX
tmux attach-session -d -t default
end end
''; '';
shellAbbrs = { shellAbbrs = {
@ -59,26 +56,91 @@
enableFishIntegration = true; enableFishIntegration = true;
}; };
programs.tmux = { programs.zellij = {
enable = true; enable = true;
keyMode = "vi"; enableFishIntegration = false;
mouse = true; };
prefix = "C-a";
sensibleOnTop = true;
plugins = with pkgs.tmuxPlugins; [
prefix-highlight
vim-tmux-navigator
catppuccin
];
extraConfig = ''
set -g @catppuccin_flavor 'frappe'
bind c new-window -c "#{pane_current_path}" home.file.".config/zellij/config.kdl" = {
bind '"' split-window -c "#{pane_current_path}" enable = true;
bind % split-window -h -c "#{pane_current_path}" text = ''
pane_frames false
theme "catppuccin-mocha"
set -gu default-command ui {
set -g default-shell "$SHELL" 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 = ":"; action = ":";
mode = ["n" "v"]; mode = ["n" "v"];
} }
{
key = "q;";
action = "q:";
mode = ["n" "v"];
}
{ {
key = "<leader>y"; key = "<leader>y";
action = ''"+y''; action = ''"+y'';
@ -88,6 +93,26 @@
action = "<cmd>Telescope live_grep<cr>"; action = "<cmd>Telescope live_grep<cr>";
mode = ["n"]; 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; [ extraPlugins = with pkgs.vimPlugins; [
@ -119,6 +144,7 @@
vim vim
yaml yaml
elixir elixir
heex
javascript javascript
typescript typescript
css css
@ -146,39 +172,47 @@
settings = { settings = {
sources = [ sources = [
{ name = "nvim_lsp"; } { name = "nvim_lsp"; }
{ name = "luasnip"; } { name = "snippy"; }
{ name = "path"; } { name = "path"; }
{ name = "buffer"; } { name = "buffer"; }
]; ];
mappings = { mappings = {
"<C-n>" = '' "<C-n>" = ''
cmp.mapping(function() function(fallback) do
if cmp.visible() then if cmp.visible() then
cmp.select_next_item({behavior = 'insert'}) cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
else else
cmp.complete() fallback()
end end
end) end
''; '';
"<C-p>" = '' "<C-p>" = ''
cmp.mapping(function() function(fallback) do
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item({behavior = 'insert'}) cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
else else
cmp.complete() fallback()
end end
end) end
'';
"<CR>" = ''
function(fallback)
if cmp.visible() then
cmp.confirm({ select = true })
else
fallback()
end
end
''; '';
}; };
snippet.expand = '' snippet.expand = ''
function(args) function(args)
require('luasnip').lsp_expand(args.body) require('snippy').expand_snippet(args.body)
end end
''; '';
}; };
}; };
plugins.tmux-navigator.enable = true; plugins.zellij-nav.enable = true;
}; };
} }

View file

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

View file

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