Created
August 20, 2017 15:14
-
-
Save poliquin/ff7d83d91794727db32963cc64fb98f1 to your computer and use it in GitHub Desktop.
Open selected file in Finder with neovim using iTerm2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Open selected file using neovim in an iTerm2 window | |
-- Requires iTerm2 version 2.9+ | |
(* Install: | |
* | |
* (1) Save this script as an Application | |
* (2) Cmd + drag the application to Finder toolbar | |
* (3) Click the new shortcut to open selected file in neovim using iTerm2 | |
*) | |
tell application "Finder" | |
set flist to selection as alias list | |
if length of flist = 0 then | |
set fpath to "" | |
else | |
set fpath to quoted form of POSIX path of first item of flist | |
end if | |
end tell | |
tell application "iTerm" | |
activate | |
set term to (create window with default profile command "") | |
tell current session of term | |
write text "nvim " & fpath | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment