vim-polyglot icon indicating copy to clipboard operation
vim-polyglot copied to clipboard

vim-polyglot prevents restoring the last edit location

Open alejandropg opened this issue 3 years ago • 1 comments

Does this bug happen when you install plugin without vim-polyglot? Yes. I'm installing vim-polyglot with the new plugin system of Vim 8+, so I'm just cloning the repository into the directory ~/.vim/pack/vendor/star.

Environment:

  • macOS: 12.5.1 (Monterrey)
  • Mac Terminal
  • Vim 9.0 (installed with Homebrew)

Describe the bug: When the plugin is installed the last edit position can not be retrieved anymore. When you open the same file again, it is always open in line 1.

If you call line("'\"") it always returns 1.

If you remove the vim-polyglot plugin all works fine again.

To Reproduce:

In a fresh Vim installation, install vim-lastplace, or simply in your .vimrc use the line

au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif

Open a file and move to some line, and close the file. Open the same file again, and the cursor is in the line of the previous editing.

Now install vim-polyglot. And if you reopen the file you are always in line 1.

If you need I could make more tests.

Thanks!

alejandropg avatar Sep 01 '22 09:09 alejandropg

I'd guess this is due to some of the extra features that polyglot includes that aren't part of language packs. Try disabling them:

let g:polyglot_disabled = ['autoindent', 'sensible']

I use lastplace and polyglot with those two (and a bunch of filetypes) disabled.

idbrii avatar Jul 17 '24 00:07 idbrii