0

Running Ubuntu 15 and have tmux session open. Inside that session I open vim and hit Ctrl-p and start search for a file. When I hit the up arrow nothing happens.

If I do not open tmux and just open vim ctrl-p works just fine. Thoughts?

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>

Here is what my terminal looks like when running tmux

enter image description here

Here how it looks without tmux

enter image description here

13
  • Is <C-p> mapped to something in your .tmux.conf? <C-b><C-?> in tmux should display all of your active key mappings Aug 28, 2015 at 16:58
  • Does not look like it
    – jrock2004
    Aug 28, 2015 at 17:06
  • My apologies, I misread your question. Try setting the xterm-keys option: setw -g xterm-keys on. Aug 28, 2015 at 17:14
  • E492: Not an editor command: setw -g xterm-keys on
    – jrock2004
    Aug 28, 2015 at 17:57
  • "E492: Not an editor command:" --> clearly a vim error, but the suggestion was a xterm setting
    – mMontu
    Aug 28, 2015 at 19:01

1 Answer 1

3

Try deactivating your Vim plugins (other than CtrlP) and see if the behavior corrects itself. That will tell you if one of the other plugins is interfering.

Your screenshots indicate that the colors differ when tmux is running. I notice that your .vimrc indicates 256-color mode:

set t_Co=256

Are you running tmux in 256-color mode?

tmux -2

I also wonder if you should not be declaring the tmux_navigator settings before you load the plugin via Vundle, e.g. move these two lines to before Vundle loads.

let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 1
3
  • what does tmux -2 do? starting tmux this way fixed it
    – jrock2004
    Sep 3, 2015 at 17:45
  • It starts tmux in a mode that assumes a 256-color capable terminal.
    – Dan Lowe
    Sep 3, 2015 at 17:45
  • sweet, well I just added an alias to always put that. Thanks
    – jrock2004
    Sep 3, 2015 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.