Vim inserts a new line when entering insert mode. Obviously I find this frustrating. It happens in remote servers and locally on OSX in iTerm2.

Here's my .vimrc:

" Use the monokai theme
set background=dark
colorscheme monokai

" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard+=unnamed

" Use UTF-8 without BOM
set encoding=utf-8 nobomb

" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
" Enable line numbers
set number
" Enable syntax highlighting
syntax on
" Highlight current line
set cursorline
" Make tabs as wide as two spaces
set tabstop=4
" Show “invisible” characters
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
set list
" Highlight searches
set hlsearch
" Ignore case of searches
set ignorecase

" Enable mouse in all modes
set mouse=a
" Disable error bells
set noerrorbells
" Don’t reset cursor to start of line when moving around.
set nostartofline
" Show the cursor position
set ruler
" Don’t show the intro message when starting Vim
set shortmess=atI
" Show the current mode
set showmode
" Show the filename in the window titlebar
set title

" Strip trailing whitespace (,ss)
function! StripWhitespace()
    let save_cursor = getpos(".")
    let old_query = getreg('/')
    call setpos('.', save_cursor)
    call setreg('/', old_query)
  • 2
    How are you entering insert mode? There are many different approaches, most of them do not...
    – jasonwryan
    Mar 7, 2015 at 3:08
  • Hmm good point because it does not always happen. Almost always esc i Mar 7, 2015 at 3:26
  • 1
    That shouldn't introduce a new line. Try it without your .vimrc...
    – jasonwryan
    Mar 7, 2015 at 3:28
  • 3
    Are you absolutely sure you're typing i and not o? Mar 7, 2015 at 20:12
  • Are you entering insert mode using "o' or "O". These open a line. Try using i, I, a or A Mar 12, 2015 at 15:48


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.