Hacker News new | past | comments | ask | show | jobs | submit login

tmux was an absolutely game changer for me. At first I thought I was fine just being really comfortable with shortcuts and splitting commands with my favorite terminal emulators but tmux along with tmux plugins ecosystem[0] is really a world of difference, and much better.

I haven't gone so far as to change my default shell to tmux in the terminal emulator I use, for the sole reason that I imagine that I just don't need tmux every single time. In reality, 99% of the time the first thing I do when I restart my computer and open a terminal and run `tmux`, and start setting up my workspaces based on what I've been doing, naming windows, etc.

The top two features I use every day:

- keyboard-only selection + cut & paste between panes (yes, piping to xclip is good, but it's nice when you can just enter the right tmux mode, use emacs/vim keybindings to go up and copy out some text)

- easy/instant resizing and organizing of panes

- naming/breaking/moving/combining panes, to focus my efforts (something as simple as naming a window appropriately focuses my efforts inside that window)

An example of this is working with tools like `kubectl` that generate randomly named components that I have to list out @ the command line and do operations on, most of the time when I watch people deal with this in talks, they have to go and double-click-select or type things out.

[0]: https://github.com/tmux-plugins




Check out tmux-fingers by morantron. It lets you copy any line that matches a pre-defined regex. I just recently got a PR merged that supports kubernetes resources. So now I don’t even have to click the line (in mouse mode) and then hit shift+4 and yank, instead I just hit prefix+F and then the corresponding letters that appear.

Kinda hard to explain, but it’ll make sense if you look at the gh repo.

[It’s always driven my insane how kubernetes names its pods. They still haven’t implemented regex matching - there’s an issue on github related to that that went stale. For now I use a combjnation of selectors and old school unix regexes (awk, grep, etc) when I’m passing around kubectl commands that I need to work rgardless of whether the container has restarted or not]


Thanks for the tip! Usually since I've just run a `kubectl get pods` or whatever I use the keyboard navigation to go up a few lines, ctrl+a and use the emacs bindings to yank...

I just downloaded and installed tmux-fingers with tpm, but it's doing a pretty terrible job of picking up on the right things... I'm assuming i need to put in the predefined regexes that would match pod names/ lines of the get output?


It works for the output of kubectl get all, not kubectl get po unfortunately. [This is because without the resource name as a prefix, there’s no general regexes that will work for everyone’s situation] As a hack I sometimes end up doing kubectl get all | grep ‘pod/‘, which is a little inelegant. You can add your own regexes (see the readme of tmux-fingers, you do @fingers-pattern-0 your_regex) and then reload the config

Realistically I suppose it’s only marginally faster than kubectl get po -o name and then manually copying.

For any project I work on frequently I set up aliases that wrap it anyway. As you already know kubectl doesn’t allow regex matching so I just do something like: kubectl delete pod “$(kubectl get po -l app=MY_APP_SELECTOR)”, etc. naturally your deploy needs granular selectors otherwise you need to further pipe to grep or awk


> first thing I do .... and start setting up my workspaces based on what I've been doing

There are plugins for that! tmux-resurrec will restore your sessions on reboot, including directories and env vars. It can use vim and emacs sessions to restore your editors too. And you can also tell it other custom "safe" commands it is allowed to restore, which I use for stuff like repls.


oh yeah, I know! I tried using it but it was pretty buggy last time I tried (this was ~1/2 years ago), so I stopped using it.

I'm sure it's better now, but I don't keep that much stuff around so I don't think I'm too inefficient in not using it


It's definitely a tool that, once you get used to using it, it is hard to imagine not using it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: