Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"set-window-option -g mode-keys vi" doesn't work in .tmux.conf

Tags:

vim

tmux

I've been able to turn-on the vi-mode inside tmux successfully by pressing C-a : (I've changed default prefix) and then typing set-window-option mode-keys vi. However, I can't make it stick by adding into ~/.tmux.conf. Here is my config:

# Change default prefix key to C-a
unbind-key C-b
set -g prefix 'C-a'
bind-key 'C-a' send-prefix

# Configure Vim mode for navigating text and selection
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

# Allow navigating panes with vi-like commands.
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R

Notably, navigating panes using kjhl keys also doesn't work. Perhaps this is because tmux fails to execute set-window-option earlier in the script. What's wrong here?

like image 461
Sergiy Belozorov Avatar asked May 30 '16 18:05

Sergiy Belozorov


People also ask

How do I enable vi mode in tmux?

Default keybinding to get into copy mode is prefix+[ . If you are a vim user you will likely want to use vi style keys, add this to your ~/. tmux. conf file to enable vi mode.

What is SETW in tmux?

set-window-option (alias setw ) is used to configure window options ( allow-rename , mode-keys , synchronize-panes , etc.)

What is vi mode in tmux?

tmux offers a set of vi-like bindings for navigating a buffer in a window. These allow you to not only navigate through the buffer beyond what your screen is currently showing, but also to search all the output generated thus far, and to select and copy text that can be pasted in any other window in the tmux session.


1 Answers

Try using setw -g mode-keys vi

like image 166
Sardorbek Imomaliev Avatar answered Oct 17 '22 10:10

Sardorbek Imomaliev