Live data from Hacker News

Little known features of iTerm2

banga.github.io

71–80 of 156 posts

Re: Little known features of iTerm2

#71
post #19

I was one of those vim users that was stuck on MacVim for years because my brain was too wired to hitting "cmd-s" for save and other dedicated app niceties. I mean, sure I can :w or bind it to another key, but there are a couple shared OS-level shortcuts like this I just like to retain. No worry, iTerm2 can capture ANYTHING, and rebind it as needed. This means I have a few remaps like "cmd-s" in iterm2 to map to obsc…

Really? I didn't think iTerm would pass along cmd keys, which is the primary reason I use MacVim instead.

For example, I use these kinds of mappings:

    nmap  
    nmap  
    nmap  
    nmap  
    nmap  
    nmap  
    nmap  
    nmap  :CtrlP pwd
    nmap  :CtrlPBufTag
    nmap  :CtrlPMRUFiles
This way, when on a Mac I can use cmd in place of ctrl for various commands I use all the time that are less convenient with ctrl.

In my .gvimrc, I added the following to make sure that cmd-p and cmd-l don't get incercepted: "Disable the print key for MacVim" if has("gui_macvim") macmenu &File.Print key= macmenu &Tools.List\ Errors key= "macmenu &MacVim.Hide\ MacVim key= set macligatures endif

If there's any possible way to accomplish the same with iTerm, I'd give it another try!

Re: Little known features of iTerm2

#72

tmux -CC support is my favorite feature of iTerm2. It's amazing.

Can anyone ELI5 on Tmux? I want to know if I’m missing out on an awesome tool by not knowing about it by having heard the name it a lot.

If you didn't miss it until now, it's likely you won't need in much in the future, either. Three main features and their value as I judge them:

* Detach/reattach sessions. This is useful; I run a always connected IRC client on my home machine in a detached session, then reattach to it on the go or from work. Tip: http://enwp.org/Byobu_(software) / http://byobu.co has a vastly better out-of-the-box experience than plain tmux.

* Split screens. I never use it. My GUI terminal emulator software already can do that, but plain tabs or the window manager's features have always been sufficient.

* Connection multiplexing. SSH already does that for me, see `ControlMaster` and `ControlPath` in `man 5 ssh_config`.

Re: Little known features of iTerm2

#73
post #28

I've found a lot of use from cmd-shift-e, which shows timestamps for each output line in the terminal. Great for figuring out how long a process ran for.

Is there a way to make the timestamps permanent? Kinda sucks that they disappear when you close iTerm.

Re: Little known features of iTerm2

#74
post #34

Not sure whether or not this is a little-known feature. iTerm2 has _fantastic_ integration with tmux (software used for persisting a terminal session across multiple logins). Tmux can be a pretty complex piece of software, but iTerm can basically wrap it all up into a nice package. You don't need to know anything at all about tmux to use iTerm's tmux integration. If you're SSHed into a server that has tmux installed,…

I use iTerm2 with tmux every day (but I don’t ssh into machines often nowadays) and I feel oppositely — I don’t get the attraction of the tmux integration. But maybe I still haven’t understood it, so please feel free to tell me what I’m missing. For me, the purpose of using tmux on my laptop is session, window, and pane management. (Perhaps my favorite tmux feature is zoom-pane.) So I find that the iTerm2 tmux integration takes away everything I liked about tmux, and makes using tmux feel like using iTerm2 without tmux!

Re: Little known features of iTerm2

#75

Earlier quoted context omitted.

I haven’t really figured out Tmux, and I’m a little ashamed to admit it. I usually reach for screen when needed, and disconnect/reconnect/kill are the only commands of screen I know. I’ll give the tmux -CC a go when I’m back at my machine, but what else does the integration do? I’m a heavy pane user - does the default split pane in tmux mode use tmux splitting for example?

Yes, splitting panes in iTerm will crate tmux panes on the remote. It's a pretty neat feature.

I mean, it uses it, but it no longer feels like tmux, and you don’t have nice tmux features like zoom-pane, right? iTerm2 is absolutely fantastic and I would miss it if I moved to a linux laptop, but I still haven’t seen the attraction of the tmux integration yet!

Re: Little known features of iTerm2

#76
post #19

I was one of those vim users that was stuck on MacVim for years because my brain was too wired to hitting "cmd-s" for save and other dedicated app niceties. I mean, sure I can :w or bind it to another key, but there are a couple shared OS-level shortcuts like this I just like to retain. No worry, iTerm2 can capture ANYTHING, and rebind it as needed. This means I have a few remaps like "cmd-s" in iterm2 to map to obsc…

Really? I didn't think iTerm would pass along cmd keys, which is the primary reason I use MacVim instead. For example, I use these kinds of mappings: nmap nmap nmap nmap nmap nmap nmap nmap :CtrlP pwd nmap :CtrlPBufTag nmap :CtrlPMRUFiles This way, when on a Mac I can use cmd in place of ctrl for various commands I use all the time that are less convenient with ctrl. In my .gvimrc, I added the following to make sure…

Not a vim user but iTerm2 settings have a section for rebinding modifier keys, (plus you also have karabiner-elements)

Re: Little known features of iTerm2

#77
post #68

Anyone else have any problems getting the first one to work? I could run /usr/local/bin/hub browse -- commit abc123 without issue, but iTerm wasn't even changing to cursor when hovering over a hash and holding cmd.

Nevermind. Think quitting iTerm was key.

Off/on again.

Re: Little known features of iTerm2

#78
post #55
post #36

I’m surprised to see that the iTerm2 dedicated hotkey window hasn’t been mentioned. It’s essentially a system-wide terminal window that you can open with a hotkey, similar to the old Visor app, and you can configure it as a floating window that appears over other apps' full screen windows. https://www.iterm2.com/documentation-hotkey.html

Yeah - I use this workflow and love it. cmd + esp (with caps lock remapped to escape) to toggle a full screen terminal from any application. Means don't have to cmd + tab and hunt for it, it's always one shortcut away.

Agreed this is the most important feature for me. I use it in the same way.

Re: Little known features of iTerm2

#79

Semantic History is pretty handy and not well-known. It lets you Command+Click on a path to open it in your editor (or associated application). It also lets you Command+Drag a path to get a usable file-handle to drop into other apps that handle file-related dropzones. Demo video I made when I added the feature: https://vimeo.com/21872771

Can it extract the correct line number from tracebacks, compiler / linter output etc? I wrote this tool, but I know George Nachman has added some features since I wtote it:

https://github.com/dandavison/iterm2-dwim

Re: Little known features of iTerm2

#80

I love iTerm! I've wondered whether it's possible to setup profile-specific (or folder-specific) aliases? I understand it might be zsh feature that I'm really after, but perhaps iTerm can solve it too?

Profile-specific aliases are easy.

In your .zshrc (or .bashrc), just use the value of $ITERM_PROFILE to set (or source a file containing) the aliases you want:

[[ $ITERM_PROFILE == “AWS” ]] && source ~/.aliases.aws

Post reply on HN