Photo by Michelle Ding on Unsplash
Thanks to Omakub I got introduced to Zellij:
Zellij is a terminal workspace. It has the base functionality of a terminal multiplexer (similar to
tmux
or `screen) but includes many built-in features that would allow users to extend it and create their own personalized environment.
This is how a Zellij window could look like, showing the output from /var/log/syslog
Now we want to copy this part (in the last line of the output) using the keyboard only:
2024-09-28T06:56:13.403642+02:00 aetron kernel: [UFW BLOCK] IN=enp14s0
First press CTRL
+SHIFT
+SPACE
to enable the vim mode in Zellij.
Then navigate to the first char you want to copy using the cursor key:
Now press v
to enable vim Visual Mode (nothing will change visually).
Now move the cursor to the right until the char you want to be copied last.
Finally, press y
and this will yank you selection and it will be available in your clipboard for further usage.
Great, but there's one issue: multiline selection:
As you can see, the green border is included in the selection and this will mess up you copied content.
But there's a solution for that:
Press CTRL
+p
, then z
to disable the border before you're entering vim Mode:
Now you can copy multiple lines without including the border.
If you want to get the border back, press CTRL
+p
, then z
again.
Instead of using Visual Mode, you can also enable Visual Line Mode by hitting V
instead of v
and that will allow you to just select full lines by moving the cursor up and down.