summaryrefslogtreecommitdiff
path: root/config/common/tmux/tmux.conf
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-02-15 16:31:56 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-02-15 16:47:43 +0100
commit3b2a78935fd6550521f719a10e5b0fceb1ddb350 (patch)
tree7c50801d6bb5b7abba3df6352ed43df454a4dbcb /config/common/tmux/tmux.conf
Not really but, First commit!
Diffstat (limited to 'config/common/tmux/tmux.conf')
-rwxr-xr-xconfig/common/tmux/tmux.conf186
1 files changed, 186 insertions, 0 deletions
diff --git a/config/common/tmux/tmux.conf b/config/common/tmux/tmux.conf
new file mode 100755
index 0000000..7508667
--- /dev/null
+++ b/config/common/tmux/tmux.conf
@@ -0,0 +1,186 @@
+#
+# By Nicholas Marriott. Public domain.
+# but -now- me.
+#
+
+
+###########################################################################
+################# MISC. ###################################################
+###########################################################################
+###########################################################################
+# Some tweaks to the status line
+set -g status-right "%H:%M"
+set -g window-status-current-style "underscore"
+
+# If running inside (nested) tmux ($TMUX is set), then change the status line to red
+%if #{TMUX}
+set -g status-bg red
+%endif
+
+# Enable RGB color if running in xterm
+set-option -sa terminal-overrides ",xterm*:Tc"
+
+# Change the default $TERM to xterm-256color
+# Necessary because vim ctrl arrows must be defined through TERM
+set -g default-terminal "xterm-256color"
+set-window-option -g xterm-keys on
+
+# No bells at all
+set -g bell-action none
+
+# Keep windows around after they exit
+set -g remain-on-exit off
+
+# More history lines
+set -g history-limit 16384
+
+# Base window is Numero Uno
+set -g base-index 1
+set-window-option -g pane-base-index 1
+
+# Set vi mode when copying
+set-window-option -g mode-keys vi
+# compatibility with vim for focus based events
+set -g focus-events on
+
+###########################################################################
+################# KEYBINDINGS #############################################
+###########################################################################
+###########################################################################
+
+
+# Reload config file
+unbind r
+bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
+
+########## CLIPBOARD ##########
+unbind -T copy-mode-vi Space; #Default for begin-selection
+unbind -T copy-mode-vi Enter; #Default for copy-selection
+bind -T copy-mode-vi v send-keys -X begin-selection
+bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard"
+bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard"
+
+# Unbind ESC
+set -sg escape-time 0
+
+# Toggle status bar
+unbind t
+bind t set-option status
+
+# Toggle monitoring window activity
+bind m set monitor-activity\; display 'monitor-activity #{?monitor-activity,on,off}'
+
+bind M run-shell "tmux set monitor-silence #{?monitor-silence,0,10}"\; display "monitor-silence #{?monitor-silence,on,off}"
+
+
+
+
+# if-shell "true" {
+# if-shell "#{?monitor-silence,true,false}" {
+# set monitor-silence 0
+# }
+# if-shell "#{?monitor-silence,false,true}" {
+# set monitor-silence 10
+# }
+# display "monitor-silence #{?monitor-silence,on,off} #{monitor-silence}"
+# }
+
+# Toggle synchronized panes (sending keys to every pane)
+unbind y
+bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'
+
+# Paste from tmux buffer
+unbind p
+bind p paste-buffer
+
+# Kill all windows
+bind x confirm -p "Kill Pane?" kill-pane
+bind X confirm -p "Kill Window?" kill-window
+bind M-x confirm -p "Kill Session?" kill-session
+bind M-X confirm -p "Kill Server?" kill-server
+# Restart pane
+bind k run -C "respawn-pane -k; send-keys !! 'C-j'"
+
+########## SPLIT AND SWAP ###########
+# Splitting
+unbind v
+bind v split-window -h -c "#{pane_current_path}"
+unbind h
+bind h split-window -v -c "#{pane_current_path}"
+# Swapping left and right a la vim
+unbind -n M-H
+unbind -n M-L
+bind -n M-H swap-pane -U
+bind -n M-L swap-pane -D
+## Resizing panes
+bind -r C-H resize-pane -L 5
+bind -r C-J resize-pane -D 5
+bind -r C-K resize-pane -U 5
+bind -r C-L resize-pane -R 5
+
+## Default keybindings for resizing
+unbind C-Up
+unbind C-Left
+unbind C-Down
+unbind C-Right
+unbind M-Up
+unbind M-Left
+unbind M-Down
+unbind M-Right
+
+# Join and break windows
+unbind j
+bind j command-prompt -1p "Take window:" "join-pane -s %%"
+unbind J
+bind J command-prompt -1p "Send to window:" "join-pane -t \:%% ; select-window -l"
+# Break pane without losing focus
+unbind b
+bind b break-pane -t :
+# Reset length and shit
+unbind z
+bind z select-layout main-vertical
+
+########## NAVIGATION ##########
+# Pane navigating with h|j|k|l a la vim
+unbind -n M-h
+unbind -n M-j
+unbind -n M-k
+unbind -n M-l
+bind -n -N "select leftwards pane" M-h select-pane -L
+bind -n -N "select downwards pane" M-j select-pane -D
+bind -n -N "select upwards pane" M-k select-pane -U
+bind -n -N "select rightwards pane" M-l select-pane -R
+# Window navigating with M-u|i
+unbind -n M-u
+unbind -n M-i
+bind -n M-u previous-window
+bind -n M-i next-window
+# Session navigeting with S-M-u|i
+unbind -n M-y
+unbind -n M-o
+bind -n M-U switch-client -p
+bind -n M-I switch-client -n
+
+########## Windows ##########
+# Rename window and open new window
+unbind n # DEFAULT KEY: move to next window
+unbind N
+unbind w # DEFAULT KEY: change current window interactively aka choose-tree -zW
+bind n command-prompt "rename-window '%%'"
+bind N command-prompt "rename-session '%%'"
+# Start new window where tmux started, will be home because of xmonad
+bind w new-window -c "#{pane_current_path}" #-c "#{pane_current_path}"
+bind W new-session -c "$HOME"
+
+# Show tree
+unbind S
+bind S choose-tree -Z
+
+# Turn the mouse on, but without copy mode dragging
+# set -g mouse on
+# unbind -n MouseDrag1Pane
+# unbind -T copy-mode MouseDrag1Pane
+
+# Menu for mounting and ejecting devices.
+unbind E
+bind E display-menu -T "#[align=centre]#I:#W" -x W -y W '' Mount 0 "display-popup -E 'amount'"