This shows you the differences between two versions of the page.
ii:labs:01:tasks:03 [2024/10/18 10:41] radu.mantu |
ii:labs:01:tasks:03 [2024/10/18 12:35] (current) radu.mantu [03. [20p] Quality-of-life improvements] |
||
---|---|---|---|
Line 52: | Line 52: | ||
* ''LESS_TERMCAP_*'': these are variables used (indirectly) by **man** to format its output. The authors of these pages decide how and when to use them. We decide what they are. By defining these variables before running a bash command, we set them only in the environment of the started process and will disappear when said process terminates. | * ''LESS_TERMCAP_*'': these are variables used (indirectly) by **man** to format its output. The authors of these pages decide how and when to use them. We decide what they are. By defining these variables before running a bash command, we set them only in the environment of the started process and will disappear when said process terminates. | ||
* ''command man "$@"'': here, **command** tells **bash** / **zsh** to use the //original// man command, not the function we just defined. If you're wandering why this is necessary, think back to the whole ''tmux'' and ''zsh'' fiasco described earlier. The ''"$@"'' here is substituted with all the arguments that the //**man** bash function// received and passes them on to the //**man** command//. | * ''command man "$@"'': here, **command** tells **bash** / **zsh** to use the //original// man command, not the function we just defined. If you're wandering why this is necessary, think back to the whole ''tmux'' and ''zsh'' fiasco described earlier. The ''"$@"'' here is substituted with all the arguments that the //**man** bash function// received and passes them on to the //**man** command//. | ||
+ | |||
+ | **//Alternatively//** you can change the [[https://unix.stackexchange.com/questions/144016/what-is-a-pager|pager]] used by **man** from **less** to **[n]vim**. This means that every time you bring up the manual page for something, it will be opened in your favorite text editor. | ||
+ | |||
+ | First of all, let's install **nvim**. This is a //fork// of **vim** created due to Bram Moolenaar (the author of **vim**) rejecting a large number of improvements proposed by the community. | ||
+ | |||
+ | <code bash> | ||
+ | $ sudo apt install neovim | ||
+ | </code> | ||
+ | |||
+ | To change **man**'s pager from **less** to **nvim**, add the following line to your ''.zshrc'' and source it. | ||
+ | |||
+ | <code> | ||
+ | export MANPAGER='nvim +Man!' | ||
+ | </code> | ||
+ | |||
+ | Now, try opening a manual page: | ||
+ | |||
+ | <code bash> | ||
+ | $ man 2 open | ||
+ | </code> | ||
=== [10p] Task B - Color iproute2 output === | === [10p] Task B - Color iproute2 output === |