The ⌘-k "access anything" shortcut is awesome on Notion, Slack, etc.
The terminal, by comparison, is a dinosaur: tons of repeated cd
and ls
and TAB
just to get anywhere.
This is ⌘-k for the terminal: access anything on your filesystem, from anywhere, with previews before you open:
Based on what you choose...
- Directories get
cd
d to - Text files get opened in
vim
- Images and PDFs get opened in the Preview app
.key
files get opened in Keynote
Huge thanks to fzf. I've been fed up with terminal navigation for a decade, and discovering fzf was the last piece needed to make cmdk possible.
-
brew install fzf fd bat tiv
-
git clone [email protected]:mieubrisse/cmdk.git ~/.cmdk
-
Add to your
.zshrc
or.bashrc
:source ~/.cmdk/cmdk.sh
-
Bind the
⌘-k
hotkey to send the textcmdk\n
in your terminal💡 In iTerm, this is done with
Settings → Profiles → Keys → Keybindings → + → Send Text
, then binding⌘-k
to send the textcmdk\n
.💡 If you prefer another hotkey (e.g.
⌘-p
), simply bind that to send thecmdk\n
string instead. -
Open a new shell
Press ⌘-k (or type cmdk
) and...
- Type to start filtering
💡 If you're trying to get a directory, add a
/
to the end of your search term. E.g.down/
will pull up theDownloads
directory Ctrl-j
andCtrl-k
to scroll up and down the results listENTER
to select the resultTAB
to select multiple items beforeENTER
Ctrl-u
to clear the selection
⚠️ Some directories likeLibrary
,/
, and.git
are full of stuff users don't need to access, so their contents are excluded. To get to their contents, first ⌘-k to them and then ⌘-k again to see their contents.
💡 Sometimes you only want to jump to the contents of the current directory. This can be done by calling
cmdk -o
. I've set up a separate iTerm hotkey for this:⌘-l
to sendcmdk -o\n
.