vim-dispatch
vim-dispatch copied to clipboard
iTerm doesn't work when split pane is opened
Currently, if I run :Dispatch and any iTerm window has split panes open, the command just hangs. It looks like the new session is started, but the command is being sent to the split rather than created session.
When no split panes are open, it works flawlessly.
I've tried running the AppleScript from https://github.com/tpope/vim-dispatch/blob/master/autoload/dispatch/iterm.vim#L26-L40 manually and the result is the same.
The following patch made it work, but:
- I was getting some weird errors when testing this using Script Editor.
- It opens new tab at the beginning, not the end.
- It screws over session titles (e.g. sets for new session and split pane)
diff --git a/autoload/dispatch/iterm.vim b/autoload/dispatch/iterm.vim
index 7b52012..82ff6de 100644
--- a/autoload/dispatch/iterm.vim
+++ b/autoload/dispatch/iterm.vim
@@ -29,7 +29,7 @@ function! dispatch#iterm#spawn(command, request, activate) abort
\ 'tell application "iTerm"',
\ 'tell the current terminal',
\ 'set oldsession to the current session',
- \ 'tell (make new session)',
+ \ 'tell (make new session at the beginning of sessions)',
\ 'set name to ' . s:escape(a:request.title),
\ 'set title to ' . s:escape(a:request.command),
\ 'exec command ' . s:escape(script),
iTerm: Build 1.0.0.20140629 vim-dispatch: Cloned at 990d542c2d1da39d879a19dc07587240f8ea322e
issue still valid
I take it that fix doesn't work if you change it to at the end of sessions? I'm not too keen on making that sacrifice.
Also, I'm not entirely clear what number 3 means.
The fix was working at some point. Since then, I've switched to iTerm 2.9 (nightly) where AppleScript support has been rewritten so the whole iTerm strategy doesn't work there.
I tried to fix it, but there were some issues (or lack of functionality) which didn't allow me, so I've written dispatch-vimshell.vim in the end.
Also, I'm not entirely clear what number 3 means.
Don't really remember now too.
I take it that fix doesn't work if you change it to at the end of sessions? I'm not too keen on making that sacrifice.
As far as I remember, it only worked with beginnning.