You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

129 lines
4.3 KiB

# $Id: vim-keys.conf,v 1.1 2010/01/17 16:24:09 nicm Exp $
#
# vim-keys.conf, v1.0 2010/01/15
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue.
# prefix is CTRL-B and CTRL-X
set -g prefix C-b
set -g prefix2 C-x
# enable CTRL-B and CTRL-X under other programs (like vim) - you'll have to press twice le combination to have the old one
bind C-b send-prefix
bind C-x send-prefix
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
# move around panes with j and k, a bit like vim
# as of tmux 1.1, there is no way to move based on pane position (ie, no way to
# move the pane to the right)
#bind j down-pane
#bind k up-pane
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt
# vi-style controls for copy mode
setw -g mode-keys vi
# Change the prefix key (screen friendly).
#set-option -g prefix C-a
#unbind-key C-b
#bind-key C-a last-window
# set-option -g default-terminal "screen-256color"
set-option -g status-keys vi
set-option -g bell-action any
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T'
set-option -g visual-bell on
#set-option -g -q mouse on
#bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
#bind-key -t vi-copy PPage page-up
#bind-key -t vi-copy NPage page-down
set-window-option -g xterm-keys on
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
setw -g mode-keys vi
setw -g monitor-activity on
bind C-j previous-window
bind C-k next-window
#bind -n M-Left select-pane -L
#bind -n M-Right select-pane -R
#bind -n M-Up select-pane -U
#bind -n M-Down select-pane -D
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
bind -n M-Up if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Up" "select-pane -U"
bind -n M-Down if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Down" "select-pane -D"
bind -n M-Left if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Left" "select-pane -L"
bind -n M-Right if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Right" "select-pane -R"
bind -n C-Right if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys C-Right" "next-window"
bind -n C-Left if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys C-Left" "previous-window"
#set-option -g status-utf8 on
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 40
set-option -g pane-active-border-style fg=green,bg=black
set-option -g pane-border-style fg=white,bg=black
set-option -g message-style fg=black,bg=green
setw -g window-status-style bg=black
setw -g window-status-current-style fg=green
set -g status-left '#[fg=red]#H#[fg=green]:#[fg=white]#S #[fg=green]][#[default]'
# this one draws the window title in the status bar, but eats up a lot of space
# set -g status-right '#[fg=green]][#[fg=white] #T #[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]'
set -g status-right '#[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]'
#Scroll up
bind -n S-Pageup copy-mode -u
# Scroll History
set -g history-limit 30000
#improve communication with vim
set -g focus-events on
#New pane in same directory
bind c new-window -c "#{pane_current_path}"
bind r source-file ~/.tmux.conf
# number windows starting from 1 - handy for direct access
set -g base-index 1
# Configure tmux buffer to clipbard
# Copy with y. paste with P
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -sel clip > /dev/null"
bind-key P run "xclip -o -sel clip | tmux load-buffer - ; tmux paste-buffer"