fix: fixed tmux/vim navigation by adding full paths to ps and grep

main
Ricard Illa 2023-07-09 18:29:18 +02:00
parent 4d538fbc8e
commit 720875ddca
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,9 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let tmux = "${pkgs.tmux}/bin/tmux"; let
tmux = "${pkgs.tmux}/bin/tmux";
ps = "${pkgs.procps}/bin/ps";
grep = "${pkgs.gnugrep}/bin/grep";
in { in {
programs.tmux = { programs.tmux = {
enable = true; enable = true;
@ -12,8 +15,8 @@ in {
set -g default-terminal "tmux-256color" set -g default-terminal "tmux-256color"
# set-option -sa terminal-overrides ',alacritty:Tc' # set-option -sa terminal-overrides ',alacritty:Tc'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ is_vim="${ps} -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | ${grep} -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L' bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D' bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'