SciTE show all files in open file dialog

SciTE is a popular cross-platform programmer’s editor. It’s based off of Scintilla.

I edit way more than just source files. Usually I just edit .txt files. If I’m in the Cinnamon desktop environment and not just the terminal, I’ll open up SciTE. However, by default it shows just source files, and I always have to switch it to show all files.

Here’s how to do that.

Get SciTE to show all files in the open file dialog on Linux

Edit the file SciTEGlobal.properties, probably /usr/share/scite/SciTEGlobal.properties

if PLAT_GTK
	all.files=All Files (*)|*|Hidden Files (.*)|.*|
	top.filters=$(all.files)$(source.all.filter)

You can see that you can modify the defaults for other platforms as well. Voila!

Advertisements

Replace config file entry or append if not found

Suppose you need to replace whatever current setting for a particular application to a specific setting. It doesn’t matter what it was before, or if it was absent. You want to define it.

Suppose you want to replace the session pam_mkhomedir setting in /etc/pam.d/common-session to be required. If it was optional, replace it. If it wasn’t listed at all, add it. This line updates an answer on stackoverflow.

sed -i -e '\|session.*pam_mkhomedir.so|h; ${x;s/mkhomedir//;{g;tF};a\' -e 'session\trequired\tpam_mkhomedir.so umask=0022' -e '};:F;s/.*mkhomedir.*/session\trequired\tpam_mkhomedir.so umask=0022/g;' /etc/pam.d/common-session

The -i makes the change inline directly in the file. I write deployment scripts so I don’t care about displaying the output; I want to change the original.

Basically the command looks like this:

sed -e '\|variable.*(possible|values|go|hereornot)|h; ${x;s/variable//;{g;tF};a\' -e 'variable updatedvalue1 updatedvalue2' -e '};:F;s/.*variable.*/variable thisvalueadded1/g;' /etc/inputfile

Questions? I would be happy to explain this if you want a guided tour.

References

http://stackoverflow.com/a/3560072/3569534