
iTerm2 Shell Integration - rayshan
https://iterm2.com/shell_integration.html
======
gnachman
I'm here to answer questions anyone has about this. It's a newish feature so
feedback is welcome, and bug reports are greatly appreciated.

Also, credit goes to FinalTerm for the inspiration. RIP.

~~~
matt4077
I'm using a german keyboard and the shortcut cmd-; is inaccessible because ';'
is shift-,

I couldn't find a way to customise the shortcut in options. Sorry if I was too
stupid to find it.

Great work otherwise.

~~~
hmottestad
Same here in Norway (and the entire Scandinavia).

~~~
kawsper
Lots of stuff seems broken by default if you are on an exotic layout. I am on
a Macbook with a Danish-layout, and ALT+ARROW_LEFT/ARROW_RIGHT doesn't work
out of the box in iterm2, however it seems to work if you rebind, or type this
into .inputrc:

    
    
      "\e\e[D": backward-word
      "\e\e[C": forward-word
    

I'd love to switch to an american keyboard, because lots of Unix things seems
impossible to type with my current keyboard, but maybe I am just being stupid.

~~~
pi-rat
I switched from a Norwegian keyboard to a UK keyboard with intl. English map
on my MacBook. Default keyboard shortcuts suddenly made so much more sense -
and I can code without having to use my nose when I run out of fingers for
modifier keys. ()[]{}\|/:;' are all available using at most a single modifier
(many of them without). Scandinavian characters are available using a single
modifier for when I don't code, ex alt-a for å. Definitive productivity boost
for me.

~~~
tracker1
On the one hand, I appreciate that English is as pervasive as it is in
software engineering, being an American... on the flip side, it's a bit
disappointing how little effort is often made to make sites and applications
less friendly to foreign inputs and layouts (including inputting names).

------
kzhahou
Congrats, team! iTerm2 (esp in fullscreen mode) is THE reason I could never go
back to windows development.

~~~
ryenus
+1

I used to use cygwin on windows with screen, it kinda works, just everything
is so slow. Every time I create a new screen window I had to peek HN for
latest posts. LoL

------
Myrmornis
This looks great! I love iterm2 and have used it every day for years. My
biggest problem is the configuration -- I just _wish_ it had a plain text
configuration file that I could keep under version control. I've experimented
with using PListBuddy and a git diff driver to keep the plist under version
control but it seems unwieldy and I haven't found that approach useful yet.

Also I don't really understand the difference between the main configuration
interface (cmd-,) and the "Edit Session..." interface (right click on iterm2
menu). Possibly related, I have a custom command configured in Advanced ->
Semantic History but it keeps reverting back to no command and I just don't
understand why.

I would love not to have to use a graphical interface to configure it, I would
like a plain text file instead. I think I'm being dumb and a couple hours
consideration would lead me to understand any issues I'm having but the fact
remains that after years of use its configuration is something I find really
painful.

------
pixelbeat
The popup on command completion is a neat feature actually which I've
appreciated in gnome-terminal on Fedora 22, nicely integrated into the
notification system

------
themodelplumber
Funny how we just finished a discussion about "why haven't you switched to
Fish yet," and now this comes along with not-fully-baked Fish support. :)

~~~
gnachman
Update: I just tested it and fish 2.2 works great out of the box.

I haven't had a chance to test it yet, but I believe fish 2.2 will allow the
baking to finish. Fish cleverly parses the prompt to figure out how long it is
(vs bash which requires you to wrap nonprinting sequences in \\[ and \\]).
Unfortunately fish's support for OSC codes was incomplete. This was a problem
because shell integration uses them to report the current directory, hostname,
prompt location, etc., so fish would wrap at the wrong location. I submitted a
patch a while back, but I can't very well ask people to run a hacked version
of their shell. So until a few days ago it was half baked. Now it's like 90%
baked :)

~~~
themodelplumber
Cool, thanks for the update :)

------
x0054
I use iTerm2 a lot in the "visor" (pop up from the top) mode. I have my iTerm2
plist file edited so that it displays no bar icon and pops up even over the
full screen apps. It would be really nice to have a feature where instead of a
popup alert, the visor window would just slide out, to let me know that it's
done.

But all in all, sounds like an awesome set of features, will have to try
tonight. Thanks!

PS: On an unrelated note, if later on you could add native support for pop out
window to appear in full screen apps, and maybe do a check, so that if you are
in full screen app mode, it pops over with 0 y offset, but if it's in a norma
screen, it pops up with offset to accommodate the menu bar, that would be
awesome. But no rush :), thanks for all the awesome work!

------
msoad
Click to download or drop in to upload is really nice! I'm excited for this!

BTW if you're using iTerm, be aware that ⌘+clicking on a link will open the
link in browser or ⌘+clicking a file in `ls` result will open the file with
default app.

~~~
JonnieCache
Even better, cmd clicking on a _. /path/file:line_ string will open in your
editor at that line. Perfect for backtraces.

------
hiroprot
I really like this, but am wondering if something like ZModem over SSH would
make the file transfer stuff more convenient...I feel like some things have
become more complicated since the BBS days.

~~~
gnachman
You can do that too, but the download.sh script is much more straightforward:
[https://github.com/gnachman/iTerm2/blob/master/tests/downloa...](https://github.com/gnachman/iTerm2/blob/master/tests/download.sh)

------
hesslau_
I'd love to use a terminal with similar features on linux

~~~
Watabou
Terminator comes close, but to be honest, iTerm2 still beats it with its user
friendliness and features.

It's really interesting how OS X is the one that has a terminal emulator with
the most features out there.

iTerm2 now comes with 24-bit colors, command completion popup, notifications,
triggers, profiles, mouseless copy, split panes, search, and you can even have
inline images/gifs all out of the box with zero or minimal configuration
required. That's just awesome.

All of these features and iTerm2 still feels much faster than Terminator to
me.

~~~
rhubarbquid
> It's really interesting how OS X is the one that has a terminal emulator
> with the most features out there.

In my experience, the vast majority of web developers use OS X. Those of us
doing server side and devops work spend a lot of time in the terminal

------
neuropie
The script downloaded over HTTPS then downloads further scripts over HTTP.
Watch out.

~~~
gnachman
Fixed, good catch.

------
sgarrity
Does it work with mosh ([https://mosh.mit.edu/](https://mosh.mit.edu/))?
Thanks.

~~~
gnachman
Looks like mosh swallows OSC codes it doesn't know what to do with. I'll let
them know.

------
DavideNL
Does this update speed up things as well by any chance?

I like iTerm2 a lot, but one day when i coincidentally started using the
normal Terminal i noticed how fast it was/how slow iTerm2 was, which is the
reason i stopped using iTerm2 and switched to TotalTerminal (a plugin for
Terminal.app).

~~~
gnachman
Yes! The incoming bytestream is now parsed into tokens in a separate thread.
There are various other performance improvements as well, such as a fastpath
for when no double-width characters are present.

------
jrcii
Speaking of shell integration, I use this Automator app with "Open with" to
open Finder files in a new tmux vim window
[http://pastebin.com/rxyB8c8k](http://pastebin.com/rxyB8c8k)

I use a similar script/Automator app to "Open this directory in iterm" by
dragging it into the Finder toolbar
[http://pastebin.com/1at3CXvP](http://pastebin.com/1at3CXvP)
[http://i.imgur.com/QGqQSOJ.png](http://i.imgur.com/QGqQSOJ.png)

------
JustinAiken
Wow guys, this is great... I'd manually tried setting something up with
PushBullet for a few long running commands, but just hitting a shortcut combo
is much nicer...

brew installs and bundle installs and the like will be a joy now!

------
chrisshroba
Is it possible to enable/disable features? Since installing, my prompt has
been rather buggy, and there are some features I don't particularly care for,
but others I really like. For example, my python virtualenv prompt gets broken
into two lines, both with a mark, which causes line lengths to misbehave too
sometimes. Alternatively, not to sound like a downer, but is there a way to
uninstall shell integration? Thanks!

------
tonyedgecombe
I'd love to see something like iTerm for Windows.

~~~
RoboSeldon
Not exactly an iTerm2 clone but pretty close conemu
[https://code.google.com/p/conemu-maximus5/](https://code.google.com/p/conemu-
maximus5/)

~~~
codereflection
+1 for conemu. It's approach and direction seem to be different than iTerm2,
but still a must have on Windows.

~~~
djKianoosh
+1 for conemu/cmder plus git bash on windows. again, different than iterm2 but
also a must have

------
taternuts
I didn't know about the Toolbelt, that's pretty useful. It'll be really
awesome to have history + recent directories integrated

------
soundjack
Great stuff, I've been using iTerm2 for a while and it's really good to see it
evolve like this.

I use screen a lot (yes I know, I should switch to tmux one day!) and shell
integration doesn't seem to work properly with sessions inside screen. Works
perfectly if I ssh directly. Is it going to be supported eventually or is this
the ultimate signal for me to switch to tmux?

~~~
gnachman
By default, it is disabled in tmux. It works fine in iTerm2's tmux integration
mode, but not in plain old tmux. I'm hopeful that this feature will prove
popular and useful enough that I can get tmux to add support for it. To make
it work in tmux integration mode just remove the check that $TERM == "screen"
in $HOME/.iterm2_shell_integration.$SHELL.

~~~
brainslug
Thanks for the tip. Unfortunately, right clicking on a mark is not working in
tmux integration mode.

------
xtacy
I just love iTerm2, but I feel it's slow and unresponsive at times (Garbage
Collection?) compared to Apple's Terminal. I still keep using iTerm2 because
of its features. If there is any way I can profile these slowness and submit a
bug report to have it fixed, please let me know!

~~~
gnachman
I assume you're using 2.9.x here. Try turning off prefs>advanced>avoid
repainting the screen when the cursor is hidden. Let me know if that makes a
difference.

------
baconhigh
I like the idea of these features, but the "run this random shellscript from
the internet" part really bugs me. Could / will you integrate it another way
when it comes out of the nightly releases?

~~~
rockdoe
At least it's being served over HTTPS :-)

~~~
neuropie
It is until you look at the script it downloads, which downloads further
scripts over HTTP.

------
DiabloD3
I'm concerned about the wget to an external server part. This file should be
local to prevent excessive slowness and potential security issues.

Also, is there a zsh version of this file? zsh is extremely popular on osx.

~~~
gnachman
The linked page explains how to install by hand. I'd like to eliminate the
curl|bash. It's tricky to deploy a shell script in a terminal emulator, so it
hasn't been done yet. The ability to fix bugs without making users upgrade
their client has been invaluable during early beta.

~~~
glenjamin
Would it be possible for iTerm to "type" the whole thing in for me? It's
already executing a curl, can it do the whole thing through the host?

~~~
gnachman
That's the eventual plan. There are a million niggling details, so I didn't do
it yet.

------
callesgg
That is actually some really nice features that i could see myself using on a
daily basis.

However i feel that it might somehow fuck up some things, as it is using some
rather unconventional stuff.

------
dublidu
I'd like to use Automatic Profile Switching to change the profile when I ssh
to certain servers, but it doesn't do anything. What am I missing?

~~~
dublidu
I should add that I use ssh_config. I tried the file download feature but I
get an error, it tries to scp from MBP.local and doesn't seem to be aware of
my ssh session at all.

------
s800
right-click to scp is particularly neat.

~~~
sneak
Except that it doesn't shell out, so it ignores ProxyCommand...

~~~
gnachman
What do you use ProxyCommand for? It seems hard to support, but I'd like to
know more.

~~~
lclarkmichalek
I've used it in the past to ssh via bastion hosts and the like.

~~~
mturmon
Yes. My config is something like this:

    
    
      # proxy n02 connections through bastion
      host n02.university.edu
      ProxyCommand ssh bastion.university.edu -W %h:%p 2> /dev/null
    

Almost all my remote shells require a similar setup.

~~~
gnachman
Seems like this might be a common enough pattern that I could support it. I'll
have a look.

------
nvk
Thanks for this.

