Smart vertical caret movement

When I started my career, ages ago, I had a text editor with a feature that I haven't really seen in many other products, let alone a recent one.

You move around a document as you wish. When you start typing, the editor remembers the column you were on. If you hit “Up” or “Down” keys, the caret moves to the corresponding line and gets back to the saved column (if line is long enough).

What is it good for? Well, for example, it makes it very easy to make similar (but different) changes in different lines:

$data[] = '|'; // Start typing here
$data[] = '';
$data[] = '';
$data[] = '';
$data[] = 'Veritus tortor cras|'; // Done with line. Now I'll hit "Down" key...
$data[] = '';
$data[] = '';
$data[] = '';
$data[] = 'Veritus tortor cras';
$data[] = '|'; // Voilà! I don't need to set cursor, I can continue typing
$data[] = '';
$data[] = '';

I don't think PhpStorm has it (I would expect it to be at "Settings/ Editor/ General/ Caret Movement"). Has this been requested in the issue tracker?

0
3 comments

Hi, Alvaro

AFAIK, the PhpStorm already works like this. 

In your example, if I press down, it will move the text cursor to the end of the second line.

Please see the video here https://uploads.jetbrains.com/files/2025_04_14_169xiDzaA5BzN84hynnoBD_JBS/Screencast_20250414_175042.mp4?secret=AwkXEjVLob8bRCCMYUzDoXDAjdZy4NTW (I only use up and down in this video)

Does pressing down move to the start of the second line in your case?

 

 

 

0

I used the “|” symbol to represent where the cursor is. You need to click on the first empty string and actually type some text in each line in order to populate all the array values here:

$data[] = '';
$data[] = '';
$data[] = '';
$data[] = '';

 

0
Sorry, I missed that | is the cursor position.
Our IDE doesn't have this feature and I don't think someone has requested this feature before too.

Could you please create a feature request about this feature here: https://youtrack.jetbrains.com/newissue?project=IJPL ? Thanks.
0

Please sign in to leave a comment.