10 Mart 2009

Konsolda bash scriptlerini düzenlerken renkleri kullanmak

Konsolda editör olarak nano kullanıyorum. Bash scripler ile boğuşurken komutların, açıklama satırlarının, değişkenlerin, vs. farklı renklerde olması için /etc/nanorc dosyasına şu satırları ekliyorum:

syntax "c-file" ".*\.c$" ".*\.h$"
color red "\<[A-Z_]{2,}\>"
color green "\" "\" "\" "\"
color green "\" "\" "\"
color brightyellow "\" "\" "\" "\" "\" "\"
color brightcyan "#define" "#include" "#ifn*def" "#endif"
color brightcyan "#elif" "#else" "#if"

syntax "sh" ".*\.sh$"
color red "\<[A-Z_]{2,}\>"
color green "\" "\" "\" "\"
color green "\" "\" "\"
color brightyellow "\" "\" "\" "\" "\" "\"
color brightcyan "#define" "#include" "#ifn*def" "#endif"
color brightcyan "#elif" "#else" "#if"
color white "^#.*$"


syntax "nanorc" "[\.]*nanorc$"
color white "^ *(set|unset).*$"
color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speth|speller|suspend|tabsize|tempfile|historylog|view)"
color brightwhite "^ *syntax [^ ]*"
color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
color white "^ *color\>.*"
color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
color magenta "^ *color\>"
color green "^#.*$"

Hiç yorum yok: