Mercurial > dotfiles
changeset 564:b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sat, 19 Feb 2022 16:38:21 +0100 |
parents | fb54ab50a72a |
children | 697909624a17 |
files | dot_tmux.conf dot_zshrc |
diffstat | 2 files changed, 36 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dot_tmux.conf Thu Feb 17 11:28:41 2022 +0100 +++ b/dot_tmux.conf Sat Feb 19 16:38:21 2022 +0100 @@ -151,3 +151,37 @@ bind-key -n 'C-q' popup -w50% -h 90% -x 90% -E -d '#{pane_current_path}' chezmoi cd bind-key -n 'C-z' if -F '#{window_zoomed_flag}' "resize-pane -Z" "send-keys C-z" + +bind-key -n 'C-s' { + copy-mode + send -X clear-selection + send -X start-of-line + send -X start-of-line + send -X cursor-up + send -X cursor-up + send -X start-of-line + send -X start-of-line + + if -F "#{m:*->\u00A0*,#{copy_cursor_line}}" { + send -X search-forward-text "->\u00A0" + send -X stop-selection + send -X -N 2 cursor-right + send -X begin-selection + send -X end-of-line + send -X end-of-line + if "#{m:*->\u00A0?*,#{copy_cursor_line}}" { + send -X cursor-left + } + } { + send -X end-of-line + send -X end-of-line + send -X begin-selection + send -X search-backward-text "->\u00A0" + send -X end-of-line + send -X end-of-line + send -X cursor-right + send -X stop-selection + } +} + +bind-key -T copy-mode-vi 'e' send -X copy-pipe-and-cancel "cat > /tmp/error.txt && tmux new-window -n 'quickfix' -c \"#{pane_current_path}\" 'nvim -q /tmp/error.txt && rm -f /tmp/error.txt'"