title | date | tags | aliases | |||||
---|---|---|---|---|---|---|---|---|
2024-06-24 - TIL - Open Files from Finder in Nvim |
2024-06-24 05:34:50 -0700 |
|
|
Open files from Finder.app
directly in nvim
running in your preferred terminal emulator (e.g. Alacritty.app
) using Automator.app
.
- Open
Automator.app
- Select
Application
- Click
Choose
- Search for
Run Shell Script
- Double-click
Run Shell Script
- For
Shell:
, select a shell to run your shell script (e.g./bin/zsh
) - For
Pass input:
, selectas arguments
- For example, if you want to use
/bin/zsh
inAlacritty.app
:
#!/usr/bin/env zsh
/opt/homebrew/bin/alacritty --command /opt/homebrew/bin/nvim "$1"
Note: The full path to each executable must be specified.
- Save your Automator Application with an easy to remember name to an easy to find location (e.g.
/Applications/Neovim.app
)
- Open
Finder.app
- Right-click a
<file>
> Hover overOpen With
> ClickOther...
- Locate/Select your Automator Application (e.g.
/Applications/Neovim.app
) > ClickOpen
- Open
Finder.app
- Right-click a
<file>
> ClickGet Info
- Under
Open with:
, locate/select your Automator Application (e.g./Applications/Neovim.app
) > ClickAdd
- Click
Change All...
- Open files from
Finder.app
directly innvim
running in your preferred terminal emulator (e.g.Alacritty.app
) usingAutomator.app
- In
Finder.app
, set files to "Always Open With"Neovim.app
instead ofXcode.app
- Configure all similar files to "Always Open With"
Neovim.app