Is there a way to jump to the end of a line of code to add a semi colon?

Just started programming and I find it inefficient to have to use my mouse to click to the end of a line or to use the arrow keys to navigate to the end of a line in order to add a ; to the end. Is there a shortcut key(s) to move to the end of a line? Similarly, if I just want to jump passed an apostrophe or outside a bracket is there a way to do so? Thanks!

Most code editors probably have something like that, and most of them are very configurable or programmable and would otherwise be able to create such keybindings.

for vim (what I happen to use):

F] go left to next ]
f] go right to next ]
f) (replace the second char with any char to jump to)
; repeat previous movement command
% go to matching brace

Abegin inserting at the end of line
I begin inserting at start of line (after whitespace)

but uh vim’s probably not special other than having simpler keybindings (less use of ctrl/shift/alt) (because insert mode is separate, freeing up lots of keys for keybindings)

vscode is easier to recommend to new programmers and does roughly the same things as vim with a much friendlier learning curve

2 Likes

Uh. Well. to clarify.
Vim solves those problems.
But it doesn’t behave like a “normal” editor.
Its default configuration is very conservative.
It’s difficult to learn, difficult to configure.

vscode doesn’t solve those problems, it uses arrow keys and home/end and lots of ctrl/shift/alt combinations
…and that’s what makes it easier to learn

vscode is also shinier (has gui, vim doesn’t) and easily configured and powerful features are much easier to set up than vim because for vscode you click some button and it magically happens, vim is a bit more hands on.

So the answer to your post is vim… but the answer to vim’s learning curve is vscode.

1 Like

Does the END key not aid you in your first use case?

Yeah it does the right thing but should your right hand be over home/end or over jkl? It’s kind of silly for something so common.
It still leaves lots of other jump locations. And an editor that uses END probably uses the mouse for various tasks as well, so the right hand has three different places to be, and the left hand similarly needs to do awkward things with ctrl/shift/alt … and you’d probably still not have what vim gives

2 Likes

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.