From dd94dacf6c63629a9211534d59fdf768f709b8ca Mon Sep 17 00:00:00 2001 From: Massaki Archambault Date: Mon, 3 Dec 2018 11:25:13 -0500 Subject: [PATCH] tmux ajustements and remove dups from ctrl+r --- files/.tmux.conf | 19 +++---------------- files/.zshrc | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/files/.tmux.conf b/files/.tmux.conf index 729b0cd..17b7a0d 100644 --- a/files/.tmux.conf +++ b/files/.tmux.conf @@ -13,21 +13,6 @@ bind r source-file ~/.tmux.conf \; display-message 'Config reloaded...' # Escape delay is anoying in vim set -s escape-time 0 -# Smart pane switching with awareness of Vim splits. -# See: https://github.com/christoomey/vim-tmux-navigator -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" -bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" -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 - # Mouse set -g mouse on @@ -63,7 +48,7 @@ set -g status-left '{#[fg=colour6]#S#[fg=default]}' set -g status-right-length 100 set -g status-right-fg 'colour7' -set -g status-right '#(hostname)' +set -g status-right '#U@#H' # Plugins # Resurect pane content @@ -84,6 +69,8 @@ set -g @continuum-restore 'on' # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'soyuka/tmux-current-pane-hostname' +set -g @plugin 'christoomey/vim-tmux-navigator' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' diff --git a/files/.zshrc b/files/.zshrc index bf9a7f2..d400c19 100644 --- a/files/.zshrc +++ b/files/.zshrc @@ -89,4 +89,20 @@ source $ZSH/oh-my-zsh.sh # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" -# + +# Remove duplicate when using Ctrl+R +# https://github.com/junegunn/fzf/issues/626 +__fzf_history__() ( + local line + shopt -u nocaseglob nocasematch + line=$( + HISTTIMEFORMAT= history | tac | sort --key=2.1 -bus | sort -n | + FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS --tac -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m" $(__fzfcmd) | + command grep '^ *[0-9]') && + if [[ $- =~ H ]]; then + sed 's/^ *\([0-9]*\)\** .*/!\1/' <<< "$line" + else + sed 's/^ *\([0-9]*\)\** *//' <<< "$line" + fi +) +