When editing text, the following list of keyboard shortcuts should work universally across applications and operating systems. For example, in Microsoft Word, in Internet browsers, in Unix-like system’s terminal, or in those text editors. They will work if they are not conflicting with existing application specific shortcuts. They should become your muscle memory to enable the fastest text editing experience.
⌘ = command key on Mac keyboard. Using ctrl here for PC keyboard.
delete = delete key on Mac keyboard. Using backspace here for PC keyboard.
fn = fn (function) key on Mac keyboard. Having no idea what key to use here for PC keyboard (if you found out, please let me know).
Command | Description | Exception |
ctrl+f | forward character | |
ctrl+alt+f | forward word | Use alt+f in terminal |
ctrl+n | forward line | |
ctrl+e | forward to end of line | |
⌘+left | forward to end of visible line (ignore line-wrap) | |
⌘+down | forward to end of document | |
ctrl+b | backward character | |
ctrl+alt+b | backward word | Use alt+b in terminal |
ctrl+p | backward line | |
ctrl+a | backward to beginning of line | |
⌘+right | backward to beginning of visible line (ignore line-wrap) | |
⌘+up | backward to beginning of document | |
above commands + shift | moving cursor as well as selecting text along the moving path | |
ctrl+t | transpose previous and next character | transpose last two characters in terminal |
ctrl+d, fn+delete | forward delete character | |
fn+alt+delete | forward delete to the end of word | |
ctrl+k | forward cut to the end of line | |
delete |
backward delete character | |
alt+delete | backward delete to the beginning of word | |
⌘+delete | backward cut to the beginning of line | doesn’t work in terminal |
ctrl+y | paste the last cut text |
Here, I only summarised those shortcuts working universally. For terminal/command-line text editing, there are more shortcuts available. Please refer to teohm.dev’s post.