Created
June 28, 2023 15:52
-
-
Save brake/9872df0c531f7fcf662ddce84142288c to your computer and use it in GitHub Desktop.
iTerm2 open files in neovim opened in new tab
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
#!/usr/bin/env bash | |
osascript ~/Iterm2_NeoVIM.scpt "$@" |
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
on run argv | |
# seem to need the full path at least in some cases | |
set nvimCommand to "/usr/local/bin/nvim " | |
set filepaths to "" | |
if argv is not {} then | |
repeat with currentFile in argv | |
set filepaths to filepaths & quoted form of POSIX path of currentFile & " " | |
end repeat | |
end if | |
if application "iTerm" is running then | |
tell application "iTerm" | |
--create window with default profile command nvimCommand & filepaths | |
tell current window to set tb to create tab with default profile | |
tell current session of current window to write text nvimCommand & filepaths & " ;exit" | |
end tell | |
else | |
tell application "iTerm" | |
tell current session of current window | |
write text nvimCommand & filepaths | |
end tell | |
end tell | |
end if | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is script for vifm:
Put it in
$XDG_CONFIG_HOME/vifm/scripts/
, make executable and add tovifmrc
this line:set vicmd=iterm2-neovim