diff --git a/SwarselSystems.org b/SwarselSystems.org index 3a53aa0..5bb4b7f 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -447,6 +447,9 @@ A short overview over each input and what it does: impermanence.url = "github:nix-community/impermanence"; + zjstatus = { + url = "github:dj95/zjstatus"; + }; #+end_src *** let :PROPERTIES: @@ -532,6 +535,7 @@ In this section I am creating some attributes that define general concepts of my (import ./overlays { inherit inputs; }).additions (import ./overlays { inherit inputs; }).modifications (import ./overlays { inherit inputs; }).nixpkgs-stable + (import ./overlays { inherit inputs; }).zjstatus inputs.nur.overlay inputs.emacs-overlay.overlay inputs.nixgl.overlay @@ -4455,6 +4459,11 @@ This file now holds all of the "nixpkgs-changes" that I am using across the conf nixpkgs-stable = final: _prev: { stable = import inputs.nixpkgs-stable { inherit (final) system; }; }; + + zjstatus = final: _prev: { + zjstatus = inputs.zjstatus.packages.${_prev.system}.default; + }; + } #+end_src @@ -6530,6 +6539,8 @@ This section sets up all the imports that are used in the home-manager section. ./gammastep.nix # ./safeeyes.nix ./yubikey-touch-detector.nix + ./zellij.nix + ./tmux.nix ]; nix = { @@ -7402,10 +7413,11 @@ The theme is handled by stylix. programs.kitty = { enable = true; keybindings = { - "ctrl+shift+left" = "no_op"; - "ctrl+shift+right" = "no_op"; - "ctrl+shift+home" = "no_op"; - "ctrl+shift+end" = "no_op"; + }; + settings = { + scrollback_lines = 10000; + enable_audio_bell = false; + notify_on_cmd_finish = "always 20"; }; }; } @@ -7470,13 +7482,343 @@ Here we set some aliases (some of them should be shellApplications instead) as w } ]; initExtra = '' - bindkey "^[[1;5D" backward-word - bindkey "^[[1;5C" forward-word + bindkey "^[[1;5D" backward-word + bindkey "^[[1;5C" forward-word + + vterm_printf() { + if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ]); then + # Tell tmux to pass the escape sequences through + printf "\ePtmux;\e\e]%s\007\e\\" "$1" + elif [ "''${TERM%%-*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + printf "\eP\e]%s\007\e\\" "$1" + else + printf "\e]%s\e\\" "$1" + fi + } ''; }; } #+end_src +**** zellij +#+begin_src nix :tangle profiles/common/home/zellij.nix + { pkgs, config, ... }: + let + inherit (config.lib.stylix) colors; + sesh = pkgs.writeScriptBin "sesh" '' + #! /usr/bin/env sh + + # Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980 + # select a directory using zoxide + ZOXIDE_RESULT=$(zoxide query --interactive) + # checks whether a directory has been selected + if [[ -z "$ZOXIDE_RESULT" ]]; then + # if there was no directory, select returns without executing + exit 0 + fi + # extracts the directory name from the absolute path + SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##') + + # get the list of sessions + SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}') + + # checks if SESSION_TITLE is in the session list + if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then + # if so, attach to existing session + zellij attach "$SESSION_TITLE" + else + # if not, create a new session + echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT" + cd $ZOXIDE_RESULT + zellij attach -c "$SESSION_TITLE" + fi + ''; + + in + { + programs.zellij = { + enable = true; + }; + home.packages = [ + # pkgs.tmate + # sesh + ]; + # xdg.configFile."zellij/config.kdl".source = ../../../programs/zellij/config.kdl; + # xdg.configFile."zellij/layouts/default.kdl".text = '' + # layout { + # swap_tiled_layout name="vertical" { + # tab max_panes=5 { + # pane split_direction="vertical" { + # pane + # pane { children; } + # } + # } + # tab max_panes=8 { + # pane split_direction="vertical" { + # pane { children; } + # pane { pane; pane; pane; pane; } + # } + # } + # tab max_panes=12 { + # pane split_direction="vertical" { + # pane { children; } + # pane { pane; pane; pane; pane; } + # pane { pane; pane; pane; pane; } + # } + # } + # } + + # swap_tiled_layout name="horizontal" { + # tab max_panes=5 { + # pane + # pane + # } + # tab max_panes=8 { + # pane { + # pane split_direction="vertical" { children; } + # pane split_direction="vertical" { pane; pane; pane; pane; } + # } + # } + # tab max_panes=12 { + # pane { + # pane split_direction="vertical" { children; } + # pane split_direction="vertical" { pane; pane; pane; pane; } + # pane split_direction="vertical" { pane; pane; pane; pane; } + # } + # } + # } + + # swap_tiled_layout name="stacked" { + # tab min_panes=5 { + # pane split_direction="vertical" { + # pane + # pane stacked=true { children; } + # } + # } + # } + + # swap_floating_layout name="staggered" { + # floating_panes + # } + + # swap_floating_layout name="enlarged" { + # floating_panes max_panes=10 { + # pane { x "5%"; y 1; width "90%"; height "90%"; } + # pane { x "5%"; y 2; width "90%"; height "90%"; } + # pane { x "5%"; y 3; width "90%"; height "90%"; } + # pane { x "5%"; y 4; width "90%"; height "90%"; } + # pane { x "5%"; y 5; width "90%"; height "90%"; } + # pane { x "5%"; y 6; width "90%"; height "90%"; } + # pane { x "5%"; y 7; width "90%"; height "90%"; } + # pane { x "5%"; y 8; width "90%"; height "90%"; } + # pane { x "5%"; y 9; width "90%"; height "90%"; } + # pane focus=true { x 10; y 10; width "90%"; height "90%"; } + # } + # } + + # swap_floating_layout name="spread" { + # floating_panes max_panes=1 { + # pane {y "50%"; x "50%"; } + # } + # floating_panes max_panes=2 { + # pane { x "1%"; y "25%"; width "45%"; } + # pane { x "50%"; y "25%"; width "45%"; } + # } + # floating_panes max_panes=3 { + # pane focus=true { y "55%"; width "45%"; height "45%"; } + # pane { x "1%"; y "1%"; width "45%"; } + # pane { x "50%"; y "1%"; width "45%"; } + # } + # floating_panes max_panes=4 { + # pane { x "1%"; y "55%"; width "45%"; height "45%"; } + # pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; } + # pane { x "1%"; y "1%"; width "45%"; height "45%"; } + # pane { x "50%"; y "1%"; width "45%"; height "45%"; } + # } + # } + + # default_tab_template { + # pane size=2 borderless=true { + # plugin location="file://${pkgs.zjstatus}/bin/zjstatus.wasm" { + # format_left "{mode}#[bg=#${colors.base00}] {tabs}" + # format_center "" + # format_right "#[bg=#${colors.base00},fg=#${colors.base0D}]#[bg=#${colors.base0D},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base05},bold] {session} #[bg=#${colors.base03},fg=#${colors.base05},bold]" + # format_space "" + # format_hide_on_overlength "true" + # format_precedence "crl" + + # border_enabled "false" + # border_char "─" + # border_format "#[fg=#6C7086]{char}" + # border_position "top" + + # mode_normal "#[bg=#${colors.base0B},fg=#${colors.base02},bold] NORMAL#[bg=#${colors.base03},fg=#${colors.base0B}]█" + # mode_locked "#[bg=#${colors.base04},fg=#${colors.base02},bold] LOCKED #[bg=#${colors.base03},fg=#${colors.base04}]█" + # mode_resize "#[bg=#${colors.base08},fg=#${colors.base02},bold] RESIZE#[bg=#${colors.base03},fg=#${colors.base08}]█" + # mode_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" + # mode_scroll "#[bg=#${colors.base0A},fg=#${colors.base02},bold] SCROLL#[bg=#${colors.base03},fg=#${colors.base0A}]█" + # mode_enter_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] ENT-SEARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] SEARCHARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_rename_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] RENAME-TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" + # mode_rename_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] RENAME-PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_session "#[bg=#${colors.base0E},fg=#${colors.base02},bold] SESSION#[bg=#${colors.base03},fg=#${colors.base0E}]█" + # mode_move "#[bg=#${colors.base0F},fg=#${colors.base02},bold] MOVE#[bg=#${colors.base03},fg=#${colors.base0F}]█" + # mode_prompt "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PROMPT#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_tmux "#[bg=#${colors.base09},fg=#${colors.base02},bold] TMUX#[bg=#${colors.base03},fg=#${colors.base09}]█" + + # // formatting for inactive tabs + # tab_normal "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_normal_fullscreen "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_normal_sync "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + + # // formatting for the current active tab + # tab_active "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_active_fullscreen "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_active_sync "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + + # // separator between the tabs + # tab_separator "#[bg=#${colors.base00}] " + + # // indicators + # tab_sync_indicator " " + # tab_fullscreen_indicator " 󰊓" + # tab_floating_indicator " 󰹙" + + # command_git_branch_command "git rev-parse --abbrev-ref HEAD" + # command_git_branch_format "#[fg=blue] {stdout} " + # command_git_branch_interval "10" + # command_git_branch_rendermode "static" + + # datetime "#[fg=#6C7086,bold] {format} " + # datetime_format "%A, %d %b %Y %H:%M" + # datetime_timezone "Europe/London" + # } + # } + # children + # } + # } + # ''; + + + } +#+end_src +**** tmux +#+begin_src nix :tangle profiles/common/home/tmux.nix + + { pkgs, ... }: + let + tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "tmux-super-fingers"; + version = "unstable-2023-01-06"; + src = pkgs.fetchFromGitHub { + owner = "artemave"; + repo = "tmux_super_fingers"; + rev = "2c12044984124e74e21a5a87d00f844083e4bdf7"; + sha256 = "sha256-cPZCV8xk9QpU49/7H8iGhQYK6JwWjviL29eWabuqruc="; + }; + }; + in + { + + home.packages = with pkgs; [ + lsof + sesh + ]; + + programs.tmux = { + enable = true; + shell = "${pkgs.zsh}/bin/zsh"; + terminal = "tmux-256color"; + historyLimit = 100000; + plugins = with pkgs; + [ + tmuxPlugins.tmux-thumbs + { + plugin = tmux-super-fingers; + extraConfig = "set -g @super-fingers-key f"; + } + + tmuxPlugins.sensible + # must be before continuum edits right status bar + { + plugin = tmuxPlugins.catppuccin; + extraConfig = '' + set -g @catppuccin_flavour 'frappe' + set -g @catppuccin_window_tabs_enabled on + set -g @catppuccin_date_time "%H:%M" + ''; + } + { + plugin = tmuxPlugins.resurrect; + extraConfig = '' + set -g @resurrect-strategy-vim 'session' + set -g @resurrect-strategy-nvim 'session' + set -g @resurrect-capture-pane-contents 'on' + ''; + } + { + plugin = tmuxPlugins.continuum; + extraConfig = '' + set -g @continuum-restore 'on' + set -g @continuum-boot 'on' + set -g @continuum-save-interval '10' + ''; + } + tmuxPlugins.better-mouse-mode + tmuxPlugins.yank + ]; + extraConfig = '' + set -g default-terminal "tmux-256color" + set -ag terminal-overrides ",xterm-256color:RGB" + + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + + set -g mouse on + + # Change splits to match nvim and easier to remember + # Open new split at cwd of current split + unbind % + unbind '"' + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + + # Use vim keybindings in copy mode + set-window-option -g mode-keys vi + + # v in copy mode starts making selection + bind-key -T copy-mode-vi v send-keys -X begin-selection + bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle + bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + # Escape turns on copy mode + bind Escape copy-mode + + # Easier reload of config + bind r source-file ~/.config/tmux/tmux.conf + + set-option -g status-position top + + # make Prefix p paste the buffer. + unbind p + bind p paste-buffer + + # Bind Keys + bind-key -T prefix C-g split-window \ + "$SHELL --login -i -c 'navi --print | head -c -1 | tmux load-buffer -b tmp - ; tmux paste-buffer -p -t {last} -b tmp -d'" + bind-key -T prefix C-l switch -t notes + bind-key -T prefix C-d switch -t dotfiles + bind-key e send-keys "tmux capture-pane -p -S - | nvim -c 'set buftype=nofile' +" Enter + ''; + }; + } + + +#+end_src **** Mail :PROPERTIES: :CUSTOM_ID: h:506d01fc-c20b-473a-ac78-bce4b53fe0e3 @@ -12127,3 +12469,12 @@ This sets up the =dashboard=, which is really quite useless. But, it looks cool #+end_src + +*** vterm + +#+begin_src emacs-lisp + +(use-package vterm + :ensure t) + +#+end_src diff --git a/flake.nix b/flake.nix index 61281bb..c0ca45c 100644 --- a/flake.nix +++ b/flake.nix @@ -90,6 +90,9 @@ impermanence.url = "github:nix-community/impermanence"; + zjstatus = { + url = "github:dj95/zjstatus"; + }; }; outputs = @@ -157,6 +160,7 @@ (import ./overlays { inherit inputs; }).additions (import ./overlays { inherit inputs; }).modifications (import ./overlays { inherit inputs; }).nixpkgs-stable + (import ./overlays { inherit inputs; }).zjstatus inputs.nur.overlay inputs.emacs-overlay.overlay inputs.nixgl.overlay diff --git a/overlays/default.nix b/overlays/default.nix index 50e49f3..943680a 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -37,4 +37,9 @@ nixpkgs-stable = final: _prev: { stable = import inputs.nixpkgs-stable { inherit (final) system; }; }; + + zjstatus = final: _prev: { + zjstatus = inputs.zjstatus.packages.${_prev.system}.default; + }; + } diff --git a/profiles/common/home/default.nix b/profiles/common/home/default.nix index bf28d6b..c1af61f 100644 --- a/profiles/common/home/default.nix +++ b/profiles/common/home/default.nix @@ -31,6 +31,8 @@ ./gammastep.nix # ./safeeyes.nix ./yubikey-touch-detector.nix + ./zellij.nix + ./tmux.nix ]; nix = { diff --git a/profiles/common/home/kitty.nix b/profiles/common/home/kitty.nix index f2b1e9b..58d073e 100644 --- a/profiles/common/home/kitty.nix +++ b/profiles/common/home/kitty.nix @@ -2,11 +2,11 @@ _: { programs.kitty = { enable = true; - keybindings = { - "ctrl+shift+left" = "no_op"; - "ctrl+shift+right" = "no_op"; - "ctrl+shift+home" = "no_op"; - "ctrl+shift+end" = "no_op"; + keybindings = { }; + settings = { + scrollback_lines = 10000; + enable_audio_bell = false; + notify_on_cmd_finish = "always 20"; }; }; } diff --git a/profiles/common/home/tmux.nix b/profiles/common/home/tmux.nix new file mode 100644 index 0000000..7fa6e86 --- /dev/null +++ b/profiles/common/home/tmux.nix @@ -0,0 +1,109 @@ +{ pkgs, ... }: +let + tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "tmux-super-fingers"; + version = "unstable-2023-01-06"; + src = pkgs.fetchFromGitHub { + owner = "artemave"; + repo = "tmux_super_fingers"; + rev = "2c12044984124e74e21a5a87d00f844083e4bdf7"; + sha256 = "sha256-cPZCV8xk9QpU49/7H8iGhQYK6JwWjviL29eWabuqruc="; + }; + }; +in +{ + + home.packages = with pkgs; [ + lsof + sesh + ]; + + programs.tmux = { + enable = true; + shell = "${pkgs.zsh}/bin/zsh"; + terminal = "tmux-256color"; + historyLimit = 100000; + plugins = with pkgs; + [ + tmuxPlugins.tmux-thumbs + { + plugin = tmux-super-fingers; + extraConfig = "set -g @super-fingers-key f"; + } + + tmuxPlugins.sensible + # must be before continuum edits right status bar + { + plugin = tmuxPlugins.catppuccin; + extraConfig = '' + set -g @catppuccin_flavour 'frappe' + set -g @catppuccin_window_tabs_enabled on + set -g @catppuccin_date_time "%H:%M" + ''; + } + { + plugin = tmuxPlugins.resurrect; + extraConfig = '' + set -g @resurrect-strategy-vim 'session' + set -g @resurrect-strategy-nvim 'session' + set -g @resurrect-capture-pane-contents 'on' + ''; + } + { + plugin = tmuxPlugins.continuum; + extraConfig = '' + set -g @continuum-restore 'on' + set -g @continuum-boot 'on' + set -g @continuum-save-interval '10' + ''; + } + tmuxPlugins.better-mouse-mode + tmuxPlugins.yank + ]; + extraConfig = '' + set -g default-terminal "tmux-256color" + set -ag terminal-overrides ",xterm-256color:RGB" + + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + + set -g mouse on + + # Change splits to match nvim and easier to remember + # Open new split at cwd of current split + unbind % + unbind '"' + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + + # Use vim keybindings in copy mode + set-window-option -g mode-keys vi + + # v in copy mode starts making selection + bind-key -T copy-mode-vi v send-keys -X begin-selection + bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle + bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + # Escape turns on copy mode + bind Escape copy-mode + + # Easier reload of config + bind r source-file ~/.config/tmux/tmux.conf + + set-option -g status-position top + + # make Prefix p paste the buffer. + unbind p + bind p paste-buffer + + # Bind Keys + bind-key -T prefix C-g split-window \ + "$SHELL --login -i -c 'navi --print | head -c -1 | tmux load-buffer -b tmp - ; tmux paste-buffer -p -t {last} -b tmp -d'" + bind-key -T prefix C-l switch -t notes + bind-key -T prefix C-d switch -t dotfiles + bind-key e send-keys "tmux capture-pane -p -S - | nvim -c 'set buftype=nofile' +" Enter + ''; + }; +} diff --git a/profiles/common/home/zellij.nix b/profiles/common/home/zellij.nix new file mode 100644 index 0000000..530a9b8 --- /dev/null +++ b/profiles/common/home/zellij.nix @@ -0,0 +1,200 @@ +{ pkgs, config, ... }: +let + inherit (config.lib.stylix) colors; + sesh = pkgs.writeScriptBin "sesh" '' + #! /usr/bin/env sh + + # Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980 + # select a directory using zoxide + ZOXIDE_RESULT=$(zoxide query --interactive) + # checks whether a directory has been selected + if [[ -z "$ZOXIDE_RESULT" ]]; then + # if there was no directory, select returns without executing + exit 0 + fi + # extracts the directory name from the absolute path + SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##') + + # get the list of sessions + SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}') + + # checks if SESSION_TITLE is in the session list + if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then + # if so, attach to existing session + zellij attach "$SESSION_TITLE" + else + # if not, create a new session + echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT" + cd $ZOXIDE_RESULT + zellij attach -c "$SESSION_TITLE" + fi + ''; + +in +{ + programs.zellij = { + enable = true; + }; + home.packages = [ + # pkgs.tmate + # sesh + ]; + # xdg.configFile."zellij/config.kdl".source = ../../../programs/zellij/config.kdl; + # xdg.configFile."zellij/layouts/default.kdl".text = '' + # layout { + # swap_tiled_layout name="vertical" { + # tab max_panes=5 { + # pane split_direction="vertical" { + # pane + # pane { children; } + # } + # } + # tab max_panes=8 { + # pane split_direction="vertical" { + # pane { children; } + # pane { pane; pane; pane; pane; } + # } + # } + # tab max_panes=12 { + # pane split_direction="vertical" { + # pane { children; } + # pane { pane; pane; pane; pane; } + # pane { pane; pane; pane; pane; } + # } + # } + # } + + # swap_tiled_layout name="horizontal" { + # tab max_panes=5 { + # pane + # pane + # } + # tab max_panes=8 { + # pane { + # pane split_direction="vertical" { children; } + # pane split_direction="vertical" { pane; pane; pane; pane; } + # } + # } + # tab max_panes=12 { + # pane { + # pane split_direction="vertical" { children; } + # pane split_direction="vertical" { pane; pane; pane; pane; } + # pane split_direction="vertical" { pane; pane; pane; pane; } + # } + # } + # } + + # swap_tiled_layout name="stacked" { + # tab min_panes=5 { + # pane split_direction="vertical" { + # pane + # pane stacked=true { children; } + # } + # } + # } + + # swap_floating_layout name="staggered" { + # floating_panes + # } + + # swap_floating_layout name="enlarged" { + # floating_panes max_panes=10 { + # pane { x "5%"; y 1; width "90%"; height "90%"; } + # pane { x "5%"; y 2; width "90%"; height "90%"; } + # pane { x "5%"; y 3; width "90%"; height "90%"; } + # pane { x "5%"; y 4; width "90%"; height "90%"; } + # pane { x "5%"; y 5; width "90%"; height "90%"; } + # pane { x "5%"; y 6; width "90%"; height "90%"; } + # pane { x "5%"; y 7; width "90%"; height "90%"; } + # pane { x "5%"; y 8; width "90%"; height "90%"; } + # pane { x "5%"; y 9; width "90%"; height "90%"; } + # pane focus=true { x 10; y 10; width "90%"; height "90%"; } + # } + # } + + # swap_floating_layout name="spread" { + # floating_panes max_panes=1 { + # pane {y "50%"; x "50%"; } + # } + # floating_panes max_panes=2 { + # pane { x "1%"; y "25%"; width "45%"; } + # pane { x "50%"; y "25%"; width "45%"; } + # } + # floating_panes max_panes=3 { + # pane focus=true { y "55%"; width "45%"; height "45%"; } + # pane { x "1%"; y "1%"; width "45%"; } + # pane { x "50%"; y "1%"; width "45%"; } + # } + # floating_panes max_panes=4 { + # pane { x "1%"; y "55%"; width "45%"; height "45%"; } + # pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; } + # pane { x "1%"; y "1%"; width "45%"; height "45%"; } + # pane { x "50%"; y "1%"; width "45%"; height "45%"; } + # } + # } + + # default_tab_template { + # pane size=2 borderless=true { + # plugin location="file://${pkgs.zjstatus}/bin/zjstatus.wasm" { + # format_left "{mode}#[bg=#${colors.base00}] {tabs}" + # format_center "" + # format_right "#[bg=#${colors.base00},fg=#${colors.base0D}]#[bg=#${colors.base0D},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base05},bold] {session} #[bg=#${colors.base03},fg=#${colors.base05},bold]" + # format_space "" + # format_hide_on_overlength "true" + # format_precedence "crl" + + # border_enabled "false" + # border_char "─" + # border_format "#[fg=#6C7086]{char}" + # border_position "top" + + # mode_normal "#[bg=#${colors.base0B},fg=#${colors.base02},bold] NORMAL#[bg=#${colors.base03},fg=#${colors.base0B}]█" + # mode_locked "#[bg=#${colors.base04},fg=#${colors.base02},bold] LOCKED #[bg=#${colors.base03},fg=#${colors.base04}]█" + # mode_resize "#[bg=#${colors.base08},fg=#${colors.base02},bold] RESIZE#[bg=#${colors.base03},fg=#${colors.base08}]█" + # mode_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" + # mode_scroll "#[bg=#${colors.base0A},fg=#${colors.base02},bold] SCROLL#[bg=#${colors.base03},fg=#${colors.base0A}]█" + # mode_enter_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] ENT-SEARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] SEARCHARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_rename_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] RENAME-TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" + # mode_rename_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] RENAME-PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_session "#[bg=#${colors.base0E},fg=#${colors.base02},bold] SESSION#[bg=#${colors.base03},fg=#${colors.base0E}]█" + # mode_move "#[bg=#${colors.base0F},fg=#${colors.base02},bold] MOVE#[bg=#${colors.base03},fg=#${colors.base0F}]█" + # mode_prompt "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PROMPT#[bg=#${colors.base03},fg=#${colors.base0D}]█" + # mode_tmux "#[bg=#${colors.base09},fg=#${colors.base02},bold] TMUX#[bg=#${colors.base03},fg=#${colors.base09}]█" + + # // formatting for inactive tabs + # tab_normal "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_normal_fullscreen "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_normal_sync "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + + # // formatting for the current active tab + # tab_active "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_active_fullscreen "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + # tab_active_sync "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" + + # // separator between the tabs + # tab_separator "#[bg=#${colors.base00}] " + + # // indicators + # tab_sync_indicator " " + # tab_fullscreen_indicator " 󰊓" + # tab_floating_indicator " 󰹙" + + # command_git_branch_command "git rev-parse --abbrev-ref HEAD" + # command_git_branch_format "#[fg=blue] {stdout} " + # command_git_branch_interval "10" + # command_git_branch_rendermode "static" + + # datetime "#[fg=#6C7086,bold] {format} " + # datetime_format "%A, %d %b %Y %H:%M" + # datetime_timezone "Europe/London" + # } + # } + # children + # } + # } + # ''; + + +} diff --git a/profiles/common/home/zsh.nix b/profiles/common/home/zsh.nix index e652dfb..090525f 100644 --- a/profiles/common/home/zsh.nix +++ b/profiles/common/home/zsh.nix @@ -49,6 +49,18 @@ initExtra = '' bindkey "^[[1;5D" backward-word bindkey "^[[1;5C" forward-word + + vterm_printf() { + if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ]); then + # Tell tmux to pass the escape sequences through + printf "\ePtmux;\e\e]%s\007\e\\" "$1" + elif [ "''${TERM%%-*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + printf "\eP\e]%s\007\e\\" "$1" + else + printf "\e]%s\e\\" "$1" + fi + } ''; }; } diff --git a/programs/emacs/init.el b/programs/emacs/init.el index 4808ca7..482f298 100644 --- a/programs/emacs/init.el +++ b/programs/emacs/init.el @@ -1836,3 +1836,6 @@ create a new one." (use-package ansible :hook (yaml-ts-mode . ansible)) + +(use-package vterm + :ensure t) diff --git a/programs/zellij/config.kdl b/programs/zellij/config.kdl new file mode 100644 index 0000000..fb437e1 --- /dev/null +++ b/programs/zellij/config.kdl @@ -0,0 +1,264 @@ +theme "catppuccin-mocha" +pane_frames false +simplified_ui true +default_shell "zsh" +copy_on_select true + +// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true" +keybinds { + unbind "Ctrl q" + normal { + // uncomment this and adjust key if using copy_on_select=false + // bind "Alt c" { Copy; } + } + locked clear-defaults=true { + bind "Alt u" { SwitchToMode "Normal"; } + } + + resize clear-defaults=true { + bind "Alt r" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "h" "Left" { Resize "Increase Left"; } + bind "j" "Down" { Resize "Increase Down"; } + bind "k" "Up" { Resize "Increase Up"; } + bind "l" "Right" { Resize "Increase Right"; } + bind "H" { Resize "Decrease Left"; } + bind "J" { Resize "Decrease Down"; } + bind "K" { Resize "Decrease Up"; } + bind "L" { Resize "Decrease Right"; } + bind "=" "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + } + + pane clear-defaults=true { + bind "Alt p" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "Alt h" "h" "Left" { MoveFocus "Left"; } + bind "Alt l" "l" "Right" { MoveFocus "Right"; } + bind "Alt j" "j" "Down" { MoveFocus "Down"; } + bind "Alt k" "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { SwitchToMode "Normal"; } + bind "d" { NewPane "Down"; SwitchToMode "Normal"; } + bind "r" { NewPane "Right"; SwitchToMode "Normal"; } + bind "x" { CloseFocus; SwitchToMode "Normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "Normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "Normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;} + } + + move clear-defaults=true { + bind "Alt m" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "n" "Tab" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + } + + tab clear-defaults=true { + bind "Alt t" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "Normal"; } + bind "x" { CloseTab; SwitchToMode "Normal"; } + bind "s" { ToggleActiveSyncTab; 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 "Tab" { ToggleTab; } + } + + scroll clear-defaults=true { + bind "Alt f" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "e" { EditScrollback; SwitchToMode "Normal"; } + bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + // uncomment this and adjust key if using copy_on_select=false + // bind "Alt c" { Copy; } + } + + search clear-defaults=true { + bind "Alt f" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "Ctrl c" "Esc" "Ctrl {" { ScrollToBottom; SwitchToMode "Normal"; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "n" { Search "down"; } + bind "p" { Search "up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + + entersearch clear-defaults=true { + bind "Ctrl c" "Esc" "Ctrl {" { SwitchToMode "Scroll"; } + bind "Enter" { SwitchToMode "Search"; } + } + + renametab clear-defaults=true { + bind "Ctrl c" "Enter" { SwitchToMode "Normal"; } + bind "Esc" "Ctrl {"{ UndoRenameTab; SwitchToMode "Tab"; } + } + + renamepane clear-defaults=true { + bind "Ctrl c" { SwitchToMode "Normal"; } + bind "Esc" "Ctrl {" { UndoRenamePane; SwitchToMode "Pane"; } + } + + session clear-defaults=true { + bind "Alt s" "Esc" "Ctrl {" { SwitchToMode "Normal"; } + + bind "Alt f" { SwitchToMode "Scroll"; } + bind "d" { Detach; } + bind "w" { + LaunchOrFocusPlugin "zellij:session-manager" { + floating false + move_to_focused_tab true + }; + SwitchToMode "Normal" + } + } + + tmux clear-defaults=true { + bind "Ctrl b" "Esc" "Ctrl {" { Write 2; SwitchToMode "Normal"; } + bind "[" { SwitchToMode "Scroll"; } + bind "\"" { NewPane "Down"; SwitchToMode "Normal"; } + bind "%" { NewPane "Right"; SwitchToMode "Normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; } + bind "c" { NewTab; SwitchToMode "Normal"; } + bind "," { SwitchToMode "RenameTab"; } + bind "p" { GoToPreviousTab; SwitchToMode "Normal"; } + bind "n" { GoToNextTab; SwitchToMode "Normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; } + bind "o" { FocusNextPane; } + bind "d" { Detach; } + bind "Space" { NextSwapLayout; } + bind "x" { CloseFocus; SwitchToMode "Normal"; } + } + + shared_except "locked" { + bind "Alt u" { SwitchToMode "Locked"; } + + bind "Alt q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "Alt [" { PreviousSwapLayout; } + bind "Alt ]" { NextSwapLayout; } + //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"; + + // // Plugin Configuration + // move_mod "ctrl"; // Optional, should be added on every command if you want to use it + // resize_mod "alt"; // Optional, should be added on every command if you want to use it + // }; + //} + + //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"; + // resize_mod "alt"; + // }; + //} + + //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"; + // resize_mod "alt"; + // }; + //} + + //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"; + // resize_mod "alt"; + // }; + //} + } + + shared_except "normal" "locked" { + unbind "Ctrl g" + bind "Enter" "Esc" "Alt u" { SwitchToMode "Normal"; } + } + + shared_except "pane" "locked" { + unbind "Ctrl p" + bind "Alt p" { SwitchToMode "Pane"; } + } + + shared_except "resize" "locked" { + unbind "Ctrl n" + bind "Alt r" { SwitchToMode "Resize"; } + } + + shared_except "scroll" "locked" { + unbind "Ctrl s" + bind "Alt f" { SwitchToMode "Scroll"; } + } + + shared_except "session" "locked" { + unbind "Ctrl o" + bind "Alt s" { SwitchToMode "Session"; } + } + + shared_except "tab" "locked" { + unbind "Ctrl t" + bind "Alt t" { SwitchToMode "Tab"; } + } + + shared_except "move" "locked" { + unbind "Ctrl h" + bind "Alt m" { SwitchToMode "Move"; } + } + + shared_except "tmux" "locked" { + unbind "Ctrl b" + // bind "Ctrl b" { SwitchToMode "Tmux"; } + } +}