Skip to content

Commit

Permalink
Merge pull request #2 from jeremybahadirli/consolidate-terminal-scripts
Browse files Browse the repository at this point in the history
Consolidate terminal scripts
  • Loading branch information
jeremybahadirli authored Feb 2, 2023
2 parents 410d3d4 + 7036bdf commit 7c3b693
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ Use vim as a macOS desktop text editor, using the built-in Terminal or iTerm. Do
1. Open Automator and create an Application.
2. Add a Run AppleScript action using the contents of Vim-Terminal.scpt or Vim-iTerm.
3. File > Save to your computer using File Format: Application.
---
**Configuration (within Vim.scpt):**
- Terminal
- `set terminal to "Terminal"`
- `"Terminal"`: Apple Terminal
- `"iTerm"`: iTerm2
- Command
- `set cmd to "vim"`
- Replace `"vim"`with the command you'd like to run, i.e. `"nvim"`
13 changes: 0 additions & 13 deletions Vim-Terminal.scpt

This file was deleted.

13 changes: 0 additions & 13 deletions Vim-iTerm.scpt

This file was deleted.

23 changes: 23 additions & 0 deletions Vim.scpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on run {input}
set terminal to "Terminal" # "Terminal" or "iTerm"
set cmd to "vim"

repeat with eachItem in input
set cmd to cmd & " " & quoted form of POSIX path of eachItem
end repeat

if terminal is "Terminal" then
tell application "Terminal"
launch
do script cmd
activate
end tell
else if terminal is "iTerm" then
tell application "iTerm"
launch
create window with default profile
tell current session of current window to write text cmd
activate
end tell
end if
end run

0 comments on commit 7c3b693

Please sign in to comment.