I'm having an issue with vim startup. Whenever I run vim somefile, it starts as though I pressed c just after startup. So, if I then try to immediately jump to the end of the file with G, it instead changes to the end of the file, i.e. all the lines from the startup line to the end of the file are gone and I'm in insert mode. I'm using terminal vim rather than MacVim, and my shell is zsh in case that's relevant. I'm using the base 16 tomorrow 256-color scheme in both my shell and in vim—dark for the shell and the light incarnation for vim. I'm using the Janus configuration with pretty minimal customization.

Here are the things I've tried to find the problem:

  1. Comment out everything from my .vimrc.after file except colorscheme and font declarations. No change.
  2. Disable my base16 color scheme commands in iTerm2 and vim. Thought maybe the 256 color shell script was causing an issue, but no dice.
  3. Removed the one custom plugin I have in Janus (Emmet). No difference.
  4. Changed colorscheme to a non-base16 scheme. No difference.

The only real difference I've been able to find is between iTerm2 and Terminal.app. In Terminal.app, the change command seems to be limited to a single line no matter what motion command I type immediately after startup. So, if I type G after opening a file, it does not remove all the lines below. It just deletes the line it is on and enters insert mode.

Another couple pieces of evidence: 1) If I open a directory with vim path/to/directory, I get slightly different behavior from Terminal.app and iTerm2. In iTerm2, there's no apparent issue. In Terminal.app, I get E481: No range allowed message at the bottom of the window. 2) If I use MacVim, the behavior is not present as far as I can tell. This makes me think it's something to do with my shell environment. Both Terminal.app and iTerm2 have their terminal reporting set to xterm-256color.

So, that's the situation. Below are the contents of my relevant vim files. While a solution to the issue will be helpful, I'm more interested in learning to fish here. Part of my frustration with vim in the past was that it would sometimes do things I didn't understand. Sometimes through typos or fat fingering commands or something, but nevertheless, I didn't know what I did to cause the bizarre behavior so that I could avoid it in the future. I'm in that same boat here. I don't want to know just how to fix it but what was going wrong and some sort of methodology for tracking down the problem that I could maybe apply to future issues. Thanks in advance!


set nocompatible
let mapleader=","
set splitbelow
set splitright
call janus#disable_plugin('nerdtree')
if has("gui_running")
  let g:loaded_netrw        = 1 " Disable netrw
  let g:loaded_netrwPlugin  = 1 " Disable netrw


"" Janus setup

" Define paths
"let g:janus_path = escape(fnamemodify(resolve(expand("<sfile>:p" . "janus" . "janus")), ":h"), ' ')
"let g:janus_vim_path = escape(fnamemodify(resolve(expand("<sfile>:p" . "janus" . "janus" . "vim")), ":h"), ' ')"

let g:home_path = expand("~")
let g:vim_path = g:home_path . "/.dotfiles/vim"
let g:janus_path = g:vim_path . "/janus/janus"
let g:janus_vim_path = g:janus_path . "/vim"

let g:janus_custom_path = g:vim_path . "customization"

if filereadable(g:janus_vim_path . '/core/before/plugin/janus.vim')
    " Source janus's core
    exe 'source ' . g:janus_vim_path . '/core/before/plugin/janus.vim'

    " You should note that groups will be processed by Pathogen in reverse
    " order they were added.
    call janus#add_group("tools")
    call janus#add_group("langs")
    call janus#add_group("colors")

    "" Customisations

    if filereadable(expand("~/.vimrc.before"))
      source ~/.vimrc.before

    " Disable plugins prior to loading pathogen
    exe 'source ' . g:janus_vim_path . '/core/plugins.vim'

    "" Pathogen setup

    " Load all groups, custom dir, and janus core
    call janus#load_pathogen()

    " .vimrc.after is loaded after the plugins have loaded


let base16colorspace=256  " Access colors present in 256 colorspace
set background=light
colorscheme base16-tomorrow
set guifont=Panic\ Sans:h13

"set tabstop=4
"set shiftwidth=4
"set softtabstop=4
"set expandtab

"let g:user_emmet_install_global = 0
"autocmd FileType html,css,eruby,eruby-rails EmmetInstall

" window
nmap <leader>sw<left>  :topleft  vnew<CR>
nmap <leader>sw<right> :botright vnew<CR>
nmap <leader>sw<up>    :topleft  new<CR>
nmap <leader>sw<down>  :botright new<CR>

" buffer
nmap <leader>s<left>   :leftabove  vnew<CR>
nmap <leader>s<right>  :rightbelow vnew<CR>
nmap <leader>s<up>     :leftabove  new<CR>
nmap <leader>s<down>   :rightbelow new<CR>

" clear search highlight
nnoremap <esc> :noh<return><esc>

" exit insert mode when beginning text movements
:imap jj <Esc>
:imap jk <Esc>
:imap kk <Esc>
:imap kj <Esc>

set clipboard=unnamed

"Helpful stuff from Steve Losh
set list
set listchars=tab:▸\ ,eol:¬ "Change the invisible character display characters.

set wrap
set textwidth=79
set formatoptions=qrn1
set colorcolumn=85

nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
"nnoremap <leader><space> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %

set encoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set relativenumber
set undofile

nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap j gj
nnoremap k gk

inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>

" Save on focus lost
au FocusLost * :wa


call janus#disable_plugin('NERDtree')


" Override existing colorscheme with version found in
" ~/.janus/<colorscheme>/colors/<colorscheme>.vim
if exists("g:colors_name") 
  let color_override = expand('~/.janus/' . g:colors_name . '/colors/' . g:colors_name . '.vim')
  if filereadable(color_override)
    exe 'source ' . color_override

set background=light
colorscheme base16-tomorrow
set guifont=Panic\ Sans:h13

1 Answer 1


This previous question seems to solve my issue. Vim has unexpected key presses on startup, what could be causing this? I did see that :echo v:termresponse contained the offending c character that caused the issue and setting set t_RV= ttymouse=xterm2 did indeed magically fix the problem, but like the OP there, I have no idea why this was the issue, how the answerer knew to check :echo v:termresponse, or how set t_RV= ttymouse=xterm2 entered the answerer's mind as something to type into a vim config file to resolve it.

  • And to complicate things further you are using one of those distributions that do a lot of things behind your back. Get rid of that piece of crap and configure your vim yourself.
    – romainl
    Aug 11, 2014 at 16:31
  • Are you saying I might not have had this problem without Janus or just that it goes to my not quite understanding vim? My understanding is that Janus goes a long way to making vim a little more comfortable for people that are coming from TextMate like me. I may not fully understand but saying "Don't use Janus" sounds to me like telling someone who's new to Ruby to not use Rails because of all the stuff it adds.
    – jxpx777
    Aug 11, 2014 at 17:30
  • 1
    Don't use Janus because it actively prevents you from understanding and learning Vim. Don't use Janus because it turns something simple (configuring Vim) into something unnecessarily complex. Don't use Janus because that added complexity makes it hard for you and others to figure out what's going wrong. Don't use Janus because it's someone else's config… And yeah, Rails is useful if you want to learn Rails but totally useless if you want to learn Ruby. Same for jQuery versus JavaScript and so on.
    – romainl
    Aug 11, 2014 at 19:35
  • Still sounds like for this particular issue, Janus didn't contribute anything at all to the issue and even without Janus I wasn't any closer to actually understanding what the problem was or how to approach ferreting out the issue. I appreciate your POV re: Janus, but it's not exactly salient to the discussion of this issue.
    – jxpx777
    Aug 12, 2014 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .