Sublime Text 4 Tips

Wednesday, January 15, 20254 min read

Sublime Text 4 is a powerful text editor with built-in features to supercharge your productivity.

This guide is dedicated to developers who prioritize velocity and efficiency, focusing exclusively on keyboard shortcuts (no mouse required).

Every tip here highlights native features, so you can start using them immediately without installing plugins.

Note: Since I exclusively use macOS, all shortcuts are macOS-specific.

Navigation

Goto Anything

Quickly open files, navigate to specific lines, or locate symbols in your project.

1{ "keys": ["super+p"], "command": "show_overlay", "args": { "overlay": "goto", "text": "@" } }

Goto Symbol

Jump directly to a symbol in the current file.

1{ "keys": ["super+r"], "command": "show_overlay", "args": { "overlay": "goto", "text": "@" } }

To navigate to the render method, press Cmd + R and type render.

Goto Symbol in Project

Search for symbols across all files in your project.

1{
2 "keys": ["super+shift+r"],
3 "command": "show_overlay",
4 "args": { "overlay": "goto_symbol_in_project" }
5}

To find the calculateTotal function across your project, press Cmd + Shift + R and type calculateTotal.

Navigate Modifications

Easily jump between your modifications.

1{ "keys": ["ctrl+."], "command": "next_modification" },
2{ "keys": ["ctrl+,"], "command": "prev_modification" },

Navigate Cursor Positions

Switch between your recent cursor positions to streamline code navigation.

1{ "keys": ["ctrl+minus"], "command": "jump_back" },
2{ "keys": ["ctrl+shift+minus"], "command": "jump_forward" },

Selection Tips

Select a Word

Select the word under the cursor for quick edits.

1{ "keys": ["super+d"], "command": "expand_selection", "args": { "to": "word" } }

Press Cmd + D to highlight the current word.

Select All Matching Words

Highlight every occurrence of a word in your file.

1{ "keys": ["super+ctrl+g"], "command": "find_all_under" }

Place the cursor on a word and press Cmd + Ctrl + G to edit all instances simultaneously.

Select Entire Line

Quickly highlight the entire line for editing or copying.

1{ "keys": ["super+l"], "command": "expand_selection", "args": { "to": "line" } }

Press Cmd + L to select the entire line.

Expand Selection to Block

Select the surrounding block of code with ease.

1{ "keys": ["super+shift+m"], "command": "expand_selection", "args": { "to": "brackets" } }

Place the cursor inside a block and press Cmd + Shift + M to highlight the entire block.

Editing Tips

Duplicate Line

Duplicate the current line or selection for quick edits.

1{ "keys": ["super+shift+d"], "command": "duplicate_line" }

Press Cmd + Shift + D to duplicate the current line.

Join Lines

Combine two lines into one for cleaner code.

1{ "keys": ["super+shift+j"], "command": "join_lines" }

Place the cursor at the end of a line and press Cmd + Shift + J to join the next line.

Edit Multiple Lines

Simultaneously edit multiple lines with multi-cursor mode.

1{ "keys": ["super+shift+l"], "command": "split_selection_into_lines" }
2{ "keys": ["super+left"], "command": "move_to", "args": { "to": "bol" } }

Git Tips

View Inline Modifications

Quickly review inline diffs for modified lines directly in the editor. This feature highlights changes without switching to another tool or tab.

1{ "keys": ["super+k", "super+."], "command": "toggle_inline_diff" }

Press Cmd + K, then Cmd + . to toggle inline diffs for the current file.

Revert Hunk (Undo Changes for a Section)

Discard modifications for a specific section (or "hunk") of code in your file. This is especially useful when you want to revert a set of changes without affecting the rest of the file.

1{ "keys": ["super+k", "super+z"], "command": "revert_hunk" }

Press Cmd + K, then Cmd + Z to revert the changes in the current hunk.

Revert Modification (Undo Changes for a Line)

Undo modifications to a specific line in your file without impacting surrounding lines. This is ideal for fine-grained control over discarding edits.

1{ "keys": ["super+k", "super+shift+z"], "command": "revert_modification" }

Press Cmd + K, then Cmd + Shift + Z to revert changes to the current line.

Conclusion

Sublime Text 4 is a treasure trove of native features designed to help you code faster and smarter.

By leveraging these keyboard shortcuts, you’ll minimize distractions, maximize velocity, and optimize productivity—all without ever reaching for the mouse.

Happy coding! 🚀


Tuesday, May 30, 2023

Sublime Text - Unleashing Productivity

Advantages of using Sublime Text and discover how it can revolutionize your coding experience.


Tuesday, April 16, 2019

Sublime Text 3 Tips

I've been using Sublime Text 3 for probably four years now and in that time I've discovered tons of useful tricks. I figured I should start writing them down for anyone who might be interested. I'll try to explain the bits that seem esoteric because there are a lot of cool commands which only work in certain contexts.