Skip to content

Instantly share code, notes, and snippets.

@poliquin
Created August 20, 2017 15:14
Show Gist options
  • Save poliquin/ff7d83d91794727db32963cc64fb98f1 to your computer and use it in GitHub Desktop.
Save poliquin/ff7d83d91794727db32963cc64fb98f1 to your computer and use it in GitHub Desktop.
Open selected file in Finder with neovim using iTerm2
-- 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