Live data from Hacker News

Little known features of iTerm2

banga.github.io

131–140 of 156 posts

Re: Little known features of iTerm2

#131

Earlier quoted context omitted.

https://keepassxc.org/ https://gitlab.gnome.org/GNOME/sushi/tree/master/ , https://en.wikipedia.org/wiki/GNOME_sushi https://krita.org/en/features/highlights/ https://github.com/klaussinani/tusk https://oss.oetiker.ch/smokeping/ , https://oss.oetiker.ch/smokeping-demo/?target=Customers.OP https://www.mixxx.org/features/

While these may do some or all of the apps OP mentioned, the UX of most of them, even from the screenshot seems horrid.

To each their own, but yes, personally I find the UX of Mac GUI applications to be generally a lot more appealing compared to the alternatives available on Linux.

Re: Little known features of iTerm2

#132
post #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.

Would having them print directly in the shell prompt work? For bash, I combine PS0 support (in bash >=4.4) and PROMPT_COMMAND to do this.

My prompt command: https://github.com/paxswill/dotfiles/blob/c4c6d50123fc2535e2...

And PS0: https://github.com/paxswill/dotfiles/blob/c4c6d50123fc2535e2...

Basically the prompt command writes the current time stamp on the right edge of the window whenever the prompt is printed. Then PS0 overwrites that time stamp right before a command is executed.

If you want the time stamp on the left you can skip the prompt command and tput usage by using the \t escape code in PS1, but PS0 will need to be modified for the new location while still using tput.

Re: Little known features of iTerm2

#133
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…

AFAIK there is no way to tell vim about such a keystroke. If neovim adds something I’ll support it.

Re: Little known features of iTerm2

#134
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,…

More of a normal tmux question, but is there a way to input the window number, or is there a fast way to open up ssh to 4 servers numbered sequentially?

pane 1: ssh -1

pane 2: ssh -2

pane 3: ssh -3

pane 4: ssh -4

Re: Little known features of iTerm2

#135

Earlier quoted context omitted.

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!

Very true that you don't really have access to zoom-pane type features. But they're also not really applicable. The integration is more about giving you a native "tabs and GUI windows" kind of feel, so that you can have multiple terminals open without needing to mess around with panes, tmux windows, etc. And of course, that gets provided in a persistent way (so that you can disconnect and reconnect at will) just like a normal tmux experience.

Re: Little known features of iTerm2

#136
post #99

Earlier quoted context omitted.

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!

iTerm2 panes can be zoomed in.

As in maximise to take up the entire window? cmd+shift+enter to toggle, I love this feature.

Re: Little known features of iTerm2

#137
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,…

More of a normal tmux question, but is there a way to input the window number, or is there a fast way to open up ssh to 4 servers numbered sequentially? pane 1: ssh -1 pane 2: ssh -2 pane 3: ssh -3 pane 4: ssh -4

When I need to do cluster ssh with tmux I do this or a variant of it:

  function cluster_ssh() { 
    # Start a pane for every server
    for server in $*; do
      tmux split-window ssh $server
    done;

    # Same input to all panes
    tmux setw synchronize-panes on;

    # Init pane to background, tile layout
    tmux break-pane -s 0 -d
    tmux select-layout tiled
  }

  bash# cluster_ssh server-{01..10}.example.com


EDIT: made it a bit more complete, but you only need split and sync panes IMHO.

Re: Little known features of iTerm2

#138

Earlier quoted context omitted.

I don't have karabiner-elements, but doesn't it basically just remap keys across your whole system (much like my mechanical keyboard can)? I don't want change my cmd-keys into control keys system wide. I just want to be able to map my cmd-keys in vim (which to be honest is the lion's share of what I use any terminal for).

Karabiner-elements is good for mapping single keys to other keys. It doesn’t handle key combinations. (There is something called complex modifiers, but I can’t figure out how to edit them.) BetterTouchTool is good for mapping key sequences. Further, it can do it selectively based on what application is active.

Is it per program or global? If it's global, it fixes nothing for this specific issue.

Re: Little known features of iTerm2

#139

Earlier quoted context omitted.

It should, I originally built it for rspec output but it should work with most common formats that put the line number attached to the path with a colon.

Hey! Glad to see you’re still around. Hope you’re doing well :)

Oh hey! Still kicking about but haven't really done Mac dev for a couple of years. Hope you're doing well too and keep up the great work with iTerm2!

Re: Little known features of iTerm2

#140

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.

Have you ever needed to run a long-running job over SSH? If your command is still running and SSH disconnects, your command gets terminated. You can work around this by using nohup like this: `nohup &` to launch your program.

Tmux is kind of like nohup, but for the whole shell. If you SSH into a terminal and start tmux, it'll give you a shell that survives disconnect/reconnect.

Tmux can also act sort-of like a tiling window manager for your shells. So you could have a few shells open, and maybe split your screen 50/50 between two shells, or 50/25/25 or something.

It's a pretty useful program if you spend a lot of your day SSHed into external machines (or if you like to work locally in a full-screen terminal window). It's also got some esoteric keybindings and a steep learning curve and it messes around with your mouse, scrollback, and copy-paste.

iTerm2's tmux integration ignores the disconnect/reconnect stuff (although if you reconnect, your session will just "come back" in whatever state it was when you disconnected). The killer feature is that it takes tmux's window-manager functions and maps them onto tabs and windows in the GUI app. This basically makes it look and feel like you're running iTerm from whatever machine you're logged into over SSH, except that what actually happens under the hood is a bunch of tmux magic.

Post reply on HN