diff --git a/packages/default.nix b/packages/default.nix index a1206c3..c35e2e9 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -12,6 +12,7 @@ ./kitty ./rofi ./alacritty + # ./tmux # ./mako # ./qutebrowser ./hyprland diff --git a/packages/nvim/default.nix b/packages/nvim/default.nix index bb0b78b..362c3da 100644 --- a/packages/nvim/default.nix +++ b/packages/nvim/default.nix @@ -57,6 +57,7 @@ programs.neovim.plugins = [ ".config/nvim/lua/plugins/tiny-inline-diagnostic.lua".source = ./lua/plugins/tiny-inline-diagnostic.lua; ".config/nvim/lua/plugins/conform.lua".source = ./lua/plugins/conform.lua; ".config/nvim/lua/plugins/go.lua".source = ./lua/plugins/go.lua; + # ".config/nvim/lua/plugins/nvim-tmux-navigation.lua".source = ./lua/plugins/nvim-tmux-navigation.lua; } ]; diff --git a/packages/nvim/lua/plugins/nvim-tmux-navigation.lua b/packages/nvim/lua/plugins/nvim-tmux-navigation.lua new file mode 100644 index 0000000..aaa7f4c --- /dev/null +++ b/packages/nvim/lua/plugins/nvim-tmux-navigation.lua @@ -0,0 +1,17 @@ +return { 'alexghergh/nvim-tmux-navigation', config = function() + + local nvim_tmux_nav = require('nvim-tmux-navigation') + + nvim_tmux_nav.setup { + disable_when_zoomed = true -- defaults to false + } + + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateLeft) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateDown) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateUp) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateRight) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateLastActive) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateNext) + +end +} diff --git a/packages/tmux/default.nix b/packages/tmux/default.nix index 430a3f2..8f8207d 100644 --- a/packages/tmux/default.nix +++ b/packages/tmux/default.nix @@ -5,10 +5,18 @@ programs.tmux = { enable = true; + terminal = "tmux-256color"; + disableConfirmationPrompt = true; extraConfig = '' -set-option -sa terminal-overrides ",xterm*:Tc" -set -g @catppuccin_flavor 'mocha' -set -g @catppuccin_window_status_style "rounded" +# set-option -sa terminal-overrides ",xterm*:Tc" +# set -g @catppuccin_flavor 'mocha' +# set -g @catppuccin_window_status_style "rounded" +# set -g default-terminal "xterm-256color" +# set -ga terminal-overrides ",*256col*:Tc" +# set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' +# set-environment -g COLORTERM "truecolor" +# +# run-shell ${pkgs.tmuxPlugins.catppuccin}/share/tmux-plugins/catppuccin/catppuccin.tmux set -g base-index 1 set -g pane-base-index 1 @@ -18,17 +26,51 @@ set-option -g renumber-windows on bind '"' split-window -v -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" -unbind C-b -set -g prefix C-Space -bind C-Space send-prefix set -g mouse on bind -n M-H previous-window bind -n M-L next-window + + + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator + +# decide whether we're in a Vim process +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" + +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' + +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' + +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+' + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l +bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+ ''; - plugins = [ - pkgs.tmuxPlugins.catppuccin + plugins = with pkgs.tmuxPlugins; [ + catppuccin { + plugin = catppuccin; + extraConfig = '' + set -g @plugin 'catppuccin/tmux#2.1.3' + set -g @catppuccin_window_status_style "rounded" + set -g @catppuccin_flavor 'mocha' + ''; + } # pkgs.tmuxPlugins.vim-tmux-navigator ]; };