Description
When I press go
in NERDTree window it usually switch current tab to first or second, I realized it only happens when I use my own remapping for gt
(I prefer it be relative when I specify {count}
for it, I use ,gt
as default gt
behavior):
nnoremap gt :<C-u>exec join(repeat(['tabnext'], v:count1), '\|')<CR>
xnoremap gt :<C-u>exec join(repeat(['tabnext'], v:count1), '\|')<CR>
nnoremap ,gt gt
xnoremap ,gt gt
When I remove these lines from my config everything goes well.
Environment: My config is pretty complex: https://github.com/unclechu/neovimrc (https://github.com/unclechu/neovimrc/tree/de98da753cfe6a2667b52fb03b565253a98226e2) but my point it is only connected to these map
s for gt
.
Anyway, you could reproduce it with this minimal config:
" Cloned NERDTree repo with 97433ed
set rtp+=./nerdtree
nnoremap gt :<C-u>exec join(repeat(['tabnext'], v:count1), '\|')<CR>
xnoremap gt :<C-u>exec join(repeat(['tabnext'], v:count1), '\|')<CR>
- Operating System: Fedora Workstation 25
- Vim version
:version
:
NVIM v0.2.0
Build type: Debug
Compilation: /usr/bin/cc -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/build/config -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/src -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/.deps/usr/include -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/.deps/usr/include -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/.deps/usr/include -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/.deps/usr/include -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/.deps/usr/include -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/.deps/usr/include -I/usr/include -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/build/src/nvim/auto -I/home/unclechu/.compile_n_build/neovim/neovim-0.2.0/build/include
Compiled by unclechu@fedorafarm25
Optional features included (+) or not (-): +acl +iconv +jemalloc +tui
For differences from Vim, see :help vim-differences
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/home/unclechu/neovim-v0.2.0/share/nvim"
- NERDTree version
git rev-parse --short HEAD
:97433ed
- NERDTree settings applied in your vimrc, if any:
let NERDTreeIgnore = ['\.swp', '\.swo', '\.pyc', '__pycache__']
let NERDTreeShowHidden = 1 " always show hidden files in NERDTree
let NERDTreeShowLineNumbers = 1
let NERDTreeWinSize = 40
let NERDTreeMapHelp = '<Leader>?' " heals backward search
let NERDTreeMapOpenSplit = 'ss'
let NERDTreeMapPreviewSplit = 'gss'
let NERDTreeMapOpenVSplit = 'sv'
let NERDTreeMapPreviewVSplit = 'gsv'
Process: List the steps that will recreate the issue.
- Open few tabs (for example four)
- Open some file in for example third tab
- Open NERDTree
- Press
go
on some file
Current Result:
I switched to another tab.
Expected Result:
Just open this file (under cursor) in the same tab and cursor supposed to stay in NERDTree window.
Optional
Screenshot(s):
I just recorded a screencast to demonstrate it (also with minimal config):
https://youtu.be/WwCxZ9v_gTQ
Possible Fix:
I haven't discovered the code but maybe it happens because somewhere in NERDTree map for go
set by map
instead of noremap
?