tmux ctrl 箭头键不起作用

tmux ctrlp arrow keys not workin

运行 Ubuntu 15 并打开 tmux 会话。在该会话中,我打开 vim 并按 Ctrl-p 并开始搜索文件。当我点击向上箭头时,没有任何反应。

如果我不打开 tmux 而只是打开 vim ctrl-p 就可以了。想法?

tmux.conf

setw -g xterm-keys on

# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+

# act like GNU screen
unbind C-b
set -g prefix C-a

# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1

# renumber windows sequentially after closing any of them
set -g renumber-windows on

# soften status bar color from harsh green to light gray
set -g status-bg '#666666'
set -g status-fg '#aaaaaa'

# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''

# increase scrollback lines
set -g history-limit 10000

# switch to last pane
bind-key C-a last-pane

# Local config
if-shell "[ -f ~/.tmux.conf.local  ]" 'source ~/.tmux.conf.local'

Vimrc

set nocompatible

let mapleader = ","

set backspace=2
set nobackup
set nowritebackup
set noswapfile
set history=50
set ruler
set showcmd
set incsearch
set laststatus=2
set autoread

set ignorecase
set smartcase

set tabstop=2
set shiftwidth=2
set shiftround

set list listchars=tab:»·,trail:·,nbsp:·

set textwidth=80
set colorcolumn=+1

"set number

set splitbelow
set splitright

set winwidth=84
set winheight=5
set winminheight=5
set winheight=999

set matchpairs+=<:>

" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'

set scrolloff=8
set sidescrolloff=15
set sidescroll=1

" Load up all of our plugins
if filereadable(expand("~/.vimrc.bundles"))
    source ~/.vimrc.bundles
endif

filetype plugin indent on

" Dynamic line numbers
set rnu
function! ToggleNumbersOn()
    set nu!
    set rnu
endfunction
function! ToggleRelativeOn()
    set rnu!
    set nu
endfunction
autocmd FocusLost * call ToggleRelativeOn()
autocmd FocusGained * call ToggleRelativeOn()
autocmd InsertEnter * call ToggleRelativeOn()
autocmd InsertLeave * call ToggleRelativeOn()

map <Esc>[B <Down>]

Vimrc.bundles

if &compatible
    set nocompatible
end

filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
Plugin 'gmarik/Vundle.vim'

Plugin 'christoomey/vim-tmux-navigator'
Plugin 'christoomey/vim-tmux-runner.git'
Plugin 'christoomey/vim-run-interactive'
Plugin 'vim-scripts/ctags.vim'
Plugin 'scrooloose/syntastic' "Syntax Highlighting
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter.git'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'ervandew/supertab'
Plugin 'vim-scripts/tComment'
Plugin 'vim-scripts/HTML-AutoCloseTag'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tpope/vim-fugitive' "Make git awesome
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'

Plugin 'Slava/vim-spacebars'
Plugin 'groenewege/vim-less'
Plugin 'godlygeek/tabular'

Plugin 'romainl/Apprentice'
Plugin 'morhetz/gruvbox'
Plugin 'bling/vim-airline' "Awesome looking meta at bottom
Plugin 'majutsushi/tagbar'

Plugin 'vim-scripts/matchit.zip'
Plugin 'vimwiki/vimwiki'
Plugin 'mattn/calendar-vim'

call vundle#end()
filetype on

set t_Co=256
set background=dark
colorscheme gruvbox
syntax enable

" Plugin Tweaks
nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>

"tmux integration
let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 1

map <C-n> :NERDTreeToggle<cr>
nnoremap <C-t> :call ToggleRelativeOn()<cr>

" Ctrlp Settings
let g:ctrlp_custom_ignore = 'node_modules\|bower_components\|git'

" mapping for Vimwiki
autocmd FileType vimwiki map <leader>c :call ToggleCalendar() <cr>

let g:vimwiki_list = [{'path':'$HOME/Dropbox/vimwiki'}]

let g:airline_powerline_fonts = 1
let g:syntastic_check_on_open=1

map <Leader>ct :!ctags -R .<CR>

function! ToggleCalendar()
    execute ":Calendar"
    if exists("g:calendar_open")
        if g:calendar_open == 1
            execute "q"
            unlet g:calendar_open
        else
            g:calendar_open = 1
        end
    else
        let g:calendar_open = 1
    end
endfunction

" Setting up keyboard shortcuts for tabular
if exists(":Tabularize")
    nmap <Leader>a= :Tabularize /=<CR>
    vmap <Leader>a= :Tabularize /=<CR>
    nmap <Leader>a: :Tabularize /:\zs<CR>
    vmap <Leader>a: :Tabularize /:\zs<CR>
endif

" Tagbar settings
nmap <F8> :TagbarToggle<CR>

这是我的终端在 运行 tmux

时的样子

这是没有 tmux 的样子

尝试停用您的 Vim 插件(CtrlP 除外)并查看行为是否自行纠正。这会告诉您是否有其他插件在干扰。

您的屏幕截图表明当 tmux 为 运行 时颜色不同。我注意到您的 .vimrc 表示 256 色模式:

set t_Co=256

你 运行 tmux 是 256 色模式吗?

tmux -2

我还想知道您是否不应该在通过 Vundle 加载插件之前 声明 tmux_navigator 设置 ,例如将这两行移动到 Vundle 加载之前。

let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 1