aboutsummaryrefslogtreecommitdiff
path: root/tmux
diff options
context:
space:
mode:
authoromagdy <omar.professional8777@gmail.com>2024-11-24 02:48:09 +0200
committeromagdy <omar.professional8777@gmail.com>2024-11-24 02:48:09 +0200
commit26f79296d67e7fdce48361fb1dfc1533f2ebddc1 (patch)
tree8df9d831a03d69e6fdd9267862660c03b3973bfa /tmux
parent3fddb9dc1729ba19b71d01e69aba7d98e528a181 (diff)
downloaddotfiles-26f79296d67e7fdce48361fb1dfc1533f2ebddc1.tar.xz
dotfiles-26f79296d67e7fdce48361fb1dfc1533f2ebddc1.zip
Added better options and shortcuts for tmux
Diffstat (limited to 'tmux')
-rw-r--r--tmux/.tmux.conf128
1 files changed, 123 insertions, 5 deletions
diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf
index b8fe0ab..d3794a3 100644
--- a/tmux/.tmux.conf
+++ b/tmux/.tmux.conf
@@ -1,3 +1,123 @@
+# Increase scrollback buffer size
+set -g history-limit 10000
+
+# Start window and pane numbering from 1 for easier switching
+set -g base-index 1
+setw -g pane-base-index 1
+
+# Allow automatic renaming of windows
+set -g allow-rename on
+# set -g automatic-rename off
+
+# Renumber windows when one is removed.
+set -g renumber-windows on
+
+# Improve colors
+set -g default-terminal "${TERM}"
+
+# Enable undercurl
+set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
+
+# Enable undercurl colors
+set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
+
+# Allow tmux to set the terminal title
+set -g set-titles on
+
+# Monitor window activity to display in the status bar
+setw -g monitor-activity on
+
+# A bell in another window should cause a bell in the current window
+set -g bell-action any
+
+# Don't show distracting notifications
+set -g visual-bell off
+set -g visual-activity off
+
+# Focus events enabled for terminals that support them
+set -g focus-events on
+
+# Useful when using sharing a session with different size terminals
+setw -g aggressive-resize on
+
+# don't detach tmux when killing a session
+set -g detach-on-destroy off
+
+# address vim mode switching delay (http://superuser.com/a/252717/65504)
+set -s escape-time 0
+
+set -as terminal-features ",*:RGB"
+# set -g default-terminal "tmux-256color"
+set -ag terminal-overrides ",xterm-256color:RGB"
+#--------------------------------------------------------------------------
+# Status line
+#--------------------------------------------------------------------------
+
+# Status line customisation
+set-option -g status-left-length 100
+# set-option -g status-right-length 100
+set-option -g status-left " #{session_name} "
+set-option -g status-right " "
+
+# set-option -g status-style "fg=#7C7D83 bg=#18242e" # ayu
+# set-option -g status-style "fg=#7C7D83 bg=#16151d" # tokyo night
+# set-option -g status-style "fg=#7C7D83 bg=#24282f" # one dark
+set-option -g status-style "fg=#7C7D83 bg=default" # gruvbox dark
+# set-option -g status-style "fg=#828bb1 bg=default" # default will set the background to transparent
+
+set-option -g window-status-format "#{window_index}:#{window_name}#{window_flags} " # window_name -> pane_current_command
+set-option -g window-status-current-format "#{window_index}:#{window_name}#{window_flags} "
+set-option -g window-status-current-style fg=#fabd2f #for gruvbox use: dcc7a0 or aeb6ff
+
+#--------------------------------------------------------------------------
+# Key Bindings
+#--------------------------------------------------------------------------
+
+# -r means that the bind can repeat without entering prefix again
+# -n means that the bind doesn't use the prefix
+
+# Smart pane switching with awareness of vim splits
+is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
+bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
+bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
+bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
+bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
+
+# Switch between two most recently used windows
+bind Space last-window
+
+# switch between two most recently used sessions
+bind b switch-client -l
+
+# open lazygit in a new window with prefix+g
+bind-key g new-window -n lazygit -c "#{pane_current_path}" "lazygit"
+
+# open an application in a new window with prefix+o, and allow me to provide the app name
+bind-key o command-prompt -p "open app: " "new-window '%%'"
+
+# show a promp to kill a window by id with prefix+X
+bind-key X command-prompt -p "kill window: " "kill-window -t '%%'"
+
+# use prefix+| (or prefix+\) to split window horizontally and prefix+- or
+# (prefix+_) to split vertically also use the current pane path to define the
+# new pane path
+bind | split-window -h -c "#{pane_current_path}"
+bind - split-window -v -c "#{pane_current_path}"
+
+# change the path for newly created windows
+bind c new-window -c "#{pane_current_path}"
+
+bind C-e display-popup -E "\
+ tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
+ sed '/^$/d' |\
+ fzf --reverse --header jump-to-session |\
+ xargs tmux switch-client -t"
+
+# Move tmux status bar to top
+bind-key C-k run-shell "tmux set-option -g status-position top;"
+# Move tmux status bar to bottom
+bind-key C-j run-shell "tmux set-option -g status-position bottom;"
+
unbind r
unbind '"'
unbind %
@@ -11,11 +131,11 @@ bind - split-window -v -c "#{pane_current_path}"
set -g base-index 1
set -g pane-base-index 1
-set-window-option -g pane-base-index 1
+# set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# Makes that when killing a session tmux doesn't detach
set-option -g detach-on-destroy off
-set-option -sg escape-time 10
+set-option -sg escape-time 0
set -g prefix C-s
@@ -26,12 +146,10 @@ bind-key k select-pane -U
bind-key l select-pane -R
bind-key b set-option status
-
-
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
-set -g @plugin 'niksingh710/minimal-tmux-status'
set -g @plugin 'christoomey/vim-tmux-navigator'
+# set -g @plugin 'niksingh710/minimal-tmux-status'
set -g status-position bottom