ervandew / screen

Simulate a split shell in vim using gnu screen or tmux
202 stars 31 forks source link

Mac OS X default terminal application #22

Open onemanstartup opened 11 years ago

onemanstartup commented 11 years ago

Instead of Terminal.app make iTerm2 or make settings to allow override

ervandew commented 11 years ago

Have you looked at :h g:ScreenShellTerminal? Does that not do what you want?

ervandew commented 11 years ago

I'd also be happy to add iTerm2 to the list of default terminals to look for on OSX if you can give me the exact string to put into the s:terminals list in autoload/screen.vim (I don't have OSX available currently to test that myself). Or you could provide a working pull request which adds that string.

onemanstartup commented 11 years ago

Sorry didn't see settings, but after I set let g:ScreenShellTerminal = 'iTerm.app' I get error when calling ScreenShell from MacVim Error detected while processing function screen#ScreenShell..<SNR>51_ScreenInit: line 85: also ScreenShellVertical don't work in gui, but it will be great if it just symlink this for usual ScreenShell

ervandew commented 11 years ago

after I set let g:ScreenShellTerminal = 'iTerm.app'

Is it iTerm.app or iTerm2.app?

I get error when calling ScreenShell from MacVim Error detected while processing function screen#ScreenShell..<SNR>51_ScreenInit: line 85:

Here is what screen.vim is doing under the covers to start the terminal:

return 'silent !osascript -e "tell application \"' . a:term .
  \ '\"" -e "do script \"' . a:cmd . '\"" -e "end tell"'

Can you try running something like that manually to see if a meaningful error is returned (replace screen with tmux if that's what you're using):

:!osascript -e "tell application \"iTerm.app\"" -e "do script \"screen\"" -e "end tell"

You may want to try it without the .app extension too.

also ScreenShellVertical don't work in gui

:ScreenShellVertical doesn't work in the gui because you're opening a terminal, not splitting one.

but it will be great if it just symlink this for usual ScreenShell

I prefer to omit commands for configurations/environments that don't support them. If the command simply calls :ScreenShell instead then that could be confusing for other users. You can of course create your own command in your vimrc which calls it though.

onemanstartup commented 11 years ago

tried iTerm (just worked in AppleScript) - the same

applescript give me error this this line you gave - Expected end of line but found “script”.

ervandew commented 10 years ago

I finally had a chance to play with this on an OSX machine and I couldn't come up with applescript that worked properly. I was able to create some that launched iterm2 for the first time and ran a command in the resulting shell, but that same code would fail if iterm2 was closed without fully quiting the application. Also if a term was already open it wouldn't create a new one like I wanted. But the code to create a new session would then result in 2 windows if no iterm2 app was currently running.

So my conclusion is that iterm2's applescript interface isn't sufficient for how screen.vim works, or that my lack of applescript knowledge prevents me from finding the magic to make it work as expected. I'll leave this ticket open should someone come along and provide a working solution, but until then I'm afraid that iTerm2 is unsupported by screen.vim.

dpo commented 9 years ago

For what it's worth, let g:ScreenShellTerminal = 'iTerm.app' seems to be working for me. Sorry. Spoke too fast.

dpo commented 9 years ago

Maybe these can help: https://github.com/tpope/vim-dispatch/blob/master/autoload/dispatch/iterm.vim https://gitlab.com/gnachman/iterm2/wikis/Applescript