-
-
Save koraktor/525257 to your computer and use it in GitHub Desktop.
# This code is free software; you can redistribute it and/or modify it under | |
# the terms of the new BSD License. | |
# | |
# Copyright (c) 2010, Sebastian Staudt | |
# A nano configuration file to enable syntax highlighting of some Git specific | |
# files with the GNU nano text editor (http://www.nano-editor.org) | |
# | |
# Save this file to a directory of your choice and add it to your nanorc using | |
# include ${PATH_TO_THE_FILE}/git.nanorc | |
# This syntax format is used for editing commit and tag messages | |
syntax "git commit/tag messages" "COMMIT_EDITMSG|TAG_EDITMSG" | |
# Commit message | |
color white ".*" | |
# Subject line (This is pretty weird, but it works at least for OS X' nano 2.0.6) | |
color brightcyan start="^" end="$" | |
# Comments | |
color brightblack "^#.*" | |
# Files changes | |
color white "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*" | |
color red "#[[:space:]]deleted:" | |
color green "#[[:space:]]modified:" | |
color brightgreen "#[[:space:]]new file:" | |
color brightblue "#[[:space:]]renamed:" | |
# Recolor hash symbols | |
color brightblack "#" | |
# Trailing spaces | |
color ,red "[[:space:]]+$" | |
# This syntax format is used for interactive rebasing | |
syntax "git rebase todo" "git-rebase-todo" | |
# Default | |
color white ".*" | |
# Comments | |
color brightblack "^#.*" | |
# Commit IDs | |
color brightwhite "[0-9a-f]{7,40}" | |
# Rebase commands | |
color green "^(e|edit) [0-9a-f]{7,40}" | |
color green "^# (e, edit)" | |
color brightgreen "^(f|fixup) [0-9a-f]{7,40}" | |
color brightgreen "^# (f, fixup)" | |
color brightwhite "^(p|pick) [0-9a-f]{7,40}" | |
color brightwhite "^# (p, pick)" | |
color blue "^(r|reword) [0-9a-f]{7,40}" | |
color blue "^# (r, reword)" | |
color brightred "^(s|squash) [0-9a-f]{7,40}" | |
color brightred "^# (s, squash)" | |
color yellow "^(x|exec) [^ ]+ [0-9a-f]{7,40}" | |
color yellow "^# (x <cmd>, exec <cmd>)" | |
# Recolor hash symbols | |
color brightblack "#" |
I was almost sure, this would cause problems somewhere. :)
What version of nano are you using? Maybe there's a way to work around this.
It's nano 2.2.2 on Ubuntu 10.04 LTS (64 bit).
@ruphert You should probably comment line #19, this is a weird way that seems to work in nano 2.0.x, but other versions don't support it.
@koraktor I have successfully been using your git.nanorc file for syntax highlighting with Ubuntu 12.10 and I very much appreciate your work. However, when I upgraded to Ubuntu 13.04 the syntax highlighting stopped working, i.e all text is rendered in a dark grey color. If I remove the include of git.nanorc from my ~/.nanorc file all text is rendered in white, so it seems like nano is still able to detect the include of git.nanorc.
Do you have any idea what the problem might be?
@koraktor I am sorry for bothering you. Apparently the Ubuntu upgrade included localization of Git's messages into the language I have set for the desktop, which is Swedish. I have created a version of git.nanorc updated for Swedish and plan to upload it to GitHub shortly.
Hi, simply changing line to :
color brightcyan start="^." end=".$"
worked for me with nano 2.2.6
Hello.
Thanks for the rc. I tried it on Linux. I am afraid it doesn't work. The problem is with:
color brightcyan start="^" end="$"
Getting rid of this line solves the problem. Weird expression indeed.
Otherwise works like a charm.