Must know key bindings for developers on Mac OSX
Please put your VIM vs EMACS feelings aside for a moment. These key bindings are universal and will help you keep your fingers on the main keyboard, avoiding the need to lift your hands for the home or arrow keys. What’s great is that these bindings work in the shell, in your editor and even apps like google docs. This is all because OSX respects the EMACS bindings natively and actually reserved the Ctrl key for this purpose; vs in Windows where the Ctrl key is used by the application and the OS.
Ctrl + p: next line
The Ctrl + p
key binding allows you to move the cursor to the previous line.
This is especially useful when you’re navigating through text or code. You can use this in various applications:
- Terminal/Shell: Move to the previous command in your command history.
- Text Editors (like VSCode, Sublime Text, etc.): Navigate up one line in your document.
- Google Sheets: Move the active cell up by one row.
- Mail and Notes Apps: Move the cursor up by one line in your email or note.
Ctrl + n: previous line
The Ctrl + n
key binding allows you to move the cursor to the next line.
This is helpful for quick navigation without leaving the home row.
- Terminal/Shell: Move to the next command in your command history.
- Text Editors: Navigate down one line in your document.
- Google Sheets: Move the active cell down by one row.
- Mail and Notes Apps: Move the cursor down by one line in your email or note.
Ctrl + k: kill line from cursor to end
The Ctrl + k
key binding deletes the text from the cursor position to the end of the line.
It’s a quick way to clear text without having to select it.
- Terminal/Shell: Delete text from the cursor to the end of the line, useful for editing long commands.
- Text Editors: Quickly delete the remainder of the current line.
- Google Docs: Delete text from the cursor to the end of the current paragraph.
- Mail and Notes Apps: Remove the rest of the current line.
Ctrl + a: move to beginning of line
The Ctrl + a
key binding moves the cursor to the beginning of the current line.
This is great for quickly jumping to the start without using the arrow keys.
- Terminal/Shell: Move the cursor to the start of the command line.
- Text Editors: Jump to the beginning of the current line.
- Google Sheets: Move to the beginning of the current cell’s content.
- Mail and Notes Apps: Move the cursor to the start of the current line.
Ctrl + p: move to end of line
The Ctrl + e
key binding moves the cursor to the end of the current line, allowing you to quickly get to the
end of a line of text.
- Terminal/Shell: Move the cursor to the end of the command line.
- Text Editors: Jump to the end of the current line.
- Google Sheets: Move to the end of the current cell’s content.
- Mail and Notes Apps: Move the cursor to the end of the current line.