top | item 43190955

(no title)

fstarship | 1 year ago

For your specific counting problem you can use relative line numbering which shows line numbers relative to your cursor.

However the larger attempt and redo problem you highlighed is mitigated in a modal editor that does selection first (not vim) instead of action so you get a preview of what you will delete before hitting it, you can also expand it.

I did give up vim for the same reasons, but I am happy with Helix.

I won’t deny that I still make lots of errors, I still use vscode for other features like folder search and replace, easier diff comparisons

discuss

order

cbm-vic-20|1 year ago

> a modal editor that does selection first (not vim) instead of action so you get a preview of what you will delete before hitting it, you can also expand it.

This is pretty much what Visual mode does. V4jd is

* V: enter visual line mode. * 4j: select the next four lines (in addition to this one) * d: delete.

The selection is highlighted before the delete command, you can change the selection range, etc.

I use visual mode to replace stuff all the time: V10j:s/foo/bar/g It even shows the changes interactively.

fstarship|1 year ago

I did actually do that when I tried Vim but it felt clunky.

The find and replace is more at folder level with vscode previews only terminal equivalent I know is serpl

oofabz|1 year ago

You can do selection first in Vim by using visual mode. For this particular example (5dd) you would want to use visual line mode by pressing shift-v. Then you can select the lines you wish to cut, and press d to delete them, or apply any other action to that block of text.

I frequently use c (change) on my visual selections, type in new code at the point where it was removed, then use p to paste the old code somewhere else.