I have been trying to figure this one out for two weeks with no luck.
I am using Iterm2 on OSX, with tmux as the session manager. I have VIM setup with the following two bindings in the .vimrc
"_____Easy change tab left and right____
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <C-h> :tabprevious<CR>
nnoremap <C-l> :tabnext<CR>
Now the strange part is that the ctrl h and l shortcuts work perfectly while the left arrow says.
E349: No identifier under cursor
Which seems unrelated to what should be happening (It works perfectly outside of TMUX!), but checking my mappings using :map
does not show any conflicting mappings. But I just cannot figure this out. Any help at all would be greatly appreciated. Below is my tux.conf file. Since this works perfectly outside of tmux I don't believe the vimrc should have anything to do with this.
I have a feeling that its Iterm2 thats sending strange things to the terminal and tmux is misinterpreting them, but I have no idea how to fix it.
tmux.conf
#set -g default-terminal "xterm-256color"
set -sg escape-time 0
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# switch panes using Alt-arrow without prefix
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
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# don't rename windows automatically
set-option -g allow-rename off
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-S-Left previous-window
bind -n M-S-Right next-window
# Dont clear screen after other program is on
set-window-option -g alternate-screen on
#set-window-option -g xterm-keys on
If you uncommented these lines:
#set -g default-terminal "xterm-256color"
#set-window-option -g xterm-keys on
then tmux
would
TERM
environment variable to a terminal description which defines these keys, andWithout those two changes, TERM
is set to screen
(which doesn't define the keys), and tmux
will send different sequences for the control arrow-keys (which happen to not be in either terminal description).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With