Skip to content(if available)orjump to list(if available)

Cmdk – CD anywhere and open anything in your terminal

bpx51

Seems nice, but since it's based on fzf, why not just use fzf and it's built in shortcuts, never used ios tho, so maybe the ⌘-k is heavily used with ios.

mieubrisse

Good question! This is complementary, not competitive, to the built-in fzf shortcuts. I use both cmdk and built-in fzf shortcuts in my day-to-day.

The concrete value-adds of cmdk (what fzf doesn't do out of the box):

1. Smart previews. You have to write the fzf preview command to preview text files, directories, images, PDFs, etc. cmdk gives you this out of the box (see https://github.com/mieubrisse/cmdk/blob/main/preview.sh ).

2. Choose the command for you. If you rely on the fzf Ctrl-T shortcut, you have to type the `cd`, the `vim`, the `open`, etc. I find that most of the time the command is predictable based on the filetype, so cmdk allows you to skip this (see https://github.com/mieubrisse/cmdk/blob/9d742112dab0475d7420... ). When cmdk doesn't have a command for the filetype though, I supplement with fzf's Ctrl-T.

3. Be smart about which files you're searching to be performant. E.g. very likely users aren't going to jump to files in the "~/Library/Application Support", or certain system directories under "/", so give users the option to go to the parent directory without crawling the subdirectories (see https://github.com/mieubrisse/cmdk/blob/main/list-files.sh ).

0points

I also believe the project is struggling for an existence. From the readme:

> (Optional) Bind the ⌘-k hotkey

mieubrisse

Hey 0points, author here! I'd be keen to hear why binding the Cmd-K hotkey makes it feel like cmdk doesn't add value!

0points

> I'd be keen to hear why binding the Cmd-K hotkey makes it feel like cmdk doesn't add value!

You tell me.

Your shell script "cmdk" does not bind the Cmd-K hotkey.

I just commented on the fact that binding that key is optional.

Your script add no value, as you would learn from the fzf docs:

https://junegunn.github.io/fzf/shell-integration/

If I wanted that functionality, I would just bind fzf directly to Cmd-K.

smallerfish

Just for people like me who don't tend to rtfm: after install, add the command `fzf_key_bindings` to your shell config to bind key combos.

thrownawaysz

I bought a thrown out M1 Macbook Air recently and I still haven’t figured out how to do a simple “right click in Finder > open Terminal here”

Can be done with a keyboard shortcut or the Services menu but then it tries to open the Terminal of a selected folder not the current open folder

terhechte

The "open Terminal of selected folder" is the proper way, it requires a different workflow though, so I understand the issue in terms of muscle memory. An easy enough alternative (for me) is to drag and drop the current folder onto iTerm. When you have a folder open in Finder, and hover over the name of the Folder in the titlebar of the window, a blue "folder" icon appears. if you drag that to the iTerm icon in the dock and drop it, iTerm will activate and open a new terminal window in this folder.

coldtea

>I bought a thrown out M1 Macbook Air recently and I still haven’t figured out how to do a simple “right click in Finder > open Terminal here”

Right click -> Services -> New Terminal Tab at Folder

(or if you have Iterm: Right click -> Services -> New iTerm Tab/Window here)

Or if you have enabled Finder to show the path bar, right click on a folder in Path Bar (last one is the current open one) -> Open in Terminal

Then again, if you do work in the terminal, why do you navigate to the working directory via the UI Finder?

thrownawaysz

>Or if you have enabled Finder to show the path bar, right click on a folder in Path Bar (last one is the current open one) -> Open in Terminal

Thanks this seems like the most straightforward, exactly what I was looking for

fingerlocks

> Then again, if you do work in the terminal, why do you navigate to the working directory via the UI Finder?

This right-click terminal complaint comes up all the time here and Reddit. Always thought it was so weird.

But then the other day I wasted an hour of my life digging through Microsoft Teams APIs trying to figure out if I could hack up a way to pipe a file directly to a chat and avoid using Finder.

And then it hit me: after I did the whole cumbersome drag-file-to-chat dance, I wanted to get the terminal path back to the file. and it would be really handy if that was a one or two click thing.

So yeah I guess if you’re forced to use some bullshit software like Teams, that feature makes sense.

_thisdot

Not sure if this helps. But you can copy a file and paste it in your terminal for the path to appear.

mieubrisse

Whoa thank you, this is amazing! I didn't even know this was possible; my life has gotten a little better.

pprotas

This is going to sound mental, but here you go. First enable the path bar in Finder by executing code provided to me by anonymous users on the internet: defaults write com.apple.finder ShowPathbar -bool true (EDIT: Apparently you can do CMD + OPT + P shortcut in Finder to accomplish the same)

Then in the path bar you can right click your current folder and open in Terminal (or use Services menu to open in 3rd-party terminals)

coldtea

> First enable the path bar in Finder by executing code provided to me by anonymous users on the internet: defaults write com.apple.finder ShowPathbar -bool true (EDIT: Apparently you can do CMD + OPT + P shortcut in Finder to accomplish the same)

Or you can just enable it in Finder menu View -> Show Path Bar.

jannes

Obviously, right-click is for losers and you just have to drag and drop the folder icon from the title bar onto the Terminal app icon.

/s

01HNNWZ0MV43FF

> This is ⌘-k for the terminal

Nitrous oxide is the glycerine of the racing world

rzzzt

⌘-K is Ctrl-L for the Terminal (I think): https://support.apple.com/guide/terminal/keyboard-shortcuts-...

mieubrisse

Yep! ⌘-K clears the current terminal window. I chose ⌘-K because it maps to the standard in web apps (Discord, Notion, etc.) and I use `clear` whenever I want to clear my terminal, but you can choose whatever keybinding you want with cmdk.