Skip to content

Instantly share code, notes, and snippets.

@rzbrk
Created January 18, 2014 11:28
Show Gist options
  • Select an option

  • Save rzbrk/8489175 to your computer and use it in GitHub Desktop.

Select an option

Save rzbrk/8489175 to your computer and use it in GitHub Desktop.
My current ~/.nanorc as a Perl programmer. Inspired by https://github.com/alekstorm/nanorc/blob/master/main.nanorc
## Global Settings
##
set tabstospaces # Tab key inserts spaces (Ctrl+t for verbatim mode)
set tabsize 4 # Insert 4 spaces per tab
set fill 76 # Justify command (Ctrl+j) wraps at 76 columns
set autoindent # Jump to current indent level after inserting a newline
set morespace # Use the second row (usually blank) for editing space
set quickblank # Clear status messages after a single keystroke
set multibuffer # Allow opening multiple files (Alt+< and Alt+> to switch)
set historylog # Remember command history
set undo # Enable undo/redo features
set smooth # Scroll one line at a time
set const # Show cursor position at the bottom of the screen
#set nohelp # Remove help bar from the bottom of the screen
set regexp # Enable regexp mode for find (Ctrl+r to disable)
## Annoyances
##
unbind ^C all
#unbind ^G all
unbind M-A all # Catched by most terminal windows, redefined later
## File
##
bind ^O insert main
bind ^N insert main
bind ^S writeout main
bind ^W cancel all
bind ^Q cancel all
bind ^W exit main
bind ^Q exit main
## Edit
##
bind ^A mark main # See above: unbind M-A all
bind ^C copytext main
bind ^X cut main
bind ^V uncut main
bind ^Z undo main
bind ^Y redo main
bind ^T verbatim main
bind F5 refresh all
bind F8 autoindent main
bind F12 autoindent main
## Search/Replace
##
bind ^F whereis all
bind ^H replace all
bind ^I casesens search
bind ^I casesens replace
bind ^R regex search
bind ^R regex replace
bind ^L gotoline main
bind F3 searchagain main
bind ^] findbracket main
## Syntax highlighting for Perl.
##
syntax "perl" "\.p[lm]$"
magic "perl.*script text"
header "^#!.*/perl[-0-9._]*"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
color yellow "".*"|qq\|.*\|"
color white "[sm]/.*/"
color white start="(^use| = new)" end=";"
color green "#.*"
color yellow start="<< 'STOP'" end="STOP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment