You are not logged in.

#1 2020-03-11 11:01:20

riddle00
Member
From: Lithuania
Registered: 2015-05-26
Posts: 81

tmux+vim+ranger (or other cmd file manager) seamless integration

I am using tmux and vim with plugin 'christoomey/vim-tmux-navigator', I've mapped the tmux panes/vim splits navigation keys this way:

# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(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"

I am really liking ranger, although I am also interested in trying midnight commander and vifm file managers. However, when I open the file through any of them in vim (since it's my $EDITOR), these keybindings do not work between vim splits (NERDTree also being one of them). They do work between tmux panes though. The default vim `<C-W>h, <C-W>j, <C-W>k, <C-W>l`  shortcuts  also work.

The problem appears only then I use tmux, but I actually never leave tmux when I am inside the terminal, and it's how I want it to be. I tried remapping these shortcuts to other keybindings both in `.vimrc` and in `.tmux.conf`, but they still do not work.

These shortcuts do work in tmux when I open the file in vim without using command line file manager, and also work perfectly while using these file managers (ranger, vifm, mc), but without tmux.

If this topic is too specific for arch linux newbie corner, let me know.

my .vimrc
my .tmux.conf
my ranger config

Last edited by riddle00 (2020-03-11 11:04:18)


Vim is not just an editor (...); it is for all intents and purposes a universal design pattern. --  Jason Ryan

Offline

Board footer

Powered by FluxBB