alexchantastic Posted June 5 Share Posted June 5 (edited) Open the selected file or folder in Finder with Neovim.  Available on GitHub: https://github.com/alexchantastic/alfred-open-with-neovim-workflow  🎥 Check out a video of the workflow in action  Currently only supports opening Neovim in iTerm2, but feel free to open an issue on GitHub or leave a message here with a terminal emulator or Neovim GUI that you're interested in using and I can try to add it in!  Keywords available: nvim which opens the currently selected file or folder (or whatever folder you have focused) in Finder. You can also type a path to a file or folder. nvimf which initiates Alfred's file search and allows you to use that interface to select a file or folder to open Edited June 5 by alexchantastic Link to comment
vitor Posted June 5 Share Posted June 5 A few suggestions: You should always prefer with input as argv over with input as {query}. But better yet, you should be able to do this entirely without code or being specific to iTerm. There is an Automation Task to get the Selection in Finder and another to Shell Escape Text. With both of those in sequence connected to a Terminal Command Action set up to nvim {query} (with all escaping turned off, because it was done by the Automation Task), you should have the same behaviour plus support for whatever Terminal the user has set up in Alfred Preferences. I wrote some code years ago (and still working fine) to open Terminal commands with iTerm via Alfred.  By adding a Text Field configuration, you can even make this generic to any CLI text editor.  Thank you for the idea, I use Helix and just built a quick workflow to do this. For reference, I also made the File Action support only +public.plain-text and public.folder. Link to comment
alexchantastic Posted June 6 Author Share Posted June 6 Nice, thanks for the tips! I'll see if I can find some time tomorrow to refactor this. Link to comment
alexchantastic Posted June 6 Author Share Posted June 6 (edited) Thanks vitor for all the tips. I've updated the workflow and vastly simplified how it works:Â https://github.com/alexchantastic/alfred-open-with-neovim-workflow/releases/tag/v1.1.1 Edited June 6 by alexchantastic Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now