svermeulen / vim-easyclip

Simplified clipboard functionality for Vim
696 stars 21 forks source link

Cursor jumps to the top when buffer is loaded in another window - caused by call repeat#invalidate()? #126

Closed andreasthoelke closed 5 years ago

andreasthoelke commented 5 years ago

Hi! I have noticed this odd behaviour:

When opening a file/buffer that is already visible in a window into a new window, then the original window will scroll to the top.

Steps to reproduce:

  1. :e .vimrc " load a long file
  2. G " scroll to the bottom of the file
  3. :vsplit " show the same buffer in a different window or tab
  4. :e " reload the file

Now the first window will scroll to the top/ the cursor jumps to the first line.

I have traced this down to the following line:

https://github.com/svermeulen/vim-easyclip/blob/9beb917f2540ce4610a8f398df595a4944729a3e/autoload/EasyClip.vim#L84

If I comment out this line, the issues does not occur/ the cursor does not jump to the top.

I'm on the current neovim version.

svermeulen commented 5 years ago

I was able to reproduce this issue using your steps. No idea why that line causes this behaviour. So for now I removed the check for repeat.vim entirely since it's not worth a nice error message if it's causing bugs. Thanks for reporting it