How can I include a variable in my nanorc

23 views Asked by At

How can I get a custom enviornment variable in my .nanorc file. I need it for syntax highlighting. I want $XDG_CONFIG_HOME/.config/nano/*.nanorc to be my nanorc files. Sometimes I use different nanorc's in from different config directories for changing the syntax.I just want to change one variable, not my nanorc file.

1

There are 1 answers

0
deftclaw On

Use vim ?

In all seriousness though, I cannot find any reference to 'variable' or 'environment' in the nano manpages.

As a workaround you could copy your nanorc to $XDG_CONFIG_HOME/.config/nano/nanorc1 and change the appropriate line in the secondary file.

add something like:

export nano1=$XDG_CONFIG_HOME/.config/nano/nanorc1
alias nano1='nano --rcfile $nano1'

to your ~/.bashrc This change will load automatically on new shell (terminal) opening but the first time you may need to . ~/.bashrc

then for the primary configuration just start nano with nano and for alternate configuration use nano1

This configuration would also allow you to alter anything else in the secondary config and have it only affect the other-syntax-styled configuration.

Maybe you have syntax highlight config for python and another for ruby so you want the header-bar to be green in the python config and red in the ruby config as an additional visual indicator of which syntax configuration you launched a particular instance of nano with