How to get sytax highlighting in nano for .gmi files


Nano is my editor of choice, I never weighed into the religious wars of Vim and Emacs. It does exactly what I want and need and I've used it for a couple of decades, so muscle memory would be hard to change now.


To get syntax hightlighting working in Nano, you only need to make a couple of changes.




Making the changes



Now to populate the gemini.nanorc in the file we just referenced



## syntax highlighting for gemini:// markup language

syntax gemini "\.(gemini|gmi)$"

# Heading levels
color brightgreen "^#.*"
color brightcyan "^##.*"
color brightmagenta "^###.*"

# Link Text
color brightred "^=>\s*\S+\s+.*"
# Link URL
color green "^=>\s*\S+"
# Link Prefix
color yellow "^=>"

# Bullet Lists
color brightblue "^\*.*"

# Monospaced Blocks
color white,black start="^```" end="^```"


Save with ctrl + o


Adding some colour


Now you can create and edit .gmi files on your local or remote system using nano; with syntax highlighting. Customize it to your liking in /usr/share/nano/gemini.nanorc if you prefer.


It's not a massive change but a very useful one for me and hopefully this gemlog will help someone else out there.


Screenshots


screenshot 01


screenshot 02


screenshot 03


Home



/gemlog/