Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go key map works strange when gt is rebound #762

Closed
unclechu opened this issue Nov 13, 2017 · 1 comment · Fixed by #877
Closed

go key map works strange when gt is rebound #762

unclechu opened this issue Nov 13, 2017 · 1 comment · Fixed by #877
Assignees

Comments

@unclechu
Copy link

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 maps 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.

  1. Open few tabs (for example four)
  2. Open some file in for example third tab
  3. Open NERDTree
  4. 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?

@unclechu unclechu changed the title go key map works strange when gt rebound go key map works strange when gt is rebound Nov 13, 2017
@PhilRunninger PhilRunninger added the PR Under Review Coding is finished, and a pull request has been created and is being reviewed. label Aug 22, 2018
@PhilRunninger PhilRunninger self-assigned this Aug 22, 2018
@unclechu
Copy link
Author

I confirm that now it's working correctly, thanks!

unclechu added a commit to unclechu/neovimrc that referenced this issue Aug 25, 2018
@PhilRunninger PhilRunninger removed the PR Under Review Coding is finished, and a pull request has been created and is being reviewed. label Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants