4

IdeaVim has this bug, where you can't go the the line's end by typing a dollar sign ($). You can see it demonstrated here, what happens when I try:

IdeaVim bug demo

And here (this gif is too big, so I had to link it).

Since I'm using IdeaVim, my fingers are far away from the arrow-keys, so Cmd- isn't an option for something I use so many times during the day.

Is there a way to setup a new shortcut for this motion that works regardless of linebreaks and characters on the line?

--Addition 1 I'm on a Mac, so I have no 'End'-key.

--Addition 2 I imagined either for something to put in the .ideavimrc file - or for a fix in the PhpStorm-settings. But anything that will take me to the end of the line that I am on (not the visual line due to the soft wrap, but the actual line), will serve as an answer.

Am I the only one out here with this problem? Can others reproduce it (by installing The IdeaVim-plugin, enabling soft wrap and then going to a very long line (that takes up more than one visual line) and press $)?

Cy Rossignol
  • 16,216
  • 4
  • 57
  • 83
Zeth
  • 2,273
  • 4
  • 43
  • 91
  • which version of PhpStorm? I have `PhpStorm 2016.1.2 Build #PS-145.1616, built on May 24, 2016 JRE: 1.8.0_76-release-b198 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o` and I am not able to reproduce – Tarun Lalwani Nov 21 '17 at 11:04
  • I have `PhpStorm 2017.2.1 built #PS-172.3544.41, built on August 2, 2017. JRE: 1.8.0_152-release 915-b6 x86_64. JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.0`. Wierd, that you can't reproduce it. Are you on a Mac or a Windows? – Zeth Nov 21 '17 at 12:11
  • I am on Mac, just upgraded to `PhpStorm 2017.2.4 Build #PS-172.4155.41, built on September 15, 2017 JRE: 1.8.0_152-release-915-b11 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.6` and it still works. Probably something you have `.ideavimrc` causing this issue? I have tried with and without softwraps and both cases it works – Tarun Lalwani Nov 21 '17 at 13:14

2 Answers2

1

Try using g_. This is a similar movement to $—it moves the cursor to the last non-whitespace character on the line.

The bug described seems to mimic the behavior of g$, which moves the cursor to the end of a screen line, not to the actual linebreak, when on a soft-wrapped line. I cannot reproduce this bug in recent versions of JetBrains IDEs (the bug report is from 2014), so it may be worth checking for a possible re-mapping in the ~/.ideavimrc file.

We can try to reset the mapping of $. Run the command, :noremap $ $, and try the movement again on a problem file (IdeaVim doesn't support :unmap). If this works, we can add the command to ~/.ideavimrc, or try to hunt down the source of the remapping.

If the above doesn't solve the problem, and g_ behaves as expected, we can remap the $ movement to g_ using :noremap $ g_ .

Cy Rossignol
  • 16,216
  • 4
  • 57
  • 83
  • 1
    `:noremap $ $` solved it, so I added this to my `.ideavimrc`-file: `noremap $ $` and now it works whenever I start PhpStorm. Thanks a bunch! – Zeth Nov 26 '17 at 16:03
-1

What about using the 'End' key on your keyboard ? This is supposed to go to the end of the current line.

In case of a single long line broken into several sub-lines, pressing the 'End' key from anywhere on a sub-line will go to the end of that sub-line.

To reach the very end of such a line, I suggest pressing the 'End' key as much as needed, or holding the key until it's been reached.

Bryan Lee
  • 150
  • 1
  • 8
  • 1
    I'm sorry, - but I am on a Mac, - so I have no 'End'-key. And not to be a stickler, but that wouldn't be the 'Vim'-way anyway. :-/ – Zeth Oct 24 '17 at 10:25