Makes End key intelligently toggle the cursor between the end of the code and the end of the line, accounting for inline comments. Pressing Shift + End extends the text selection similarly.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Smart End Key is a Visual Studio Code extension that enhances the behavior of the End key.
Instead of always jumping to the very end of the line, it toggles between:
The last code character of the line (ignoring inline comments and trailing whitespace).
The true end of the line (after comments and spaces).
Press End once → cursor jumps to the end of the region it is at (code or inline comment).
Press End again → cursor jumps to the end of the other region.
Press Shift + End once → extends the text selection to the end of the region it is at (code or inline comment).
Press Shift + End again → extends the text selection to the end of the other region.
This makes navigating code with inline comments much faster and more intuitive — similar to how Smart Home toggles between the start of the line and the first non‑whitespace character.
✨ Features
Detects the current file’s language and use the appropriate inline comment markers. (e.g., //, #, --).
Detects if the comment marker is inside a string and ignores it.
Works with multiple cursors/selections.
Lightweight and fast — no configuration required.
Limitations
Doesn't detect multi-line comments and docstrings. This would make the extension far more complex and heavyweight.
Incompatibility
Some users have reported incompatibility with keyboards that assign the End key to multiple functions, especially when extensions also register actions on that shared key.