Vscode-neovim: Jump motion CTRL-O opens unsaved buffer instead of previously opened file

Created on 28 Sep 2020  路  2Comments  路  Source: asvetliakov/vscode-neovim

Steps:

  1. Have Vetur installed (it also reproduces with other files, but with Vetur I could reproduce it constantly)
  2. Make changes in .vue a file and don't save those.
  3. Jump to any other file using VSCode file search.
  4. Go back using default vim hotkey CTRL-o

Expected:
Previously opened vue file is focused again

Actual:
Buffer with no association with previously opened file is focused

vscode-neovim-vetur

It doesn't happen with all .vue files, though. Only several are affected. I will try to dig into the code later and see why this is happening, but would also appreciate some guidance on where to look.

Env:

VSCode: Version: 1.49.1
NVIM v0.5.0-dev
OS Fedora 32

init.vim:

call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'posva/vim-vue'
call plug#end()

xmap gc  <Plug>VSCodeCommentary
nmap gc  <Plug>VSCodeCommentary
omap gc  <Plug>VSCodeCommentary
nmap gcc <Plug>VSCodeCommentaryLine

nnoremap <C-h> <Cmd>call VSCodeNotify('workbench.action.focusLeftGroup')<CR>
xnoremap <C-h> <Cmd>call VSCodeNotify('workbench.action.focusLeftGroup')<CR>
nnoremap <C-j> <Cmd>call VSCodeNotify('workbench.action.focusBelowGroup')<CR>
xnoremap <C-j> <Cmd>call VSCodeNotify('workbench.action.focusBelowGroup')<CR>
nnoremap <C-k> <Cmd>call VSCodeNotify('workbench.action.focusAboveGroup')<CR>
xnoremap <C-k> <Cmd>call VSCodeNotify('workbench.action.focusAboveGroup')<CR>
nnoremap <C-l> <Cmd>call VSCodeNotify('workbench.action.focusRightGroup')<CR>
xnoremap <C-l> <Cmd>call VSCodeNotify('workbench.action.focusRightGroup')<CR>

Most helpful comment

I run into this constantly to the point where I'm switching back to nvim for a while until this is fixed. I'd love to be able to help. It's kind of random in its occurrence so far. I work with Go mostly so this is not related to vue files.

@Shatur95, does the file mapping affect neovim in any way? Does it work just like the jumplist in nvim? (same semantics etc?)

All 2 comments

Yes, I also mentioned the same issue here. I suggest you to currently use the following:

    {
        "key": "ctrl+o",
        "command": "workbench.action.navigateBack",
        "when": "editorTextFocus && !neovim.recording && neovim.mode != 'insert'"
    },
    {
        "key": "ctrl+i",
        "command": "workbench.action.navigateForward",
        "when": "editorTextFocus && !neovim.recording && neovim.mode != 'insert'"
    },

You can map it inside Vim, but I mapped it inside VSCode to make it work for all windows.

I run into this constantly to the point where I'm switching back to nvim for a while until this is fixed. I'd love to be able to help. It's kind of random in its occurrence so far. I work with Go mostly so this is not related to vue files.

@Shatur95, does the file mapping affect neovim in any way? Does it work just like the jumplist in nvim? (same semantics etc?)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erlais picture erlais  路  3Comments

Liquidmantis picture Liquidmantis  路  3Comments

Shatur95 picture Shatur95  路  4Comments

DrakeXiang picture DrakeXiang  路  5Comments

pieterdd picture pieterdd  路  4Comments