Hey there,

I'll repaste my entire Tmux config to see if you would want to copy and paste a 
few options that might be useful, again, check out 'gotbletu's videos on Tmux 
since you might learn a few more things you never knew:

`# Set Default Terminal Emulator:
set -g default-terminal "urxvt"

# Prefix Key And Split Keys
set-option -g prefix C-a

# Making Delay Time Shorter:
set -sg escape-time 0

# Reload Config Easier With C-a-r:
bind-key r source-file ~/.tmux.conf \; display ".tmux config reloaded!"

# Appearance
set-window-option -g window-status-current-style bg=colour142
set-window-option -g window-status-current-style fg=colour16

# Set Default Color Terminal:
# set -g default-terminal tmux-256color
set -g default-terminal "screen-256color"

# Panes
set -g status-fg colour20
set -g status-bg colour18

# Status Bar
set -g status-position bottom
set -g status-justify left
set-option -g status-style bg=colour142,fg=colour16,dim
set -g status-left ''
set -g status-right '#[fg=colour16,bg=colour197,bold] %a %m-%d-%y 
#[fg=colour16,bg=colour51,bold] %I:%M %p '
set -g status-right-length 50
set -g status-left-length 20

# Idle Commands
# 'cmatrix' Screensaver
set -g lock-after-time 300
set -g lock-command "/usr/bin/cmatrix -C white"

# Keybindings
# Vim-Style Pane Movement Keybindings
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R

# Split Pane Keybindings
# Horizontal Split pane:
bind-key '-' split-window
# Vertical Split Pane:
bind-key '_' split-window -h

# Split Window Keybindings
# Horizontal Split Window:
bind-key '=' split-window -fv -c "#{pane_current_path}"
# Vertical Split Window:
bind-key '+' split-window -fh -c "#{pane_current_path}"

# Layout Keybindings:
# Home layout: Starts When Tmux First Runs Without Needing A Keybinding:

# Startup Home Layout (Newsboat, IRC, Neomutt, etc):
bind-key M-w send-keys 'newsboat' 'Enter' \; \
    new-window -n weechat 'weechat' \; \
    new-window -n neomutt 'neomutt' \; \
    new-window -n ranger 'ranger' \; \
    new-window -n torrent 'w3m https://1337x.to/' \; \
    split-pane -t torrent -v -p 30 \; \
    send-keys -t torrent 'tsm' 'Enter' \; \
    select-window -t 0;

# Urlview Keybindings:
# C-a-u: urlview keybinding to launch URLs from a Tmux buffer in the default 
w3m browser dicated by the $BROWSER .bashrc variable
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n 
"urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'
# C-a-y: Urlview keybinding to launch a URL from a Tmux buffer in a the GUI 
browser, Firefox, as dictated by the $GUIBROWSER .bashrc variable:
bind-key y capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "w3m" 
'$SHELL -c "w3m < /tmp/tmux-buffer" '

# Fuzzy Finder Keybindings
# C-z: fzh() keybinding: searches history and pipes it into fuzzy finder
bind-key -n 'C-z' new-window -n fzh -c $HOME \; \
         send-keys 'fzh && tmux kill-window' 'Enter'
# TODO: Find a better keybinding for this, doesn't play nice with w3m: C-q: fzk 
(kill process): pipes processes into fzf to kill them
# bind-key -n 'C-q' new-window -n fzk -c $HOME \; \
         # send-keys 'fzk && tmux kill-window' 'Enter'
# fcd() keybinding: used to change the current directory. TODO: Come up with a 
good key combo for this:
# bind-key -n '' new-window -n fcd -c $HOME \; \
#          send-keys 'fcd && tmux kill-window' 'Enter'
# C-o: fzd() keybinding: used to launch GUI apps from /usr/share/applications
bind-key -n 'C-o' new-window -n fzd -c $HOME \; \
         send-keys 'fzd && sleep 1 && tmux kill-window' 'Enter'
# C-\: fzw() based keybinding: used to launch bookmarks from 
~/.w3m/bookmark.html in w3m quickly from Tmux
bind-key -n 'C-\' new-window -n bookmarks -c $HOME \; \
         send-keys 'fzw && tmux kill-window' 'Enter'
# C-': fzr() based keybinding: used to move over standalone terminal 
applications BACK into Tmux
bind-key -n "C-'" new-window -c $HOME \; \
         send-keys 'fzr && tmux kill-window' 'Enter'
# M-\: fzl() based keybinding: used for Fuzzy Finder Locate to look for files 
throughout the entire system
bind-key -n 'M-\' new-window -n locate \; send-keys "fzl && tmux kill-window\n"

# Copy & Paste Keybindings:
# Enable vim style keybindings for copying and pasting:
set-window-option -g mode-keys vi
bind-key Escape copy-mode                       # enter copy mode; default [
bind-key p paste-buffer                         # paste; (default hotkey: ] )
bind-key P choose-buffer                        # tmux clipboard history
bind-key + delete-buffer \; display-message "Deleted current Tmux Clipboard 
History"

# Send To Tmux Clipboard or System Clipboard
bind-key < run-shell "tmux set-buffer -- \"$(xsel -o -b)\"" \; display-message 
"Copy To Tmux Clipboard"
bind-key > run-shell 'tmux show-buffer | xsel -i -b' \; display-message "Copy 
To System Clipboard"

# vim copy mode rebinds for (tmux 2.4+)
# Note: rectangle-toggle (aka Visual Block Mode) > hit v then C-v to trigger it
bind-key -T copy-mode-vi v send-keys -X begin-selection; 
bind-key -T copy-mode-vi V send-keys -X select-line;
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle; 
bind-key -T choice-mode-vi h send-keys -X tree-collapse ;
bind-key -T choice-mode-vi l send-keys -X tree-expand ;
bind-key -T choice-mode-vi H send-keys -X tree-collapse-all ; 
bind-key -T choice-mode-vi L send-keys -X tree-expand-all ;
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -in 
-selection clipboard"; 
bind-key -T copy-mode-vi y send-keys -X copy-pipe "xclip -in -selection 
clipboard";`

On Wed, Jul 14, 2021, at 7:54 AM, David Anthony wrote:
> Thank you everyone for your helpful responses.
> 
> Initially I was trying to synchonize with keyboard shortcuts on my
> Macbook (i.e., use Vim + Tmux similarly across all operating systems),
> but it proved unfruitful due to complications around remapping the
> Command key on MacOS. I was also trying to use mouse mode in Tmux which
> was adding to my frustrations...
> 
> I am now quite happy with my setup on OpenBSD and I'll be pasting
> excerpts from my CWM/Xterm/Tmux/Vim config files here:
> 
> ~/.cwmrc
>    bind-key 4-l     lock
>    bind-key C-Left  group-rcycle
>    bind-key C-Right group-cycle
>    unbind-key M-Left
>    unbind-key M-Right
> 
> ~/.Xdefaults
>    XTerm*selectToClipboard:true
> 
> ~/.tmux.conf
>    #set -g mouse on
>    #setw -g mode-keys vi
>    # Copy / Paste
>    #bind-key -T copy-mode-vi C-c send-keys -X copy-pipe-and-cancel "xclip
>    -selection clipboard;" # no longer needed with mouse mode disabled
>    bind-key -n C-v run "xclip -out -selection clipbard | tmux load-buffer
>    -; tmux paste-buffer;"
>    
>    # Resize Panes
>    bind -n C-w resize-pane -U 5
>    bind -n C-s resize-pane -D 5
>    bind -n C-a resize-pane -L 5
>    bind -n C-d resize-pane -R 5
> 
> ~/.vimrc
>    set expandtab
>    set shiftwidth=4
>    set tabstop=4
>    syntax on
> 
> Respectfully,
> David Anthony
> 
> On Mon, 2021-07-12 at 17:12 -0400, David Anthony wrote:
> > Hello,
> > 
> > Does anyone using the combination of CWM+Xterm+Tmux+Vim have any advice
> > for dealing with Copy/Paste? To/From Browser?
> > 
> > It feels like I'm dealing with multiple "layers" of keybindings and I'm
> > curious if anyone has devised a simple unified solution.
> > 
> > Respectfully,
> > David Anthony
> > 
> 
> 
> 

Reply via email to