NVIM v0.2.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/config -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/src/nvim/auto -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/include
Compiled by brew@HighSierra.local

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.2.2_1/share/nvim"

Run :checkhealth for more info


After running some git commands with fugitive, the cursor is placed at the end, for e.g:

[Process Exited 0]_

and I just need to press enter to back to the previous buffer.


If I do the same, the cursor is placed at the beginning and I have to type :bd(!) to close that buffer.

What caused this? How to back to previous behaviour?


set backup
let day = strftime("%Y-%m-%d")
let user = substitute(system('whoami'), '\n', '', '')
if user == 'root'
    let backupdir = "/var/root/.vim/backup/".day
    let backupdir = $HOME."/.vim/backup/".day
silent! let xyz = mkdir(backupdir, "p")
let cmd = "set backupdir=".backupdir
execute cmd
let time = strftime(".%H:%M:%S")
let cmd = "set backupext=".time
execute cmd

syntax on
set number
set background=dark
let g:solarized_termcolors = 256
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
let g:solarized_termtrans = 1
colorscheme solarized

autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab

set clipboard=unnamed
execute pathogen#infect()
let g:SuperTabDefaultCompletionType = "context"

filetype off

set nocompatible
filetype plugin indent on
autocmd BufRead,BufNewFile *.jinja2 set filetype=jinja

nnoremap <F6> :GundoToggle<CR>

au BufNewFile *.jinja2 so ~/.vim/header/jinja_header.txt
au BufNewFile *.py so ~/.vim/header/py_header.txt
au BufNewFile *.sls so ~/.vim/header/sls_header.txt

let mapleader = "\<Space>"
nnoremap <Leader>o :CtrlP<CR>
nnoremap <Leader>w :w<CR>
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
nmap <Leader><Leader> V

vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)

" highlight excess line length (79)
autocmd Filetype py rst textwidth=79
set colorcolumn=+1

" disable folding
set nofoldenable
" end of disable folding

autocmd filetype crontab setlocal nobackup nowritebackup

let g:vim_json_syntax_conceal = 0

let g:ranger_map_keys = 0

set hidden
:nnoremap <Tab> :bnext<CR>
:nnoremap <S-Tab> :bprevious<CR>

set completeopt=longest,menuone

for fpath in split(globpath('~/.vimrc.d/', '*.vim'), '\n')
  exe 'source' fpath
  • Please also include your init.vim i.e. your Neovim configuration file. Mar 13 '18 at 9:20
  • @Ashok I updated the original question.
    – quanta
    Mar 13 '18 at 9:57
  • Actually i think it would be more useful to pare down to the smallest vimrc that reproduces this behavior, and more importantly to expand on the exact steps in order to reproduce the behavior
    – D. Ben Knoble
    Mar 13 '18 at 16:53

I ran into a similar (the same?) issue on two different installs:

  • NVIM v0.2.0
  • NVIM v0.3.1

As quanta already mentions this change in behavior might be due to the changes introduced in NVIM v0.2.1.

I have a shortcut for running things from within nvim, that splits the window, launches the terminal emulator in the new split view and executes there. After execution had completed in the terminal I used to be able to hit any key to close the terminal & split view and return to the original buffer, i.e.:

map <Leader>p :w<CR>:split \| terminal python %<CR>

...and this is still the case with the NVIM v0.2.0 install I refer to above but just pressing a key to close and return does not work any more on the v0.3.1 install.

What fixed this for me was to append a :startinsert command to the end of the key binding macro:

map <Leader>p :w<CR>:split \| terminal python %<CR>:startinsert<CR>

That puts the cursor into insert mode on the terminal view and closes it on key press right away - seems to do the trick!

  • Thanks, this was exactly what I was looking for!
    – Luca Guidi
    Nov 21 '19 at 11:09
  • Glad this is useful to others @LucaGuidi!
    – bossi
    Feb 27 '20 at 7:35

From version 0.2.1, :terminal now starts in normal mode instead of terminal mode: https://github.com/neovim/neovim/wiki/Following-HEAD#20170821

Btw, don't know why this does not enter Terminal mode automatically:

autocmd BufEnter term://* startinsert
autocmd BufLeave term://* stopinsert

I have to use:

autocmd TermOpen * startinsert

Your Answer

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

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