Ever seen mention of sudoedit? Ever wanted to use pacdiff with something other than
vim -d ?
We can use Environment Variables
First lets understand how they work, the ways we can define them, and what the differences are.
The ArchWiki goes into detail here:
Variables can be defined for each command we run. In the
sudoedit example that means we can manually tell it to use our choice of editor by doing something like this:
SUDO_EDITOR=nano sudoedit /path/to/file
But what about setting a default for when we just type
We can use certain locations to define variables globally for the whole system or per-user.
But each location works a little differently, and you may have reason to use one over the other. Refer to the wiki article to make an informed decision, but due to limitations of other files I will be using
/etc/environment sets these variables globally and accepts “KEY=VAL” entries. One on each line.
So, in the example of
sudoedit it would look like this:
There are also a few other related variables. And many more for a whole range of options.
I will leave here an example of my
GDK_SCALE=1.25 DIFFPROG=/usr/bin/meld EDITOR=/usr/bin/micro VISUAL=/usr/bin/micro SUDO_EDITOR=/usr/bin/micro
These variables are my defaults now, and will be used anywhere applicable. As examples, whenever I want to use
sudo -e or
micro will automatically be used,
pacdiff will use
meld by default, and I’m setting the GTK items on my KDE desktop to scale 1.25x .