Hacker News new | ask | show | jobs
by qazxcvbnm 490 days ago
This is very powerful. Unfortunately, as an Ex command, `!` only works on full lines. One can of course also teach vim to operate `!` over any motion (or visual selection), whether it is part of a line, a full line, or a block https://vi.stackexchange.com/a/46304/48750.
2 comments

I also have a plugin that has commands for this https://github.com/robenkleene/partshell.vim?tab=readme-ov-f...

There's `Psh` that pipes part of a line through a shell command, and `P` which takes any `ex` command and does the same (this means `P !` is the same as `Psh` but the latter supports tab completion for shell commands).

It always infuriates me how well nano handles this out of the box as opposed to vim. I don't see any reason why this shouldn't be the default. If you're in visual mode and want the whole-line behavior, it takes just 1 extra key press (V).