#+TITLE: My Tmux Config #+AUTHOR: Naz #+PROPERTY: header-args :tangle .config/tmux/tmux.conf :mkdirp yes #+STARTUP: showeverything #+OPTIONS: toc:nil #+auto_tangle: t * Table Of Content :toc: - [[#general-configurations][General Configurations]] - [[#enable-mouse][Enable Mouse]] - [[#window--pane-indexing][Window & Pane Indexing]] - [[#window-splitting][Window Splitting]] - [[#ui-configurations][UI Configurations]] - [[#colors-fix][Colors Fix]] - [[#status-bar-position][Status Bar Position]] - [[#key-bindings][Key Bindings]] - [[#prefix-key][Prefix Key]] - [[#clipboard][Clipboard]] - [[#session-selection][Session Selection]] - [[#vi-mode][Vi Mode]] - [[#plugin-management-tpm][Plugin Management (TPM)]] - [[#plugins][Plugins]] * General Configurations ** Enable Mouse #+begin_src conf set -g mouse on #+end_src ** Window & Pane Indexing Start windows and panes at 1, not 0. #+begin_src conf set -g base-index 1 set -g pane-base-index 1 set-window-option -g pane-base-index 1 set-option -g renumber-windows on #+end_src ** Window Splitting Use ~PREFIX s~ and ~PREFIX v~ instead of ~PREFIX %~ and ~PREFIX "~, and keep the current directory when splitting windows. #+begin_src conf unbind '%' unbind '"' bind s split-window -v -c "#{pane_current_path}" bind v split-window -h -c "#{pane_current_path}" #+end_src * UI Configurations ** Colors Fix I'm using this in Alacritty. If it doesn't work in your terminal emulator of choice, try the other methods below. #+begin_src conf set-option -as terminal-overrides ",xterm*:RGB" #+end_src *** Other Methods #+begin_example conf set -g default-terminal "$TERM" #+end_example #+begin_example conf set -ag terminal-overrides ",$TERM:Tc" #+end_example ** Status Bar Position #+begin_src conf set -g status-position top #+end_src * Key Bindings ** Prefix Key Use ~CTRL-Space~ as prefix instead of ~CTRL-B~. #+begin_src conf unbind C-b set -g prefix C-Space #+end_src ** Clipboard This part requires ~xclip~ to be installed. #+begin_src conf bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' #+end_src ** Session Selection #+begin_src conf bind S choose-session #+end_src ** Vi Mode #+begin_src conf set-window-option -g mode-keys vi #+end_src *** Window Navigation Remap ~PREFIX l~ to go to the next window, and ~PREFIX h~ to go to the previous window. #+begin_src conf bind l next-window bind h previous-window #+end_src *** Pane Resizing #+begin_src conf bind -n M-k resize-pane -U 1 bind -n M-j resize-pane -D 1 bind -n M-h resize-pane -L 2 bind -n M-l resize-pane -R 2 #+end_src * Plugin Management (TPM) I'm using [[https://github.com/tmux-plugins/tpm][TPM]] to manage my plugins. Please note that it's recommended to keep the follow line *at the very bottom of* ~tmux.conf~. #+NAME: run-tpm #+begin_src conf :tangle no run '~/.tmux/plugins/tpm/tpm' #+end_src ** Plugins #+begin_src conf :noweb yes set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'christoomey/vim-tmux-navigator' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'ndpm13/tmux-gruvbox-truecolor' # Initialize TMUX plugin manager. <> #+end_src