A good[ish] website

Web development blog, loads of UI and JavaScript topics

Mastering text selection with keyboard in VSCode, Atom, or Sublime Text

Filed under: Tooling— Tagged with: text editor

Here’s a list of handy keyboard shortcuts for selecting, copying, cutting, and pasting text in VSCode, Atom, or Sublime Text (they’re all the same in that sense).

Select word, next word, and next occurrence of a word

You know the thing where you press Cmd+D to select the next occurrence of a word? But what if you want to skip a word? Or go back one step? Here’s how to master the multiple selection tool in Visual Studio code.

Start by having a cursor on top of a word. If you’re on Windows or Linux please replace Cmd with Ctrl.

ShortcutWhat it does
Cmd+DSelects a word, press again: select next occurrence
Cmd+KSkip the current occurrence
Cmd+UGo back one word

Also, the more universal text selection works:

ShortcutWhat it does
Alt Shift+arrowsSelects the word next to cursor

Line commands

ShortcutWhat it does
Cmd+LSelects current line
Shift+Cmd+KDelete current line
Cmd Shift+rightSelect to end of line
Cmd Shift+leftSelect to beginning of line

Moving lines

ShortcutWhat it does
Ctrl Cmd+up/down arrowsMoves line up and down
(fn)+F5Alphabetizes lines (Only in Sublime Text)

Moving cursor in the document

ShortcutWhat it does
Alt+left/right arrowMove cursor to next or previous word

Copying and duplicating lines

If you just do Cmd+C, without any text selected, it will copy the whole line of text.

ShortcutWhat it does
Cmd+CCopy whole line
Cmd+XCut whole line
Cmd Shift+DDuplicates line (Sublime Text)
Shift+alt+up/downDuplicates line (Visual Studio Code)

Vintage mode

In Sublime Text there is a "Vintage Mode", which means that all the Vim commands will work, enable it from the settings by adding this line:

"ignored_packages": ["Vintage"]

Comments would go here, but the commenting system isn’t ready yet, sorry.

  • © 2022 Antti Hiljá
  • About
  • All rights reserved yadda yadda.
  • I can put just about anything here, no one reads the footer anyways.
  • I love u!