Update tmux copy and selection behavior

+ Enable vim copy selection mode
+ Add various copy actions for middle, double, triple-click, etc.
+ Add instructions to README to install required tmux plugins
This commit is contained in:
Shaun Reed 2022-02-06 11:49:05 -05:00
parent 4cf23d7c58
commit d0fb7ead04
3 changed files with 37 additions and 4 deletions

View File

@ -1,11 +1,14 @@
# Alias to restart plasmashell for Kubuntu Plasma session
alias kapp-plasmashell='sudo pkill plasmashell && plasmashell --replace &> /dev/null &'
# Aliases to use the correct python version # Aliases to use the correct python version
alias python3='python3.9' alias python3='python3.9'
alias pip3='python3.9 -m pip' alias pip3='python3.9 -m pip'
# Alias to restart plasmashell for Kubuntu Plasma session
alias kapp-plasmashell='sudo pkill plasmashell && plasmashell --replace &> /dev/null &'
# Alias to clear swap
alias kapp-swap='sudo swapoff -a && sudo swapon -a'
# Alias to initialize github user
alias kapp-git='git config --global user.name "Shaun Reed" && git config --global user.email "shaunrd0@gmail.com"' alias kapp-git='git config --global user.name "Shaun Reed" && git config --global user.email "shaunrd0@gmail.com"'
# Alias to update and upgrade with useful flags set
alias kapp-update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove' alias kapp-update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove'
# Alias / export customizations # Alias / export customizations

View File

@ -20,7 +20,28 @@
#+ Vim plugin 'Colorizer' does not reflect the actual 256colour values #+ Vim plugin 'Colorizer' does not reflect the actual 256colour values
#+ See https://jonasjacek.github.io/colors/ for a full list of 256colours #+ See https://jonasjacek.github.io/colors/ for a full list of 256colours
# Settings for terminal text selection / copy options
# + Source: https://www.seanh.cc/2020/12/27/copy-and-paste-in-tmux/
# + Depends: https://github.com/tmux-plugins/tmux-yank#linux
set -g mouse on set -g mouse on
# These bindings are for X Windows only. If you're using a different
# window system you have to replace the `xsel` commands with something
# else. See https://github.com/tmux/tmux/wiki/Clipboard#available-tools
bind -T copy-mode DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -n DoubleClick1Pane select-pane \; copy-mode -M \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n TripleClick1Pane select-pane \; copy-mode -M \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n MouseDown2Pane run "tmux set-buffer -b primary_selection \"$(xsel -o)\"; tmux paste-buffer -b primary_selection; tmux delete-buffer -b primary_selection"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
set-option -s set-clipboard external
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
# remap shortcut prefix from 'C-b' to 'C-z' # remap shortcut prefix from 'C-b' to 'C-z'
unbind C-b unbind C-b
@ -143,3 +164,6 @@ set -g @scroll-speed-num-lines-per-scroll 2
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm' run -b '~/.tmux/plugins/tpm/tpm'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
#run '~/.tmux/plugins/tpm/tpm'

View File

@ -8,7 +8,7 @@ These configs were created and tested on Kubuntu 20.04 using i3-gaps, and should
First, grab some packages used for status bar and desktop overlay First, grab some packages used for status bar and desktop overlay
```bash ```bash
sudo apt install conky golang-go inxi python3 python3-pip jq tmux xbindkeys xautolock pulsemixer sudo apt install conky golang-go inxi python3 python3-pip jq tmux xbindkeys xautolock pulsemixer xsel
sudo pip3 install powerline-shell sudo pip3 install powerline-shell
go get -u github.com/arl/gitmux go get -u github.com/arl/gitmux
``` ```
@ -55,6 +55,12 @@ cd ~/dot/
git submodule update --init git submodule update --init
``` ```
*After* the dotfiles have been installed using `stow`, you should run `tpm` to ensure tmux plugins are all installed according to the `tmux.conf` settings provided. Assuming you don't want to face errors for dependencies related to tmux shortcuts defined in `.tmux.conf`, this is a required step to configure these dotfiles. Alternatively, you could provide your own `.tmux.conf` that does not use plugins to avoid this step, or just use the default `.tmux.conf` instead.
```bash
~/.tmux/plugins/tpm/bin/install_plugins
```
![desktop](Pictures/screenshots/dtop-code.png) ![desktop](Pictures/screenshots/dtop-code.png)
#### Additional Configuration #### Additional Configuration