I love this, I've been iterating on workflows like this for something like a decade now. Over time I've tried to peel back as many of my custom layers as possible, because all of those layers have a maintenance cost.
Stock Vim (without `tmux`) can actually do most of what's shared in this post with `rg --vimgrep restore_tool | vim -c cb -` (`vim -c cb -` is my favorite feature in Vim; I find it strange that it's so rarely used or talked about).
(Since re-running the `rg` search can be undesirable, and I often like to analyze results in a terminal before opening them in Vim. I use a custom `tmux` command to copy the output of the last command [using this trick that involves adding a Unicode character to your prompt https://ianthehenry.com/posts/tmux-copy-last-command/], then I send that into Vim with e.g., `tmux saveb - | vim -c cb -`.)
msgodel · 3m ago
Ten years ago I threw out my massive multi-file, multi-package vim config and have been slowly building up a much simpler vimrc about 1-2 lines a year. I completely agree, defaults in old software are almost always there for a reason and you should try to understand that before changing them.
johnmaguire · 12m ago
> (`vim -c cb -` is my favorite feature in Vim; I find it strange that it's so rarely used or talked about).
Care to explain what it does? Trying `ls | vim -` and `ls | vim -c cb -` I don't immediately see a difference.
robenkleene · 2m ago
`cb[uffer]` processes the current buffer as a compile buffer, which will find `grep` format matching lines [i.e., at a minimum starting with `<path>:<line-number>:<column-number>`] and populate the quickfix list with them (and jump to the first match).
E.g., your example doesn't do anything because `ls` doesn't use `grep` format lines. So try piping the output of `grep` matching the above format (or you could try `ls | sed 's/$/:0:0/' | vim -c cb -`, which will hack `ls` output to grep, and is occasionally useful).
thom · 23m ago
Every vim/tmux user has created an ad hoc, informally-specified, bug-ridden, admittedly probably quite fast implementation of half of Emacs.
b0a04gl · 16m ago
vim+tmux setups usually lean on system primitives = pipes, files, signals, scrollback so the tooling tends to stay transparent across environments. that gives them an edge in portability and debugging, especially over ssh or in constrained shells. it's just lets your workflows shaped around different guarantees so natively, it naturally makes building your own vim config an obvious choice
jynelson · 8m ago
i see a bunch of people saying things like "you can do this in vim or emacs". it's true, you can do fuzzy finding and panes/tabs in an editor. but then you are in a box. anything that involves interacting with the terminal requires either a dedicated plugin or opening another nested terminal emulator (e.g. `:terminal` in vim). one of the things i get from my setup that's not mentioned in this post is that i can hit `git show HEAD` <highlight files and choose one> <tab> and that will put the file name in the command. this works for arbitrary commands, not just git, because it works by doing meta-processing on the terminal.
gertlex · 42m ago
I really appreciate this method of sharing workflows. Well catered to the audience. Actually was slightly hoping there'd be sound to the vid, too, but reading the list of actions after-the-fact was reasonable. I learned a few things I could do and/or approach differently in my own flows.
You mentioned the arcane keyboard shortcuts of tmux. I'm curious if you or others here have tried/use byobu (which I think of as a wrapper around tmux, basing most commands on the F# row). I was shown it a decade ago and have used it since (after a couple prior years of primitive tmux use).
jynelson · 34m ago
glad you've enjoyed it :) i was trying to find something that was clear while still being easy to skim.
> You mentioned the arcane keyboard shortcuts of tmux.
oh, i've remapped almost all the shortcuts in tmux. `ctrl-k` is not the default prefix and `h` is not the default key for "select pane left".
i haven't tried byobu but from skimming the readme i expect it not to have a ton other than nicer default key bindings, and i'd rather not add more layers to my terminal.
pxc · 1h ago
If you don't want to write a giant regex like this yourself, there are some ready-made tmux plugins that add things like this to copy-mode.
Any configuration or plugin that leans on the built-ins is probably going to be faster, so consider that w/r/t tmux-copycat.
I also really like tmux-resurrect, which saves and restores sessions for you; tmux-continuum, which runs those automatically; and the tmux-zen plugin for Oh-My-Fish:
It's pretty easy to get a very nice tmux setup going!
jynelson · 37m ago
yeah, i got the original regex from tmux-copycat. but a) that regex doesn't handle `:` and b) copycat builds its own "viewer" abstraction on top of saving and restoring the pane state, which means that you can only have one action per search. my thing allows you to use normal tmux configuration syntax to bind actions to the files that are highlighted, because it reuses tmux's built-in search. note how all these plugins are either only supporting copy/paste or building their own "modes" on top, because tmux gives you very little control over highlights unless you use the built-in search.
gricardo99 · 10m ago
The one thing pulling me towards VS code, and away from terminal workflows is Copilot and the Agent workflows. Being able to seamlessly chat with AI models and then see/review its code changes is the biggest change to my workflow and productivity in years.
I’m guessing some people already have these capabilities integrated into terminal workflows and I’d love to see a demo/setup.
kashnote · 3m ago
Totally agree. I'm a big fan of neovim but didn't find a good AI solution that compared to Cursor. Even though I miss some of my neovim plugins, Cursor + Vim plugin is pretty hard to beat.
msgodel · 5m ago
Wow really? That seems like it should move you towards language oriented tools and away from GUIs.
I use aider + neovim FITM plugin (with qwen coder.) It's nice because it not only can help me with code problems but the often more frustrating tool problems.
happytoexplain · 1h ago
The entire blog post being in lowercase distracted me more than I thought it would.
gouggoug · 1h ago
It's also interesting to see that the author themselves are clearly fighting against their own instinct to use uppercase: the first 2 items in the "here's what happens in that video:" list use uppercase.
jynelson · 42m ago
that's voice-to-text on iOS, i haven't found a way to turn off the auto-caps yet.
furyofantares · 10m ago
Kids these days. That's how many of us who grew up online in the 90s to early aughts have been doing things for 30+ years.
I think many of us abandoned it when we went professional. Or abandoned it in those contexts but still do it in others. I don't do it on HN, clearly - but I do it almost everywhere else. It's much more natural to me to skip capitals.
I believe there was also a period in the transition to ubiquitous smartphones where it wasn't an option to turn off auto-caps, or maybe there just wasn't the fine-grained control of which auto-correct you use on mobile devices that there is now. I suspect that killed some all-lowercase habits. I think that's why I ended up with a "normal" style on HN where I use caps and normal punctuation (I don't usually use periods for sentences that terminate a paragraph outside of HN.)
incognito124 · 1h ago
Huh interesting, I didn't even notice that
RestartKernel · 32m ago
It's a stylistic choice you sometimes see people commit to. Porter Robinson (a DJ) does the same thing, and it's always struck me as a bit indulgent.
b0a04gl · 20m ago
terminal scrollback is the only UI we don't treat as queryable state. op's setup shows how much context we're missing away a lot of rg output, file paths, stack traces, build logs they're all already right there in cluttered state.
if shells exposed a scrollback api with line refs and structural tagging, we could annotate paths, link to buffers, diff last two runs, all without re executing anything. that would cut through half the indirection in current workflows. tmux's regex jump is a hack but it hints at a deeper model. scrollback should be its own memory layer
msgodel · 1m ago
That's the tty or the thing on the other end of the pty (ie your VTE like Xterm) which would have to do that. The shell has no access to any of it.
jynelson · 19m ago
yes!! one of the things i really want from a terminal is structured metadata, it allows you to build so much on top. right now anything remotely close requires parsing a bunch of ansi escapes.
Analemma_ · 15m ago
PowerShell got so close to doing this, and then they fumbled it right at the finish line by having terminal objects be binary data instead of structured objects in some kind of serialized format. PowerShell is honestly awesome for a bunch of reasons and getting to query pipe objects instead of parsing them is great, but the binary blobs hold it back from being perfect.
Several attempts have been made to do similar things in Unix, but there's a massive ecosystem problem: four decades of classic tooling has to be totally rewritten to get this kind of support. I don't see it happening without some kind of industry champion who can throw their weight around to force it on people.
jynelson · 5m ago
i have ideas about how to strangler-pattern this so that it doesn't require a "flag day" where everyone switches over at once. i have about 15 paragraphs of this written up locally i need to turn into a blog post ^^
jonjacky · 2h ago
The article title is actually "How I use my terminal"
progbits · 1h ago
This is a HN "feature" removing How if it's the first word in the title. It serves no purpose other than generating confusion, with mods saying this somehow stops clickbait. How, you wonder? Nobody knows.
Stratoscope · 1h ago
Reminder to anyone submitting an article: you have two hours to edit the title to fix these alterations.
rbanffy · 24m ago
I believe these changes are intended to defang some clickbaity titles, but you are right that it maims some perfectly good ones.
littlerbooks · 1h ago
Weird. I see a post titled "How to store Go pointers from assembly" literally three posts below this one.
happytoexplain · 1h ago
I believe the submitter can manually reject the auto-modified title, but they have to notice that it was modified.
(I could be wrong about that)
indigodaddy · 35m ago
Not quite reject exactly, you can just edit the title afterward for some X amount of time.
Stratoscope · 1h ago
You are correct.
osmsucks · 1h ago
I thought this was going to be a blog post about somebody using a terminal emulator they wrote.
Hard_Space · 1h ago
Thought that this was going to be a 'There Will Be Blood' spoof.
(In case not obvious, current title is 'I use my terminal')
IAmBroom · 1h ago
I use your sudo?
adolph · 53m ago
I use your
sudo !!
babelfish · 1h ago
HN will automatically trim some common prefixes and suffixes from title submissions
fitsumbelay · 1h ago
noticed this too
after skimming the post, feels like the full title = "I use my terminal (and so should you )"
Plus one for pro-terminal posts. As a chromebooker I've found that all I need is terminal and browser. Switching to my Mac OS seems kinda maximalist and I rarely use much outside of the terminal and, you know, more browsers
klntsky · 54m ago
It is sad that we have to know how to configure tens of small utilities just to be productive. I ended up using emacs with some packages that I configure minimally, after spending a few hundreds of hours on ricing the shell, file managers, tmux, etc
agentultra · 47m ago
Emacs is why I can't go back to terminals.
vyaa · 25m ago
I haven’t delved into emacs yet. Don’t you still have it configure it and all its tools?
bowsamic · 46m ago
I hate configuring things. I tried to use PyCharm and it works great until it doesn't, then it's a nightmare. For example, the ruff support is non-existent and the only plugin is broken as hell. I think at some point you just have to accept it won't be perfect, but it is sad because I can "imagine" the perfect IDE. I just don't have the time or energy to make it reality, and apparently neither do Jetbrains
iLemming · 20m ago
I don't think it's Jetbrain's fault, even though I have not used their products for almost a decade. Python ecosystem is finicky - too many options - it's hard to decide which things you want and need - black or yapf or ruff, flake8, rope, mypy, pydocstyle, pylint, jedi; there are multiple lsp server options (none of which is ideal), you get to know things like what the heck 'preload' plugin is - the docstring for lsp-pylsp-plugins-preload-enabled just says "Enable or disable the plugin", etc.
Trying to bootstrap a Python setup "that just works™" is also a common struggle e.g. in Emacs world. Python tools are just a bunch of contraptions built with fiddlesticks and bullcrap. Anyone who tells you differently either already have learned how to navigate that confusing world and totally forgot "the beginner's journey"; or too new and have not tussled with its tooling just yet; or simply don't know any better.
aftbit · 42m ago
I do all of this from vim. I have \a bound to repeat my last / search using ripgrep in the current directory, and open the matches in a panel below. I have \gd bound to go to the definition/declaration of a symbol.
enricozb · 1h ago
Fantastic. Been meaning to put something up like this myself. I feel like I gain so much information from just watching someone work, and having them open themselves up to questions.
tomsmeding · 52m ago
> Escape for some reason doesn't get sent as the escape key if it shows up next to any other keys???
Welcome to ANSI escape sequences. The left arrow key, for example, is really just <Esc>[D . You can see this stuff for yourself by running `cat >/dev/null` (cat isn't actually doing anything useful here, it's just allowing you to type without the shell getting in the way and actually, you know, making an attempt to interpret the keys you press). Press backspace to figure out which bytes are represented by 1 and which by 2 characters. 2-character sequences where the first is a caret (^) can be produced by ctrl + the second character, and correspond to the second character in ASCII minus 64. Hence ^A is byte 0x01. The escape key sends ASCII ESC, number 27, and is written ^[ .
Software distinguishes between a bare Escape key press and an ANSI escape sequence by waiting a couple of milliseconds and seeing if more bytes arrive. The number of milliseconds is often configurable, with e.g. the 'escape-time' config key in tmux and the 'ttimeoutlen' setting in vim.
jynelson · 23m ago
this is all true but it's not related to the bug in my post. this is input being sent via `tmux send-keys`, escape-time isn't relevant.
I've shared similar frustrations with VSCode's vim plugin. These days, I often run Neovim from within VSCode's terminal for complex editing tasks where I might need to use macros or use fugitive or whatever.
timewizard · 9m ago
I miss the console terminal where Alt-F# directly selects a terminal by index. So:
I use my terminal too, but VSCode runs fast enough for me. Maybe it's because I'm a mid 30s year old boomer now, but I figure if it's caching symbol tables then the lag isn't the end of the world.
But for whatever reason, I'd rather vimdiff when I have to resolve conflicts on rebase.
What I really hate about VSCode currently is how huge pylance is though, and how it's all up in my grill when I am trying to manually code.
Stock Vim (without `tmux`) can actually do most of what's shared in this post with `rg --vimgrep restore_tool | vim -c cb -` (`vim -c cb -` is my favorite feature in Vim; I find it strange that it's so rarely used or talked about).
(Since re-running the `rg` search can be undesirable, and I often like to analyze results in a terminal before opening them in Vim. I use a custom `tmux` command to copy the output of the last command [using this trick that involves adding a Unicode character to your prompt https://ianthehenry.com/posts/tmux-copy-last-command/], then I send that into Vim with e.g., `tmux saveb - | vim -c cb -`.)
Care to explain what it does? Trying `ls | vim -` and `ls | vim -c cb -` I don't immediately see a difference.
E.g., your example doesn't do anything because `ls` doesn't use `grep` format lines. So try piping the output of `grep` matching the above format (or you could try `ls | sed 's/$/:0:0/' | vim -c cb -`, which will hack `ls` output to grep, and is occasionally useful).
You mentioned the arcane keyboard shortcuts of tmux. I'm curious if you or others here have tried/use byobu (which I think of as a wrapper around tmux, basing most commands on the F# row). I was shown it a decade ago and have used it since (after a couple prior years of primitive tmux use).
> You mentioned the arcane keyboard shortcuts of tmux.
oh, i've remapped almost all the shortcuts in tmux. `ctrl-k` is not the default prefix and `h` is not the default key for "select pane left".
i haven't tried byobu but from skimming the readme i expect it not to have a ton other than nicer default key bindings, and i'd rather not add more layers to my terminal.
https://github.com/tmux-plugins/tmux-fpp
https://github.com/tmux-plugins/tmux-copycat
https://github.com/Morantron/tmux-fingers
https://github.com/tmux-plugins/tmux-urlview
Any configuration or plugin that leans on the built-ins is probably going to be faster, so consider that w/r/t tmux-copycat.
I also really like tmux-resurrect, which saves and restores sessions for you; tmux-continuum, which runs those automatically; and the tmux-zen plugin for Oh-My-Fish:
https://github.com/tmux-plugins/tmux-resurrect
https://github.com/tmux-plugins/tmux-continuum
https://github.com/sagebind/tmux-zen/tree/master
It's pretty easy to get a very nice tmux setup going!
I’m guessing some people already have these capabilities integrated into terminal workflows and I’d love to see a demo/setup.
I use aider + neovim FITM plugin (with qwen coder.) It's nice because it not only can help me with code problems but the often more frustrating tool problems.
I think many of us abandoned it when we went professional. Or abandoned it in those contexts but still do it in others. I don't do it on HN, clearly - but I do it almost everywhere else. It's much more natural to me to skip capitals.
I believe there was also a period in the transition to ubiquitous smartphones where it wasn't an option to turn off auto-caps, or maybe there just wasn't the fine-grained control of which auto-correct you use on mobile devices that there is now. I suspect that killed some all-lowercase habits. I think that's why I ended up with a "normal" style on HN where I use caps and normal punctuation (I don't usually use periods for sentences that terminate a paragraph outside of HN.)
if shells exposed a scrollback api with line refs and structural tagging, we could annotate paths, link to buffers, diff last two runs, all without re executing anything. that would cut through half the indirection in current workflows. tmux's regex jump is a hack but it hints at a deeper model. scrollback should be its own memory layer
Several attempts have been made to do similar things in Unix, but there's a massive ecosystem problem: four decades of classic tooling has to be totally rewritten to get this kind of support. I don't see it happening without some kind of industry champion who can throw their weight around to force it on people.
(I could be wrong about that)
(In case not obvious, current title is 'I use my terminal')
Plus one for pro-terminal posts. As a chromebooker I've found that all I need is terminal and browser. Switching to my Mac OS seems kinda maximalist and I rarely use much outside of the terminal and, you know, more browsers
Trying to bootstrap a Python setup "that just works™" is also a common struggle e.g. in Emacs world. Python tools are just a bunch of contraptions built with fiddlesticks and bullcrap. Anyone who tells you differently either already have learned how to navigate that confusing world and totally forgot "the beginner's journey"; or too new and have not tussled with its tooling just yet; or simply don't know any better.
Welcome to ANSI escape sequences. The left arrow key, for example, is really just <Esc>[D . You can see this stuff for yourself by running `cat >/dev/null` (cat isn't actually doing anything useful here, it's just allowing you to type without the shell getting in the way and actually, you know, making an attempt to interpret the keys you press). Press backspace to figure out which bytes are represented by 1 and which by 2 characters. 2-character sequences where the first is a caret (^) can be produced by ctrl + the second character, and correspond to the second character in ASCII minus 64. Hence ^A is byte 0x01. The escape key sends ASCII ESC, number 27, and is written ^[ .
https://en.wikipedia.org/wiki/ANSI_escape_code
Software distinguishes between a bare Escape key press and an ANSI escape sequence by waiting a couple of milliseconds and seeing if more bytes arrive. The number of milliseconds is often configurable, with e.g. the 'escape-time' config key in tmux and the 'ttimeoutlen' setting in vim.
But for whatever reason, I'd rather vimdiff when I have to resolve conflicts on rebase.
What I really hate about VSCode currently is how huge pylance is though, and how it's all up in my grill when I am trying to manually code.