t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 111 forks source link

Cannot move to last line in file when line is empty #911

Closed pwrobinson closed 6 years ago

pwrobinson commented 6 years ago

In normal mode, I cannot move to the very last line in a file if I leave that line empty. That means the last line has no text and no whitespaces, but it has a line number. You can get such a line, for example, by pressing 'o' while being in the second last line and then immediately exiting back to normal mode.

I cannot jump there with 'G' (which jumps to the second last line), nor can I go there using 'j' when the cursor is located in the second last line. The problem goes away if there is at least one whitespace in the last line.

Strangely, the only way that I can get to that line in normal mode is by clicking on it with the mouse.

I'm not sure if this is intended, but this behaviour is different from VIM (I just tested it).

I did not notice this issue before upgrading to 1.9.1 this morning.

t9md commented 6 years ago

If I understand your example correctly(I think so), this is intentional.

I don't think this behavior is different from Vim. What's is different from Vim is Atom's default behavior which allow cursor to place next position of last "\n" char.

You still can move to next position of last "\n" in insert-mode. But in normal-mode vmp intentionally preventing to place cursor at next position of last "\n" to make vmp behaviral compatible with pure Vim and also with other editors.

If you open same file with pure Vim, you will see you CANNOT move to the position where you could in Atom. This is implementation of vmp from very early version, so this is NOT introduced in recent update like 1.9.1(If you still think so, your issue is not same as I exaplained here).

t9md commented 6 years ago

https://github.com/t9md/atom-vim-mode-plus/issues/56

pwrobinson commented 6 years ago

Ok, thanks for clarifying!