• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » OS X Nano Syntax Highlighting

By Abhishek Ghosh January 20, 2015 2:57 am Updated on January 20, 2015

OS X Nano Syntax Highlighting

Advertisement

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

Advertisement

---

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 :

Vim
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 :

Vim
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) :

Vim
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 :

Vim
1
source .zshrc

OS X Nano Syntax Highlighting

 

OS X Nano Syntax Highlighting

 

We will create a new file named .nanorc at sweet $HOME :

Vim
1
nano ~/.nanorc

Copy paste this thing and hit ^ + O to write out and exit with ^ + X

Vim
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 :

Vim
1
cd /usr/local/share/nano

Let us see, how our Nano is working with syntax highlighting :

Vim
1
nano ruby.nanorc

Getting some color? Good. Where is coffescript? This is the way to create :

Vim
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 :

Vim
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
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to OS X Nano Syntax Highlighting

  • Nginx Config Syntax Highlighting in Nano (Ubuntu)

    Normally, People Will Use SSH to Edit the Nginx Configuration Files. Here is How to Get Nginx Config Syntax Highlighting in Nano on Ubuntu.

  • Change Github’s Default Gist Style With jQuery Plugins

    Yes, There Are jQuery Plugins to Change Github’s Default Gist Style With jQuery Plugins! They can do lot of works than simple changing look.

  • Nano Syntax Highlighting : nanorc

    Nano Syntax Highlighting Can Be Forced With nanorc Files on All Linux Distro Like Ubuntu, CentOS, REHL, Arch Linux As Well As on OS X & BSD.

  • .nanorc File For OS X iTerm2 .zshrc

    Here is a .nanorc File For OS X iTerm2 .zshrc For Better Readability of the Key Phrases and Comments For Who Use Nano for Editing .zshrc.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy