Here is How to Update OS X Nano and Enable OS X Nano Syntax Highlighting For Various Languages. Needed dot Files to Match With iTerm2 Has Been Supplied. Apple uses old version of Nano! Yes, it is 2.0 or something like that on OS X Yosemite – the funky OS update from Apple. Yosemite has targeted the mass, who will update Nano? An Operating System’s Text Editor does not get updated. We are using the Standard iTerm2-Homebrew-OhMyZSH setup. If you are thinking that, running brew upgrade nano
will work, you are wrong!
Update OS X Nano For Syntax Highlighting
If you are using our way of iTerm2-Homebrew-OhMyZSH, you need not to care about anything much. Your profile file is .zshrc
. Do not try to find .profile file unless you have created it before. Do not use homebrew dupe
. First check your Nano’s condition by running this command :
nano -V
---
Version 2.0 or something, right? That will not take syntax highlighting. That is the basic reason to update OS X Nano for syntax highlighting. Vi
is definitely powerful, but so much POWER, rarely required today unless you are developing software from command line. This is Nano’s Official Website :
http://nano-editor.org/download.php
At the time of writing this guide, latest Nano’s version is 2.2.6. Open Terminal not iTerm2. Run these commands :
1 2 3 4 5 6 7 | cd Downloads wget http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz tar -xzvf nano* && rm nano-2.2.6.tar.gz cd nano-2.2.6 && ls -al ./configure sudo make sudo make install |
Now, if you run which nano
command, it should return this path – /usr/local/bin/nano
. It will. Now close Terminal and open our nice looking iTerm2. Run nano -V
and get this return :
1 2 3 4 5 | GNU nano version 2.2.6 (compiled 06:51:24, Jan 20 2015) (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Email: nano@nano-editor.orgWeb: http://www.nano-editor.org/ Compiled options: --disable-nls --enable-color --enable-extra --enable-multibuffer --enable-nanorc |
So, your System’s Nano is at latest version. Homebrew needed? No. Open your .zshrc
at ~ location (that is your $HOME) :
1 | cd $HOME && nano .zshrc |
You will see that, this thing -> export PATH=/usr/local/bin:$PATH
is already present there. If not, add it and run :
1 | source .zshrc |
OS X Nano Syntax Highlighting
We will create a new file named .nanorc
at sweet $HOME :
1 | nano ~/.nanorc |
Copy paste this thing and hit ^ + O to write out and exit with ^ + X
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | include "/usr/local/share/nano/nanorc.nanorc" # Alphabetically include "/usr/local/share/nano/awk.nanorc" include "/usr/local/share/nano/asm.nanorc" include "/usr/local/share/nano/c.nanorc" include "/usr/local/share/nano/css.nanorc" include "/usr/local/share/nano/cmake.nanorc" include "/usr/local/share/nano/debian.nanorc" include "/usr/local/share/nano/fortran.nanorc" include "/usr/local/share/nano/gentoo.nanorc" include "/usr/local/share/nano/groff.nanorc" include "/usr/local/share/nano/html.nanorc" include "/usr/local/share/nano/java.nanorc" include "/usr/local/share/nano/man.nanorc" include "/usr/local/share/nano/mutt.nanorc" include "/usr/local/share/nano/makefile.nanorc" include "/usr/local/share/nano/ocaml.nanorc" include "/usr/local/share/nano/objc.nanorc" include "/usr/local/share/nano/patch.nanorc" include "/usr/local/share/nano/perl.nanorc" include "/usr/local/share/nano/python.nanorc" include "/usr/local/share/nano/php.nanorc" include "/usr/local/share/nano/pov.nanorc" include "/usr/local/share/nano/ruby.nanorc" include "/usr/local/share/nano/sh.nanorc" include "/usr/local/share/nano/tcl.nanorc" include "/usr/local/share/nano/tex.nanorc" include "/usr/local/share/nano/xml.nanorc" |
OK, we only included, what were provided :
1 | cd /usr/local/share/nano |
Let us see, how our Nano is working with syntax highlighting :
1 | nano ruby.nanorc |
Getting some color? Good. Where is coffescript? This is the way to create :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # do not blindly copy cd /usr/local/share/nano/ nano coffeescript.nanorc # not tested ! syntax "coffeescript" "\.coffee$" header "^#!.*/(env +)?coffee" color red "[!&|=/*+-<>]|\<(and|or|is|isnt|not)\>" color brightblue "[A-Za-z_][A-Za-z0-9_]*:[[:space:]]*(->|\()" "->" color black "[()]" color cyan "\<(for|of|continue|break|isnt|null|unless|this|else|if|return)\>" color cyan "\<(try|catch|finally|throw|new|delete|typeof|in|instanceof)\>" color cyan "\<(debugger|switch|while|do|class|extends|super)\>" color cyan "\<(undefined|then|unless|until|loop|of|by|when)\>" color brightcyan "\<(true|false|yes|no|on|off)\>" color brightyellow "@[A-Za-z0-9_]*" color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'" color brightblack "(^|[[:space:]])#([^{].*)?$" color ,green "[[:space:]]+$" color ,red "+" |
You have to add this line within alphabetically C stuffs :
1 2 3 | cd $HOME && nano ~/.nanorc # add this line include "/usr/local/share/nano/coffeescript.nanorc" |
There are lot of such nanorc files in my GitHub repo.
Tagged With nano syntax highlighting os x , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1821 DRpg8sp6YSsGbNOMc1P-rNvpi6xHhkmvq03KPSg4D_Q3NOClebB6y2T4B2GzObRc 1ec3ea8f1e94e14e346ea3aedf576f6bff8f1157&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , osx update nano , osx nano syntax color , nano editor os-x , nano color syntax mac , nano color on mac , MAC OS Nano , install color nano macos , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1828 JuuNcFsfsA6rvrstLpgwR2z6im9igCBVovdVZBGxSs_8sQnu56PhEdZ7Y8VKiK_5 42a96ad0c4fc22e086d03a56ec4fcaf71f6e93d9&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme