<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BobDotCom</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BobDotCom"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/BobDotCom"/>
	<updated>2026-05-13T22:56:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Syntax_highlighting_for_Nasal&amp;diff=137688</id>
		<title>Howto:Syntax highlighting for Nasal</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Syntax_highlighting_for_Nasal&amp;diff=137688"/>
		<updated>2023-05-15T15:03:07Z</updated>

		<summary type="html">&lt;p&gt;BobDotCom: Added TextMate / IntelliJ (JetBrains) syntax highlighting sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There's '''[[Nasal]] syntax-highlighting''' support available for some editors, which is a big advantage, as it makes Nasal coding much easier.&lt;br /&gt;
&lt;br /&gt;
Syntax highlighting can often point to syntax errors and so reduce the number of tedious time-consuming and unproductive [[FlightGear]] runs. It can also be a sort of &amp;quot;guide&amp;quot; to the language, highlighting functions or keywords that are builtin, so you can quickly check if it is &amp;quot;type&amp;quot; or &amp;quot;typeof&amp;quot; by typing each. In addition makes understanding other people's code easier, since you have all of the parts visually separated out, like loops, strings, constants, and builtin functions.&lt;br /&gt;
&lt;br /&gt;
== Atom ==&lt;br /&gt;
Script is available from [https://github.com/www2000/atom-language-nasal Github] and can also be found in the [https://atom.io/packages/language-nasal Atom's packages repository].&lt;br /&gt;
&lt;br /&gt;
Manual installation:&lt;br /&gt;
&lt;br /&gt;
# Download the latest release from https://github.com/www2000/atom-language-nasal&lt;br /&gt;
# Unpack the tar.bz2&lt;br /&gt;
# Copy/move the language-nasal package to ~/.atom/packages&lt;br /&gt;
&lt;br /&gt;
For installation from atom's packages repository:&lt;br /&gt;
&lt;br /&gt;
# Open Atom&lt;br /&gt;
# Go to Preferences Edit -&amp;gt; Preferences or {{key press|Ctrl|+}},&lt;br /&gt;
# Click on packages and search for nasal&lt;br /&gt;
# Click install for Language Nasal&lt;br /&gt;
&lt;br /&gt;
== Emacs ==&lt;br /&gt;
[[File:Emacs-nasal-syntax-highlighting.png|400px|thumb|Nasal syntax highlighting in GNU Emacs]]&lt;br /&gt;
&lt;br /&gt;
There is an Emacs major mode for Nasal available in SimGear, that is based on Andy Ross' [https://github.com/andyross/nasal/blob/master/misc/nasal-mode.el original version]. In order to use it, you can copy the {{simgear source&lt;br /&gt;
| path = simgear/nasal/misc/nasal-mode.el&lt;br /&gt;
| text = nasal-mode.el&lt;br /&gt;
}} file where you have the rest of your manually installed packages and add the following line to your [https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html Emacs initialization file]:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(require 'nasal-mode)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't already have a directory to place your manually installed packages, put the file for instance in ''~/.emacs.d/manual-installs/'' (first create this directory if necessary) and insert the following in your Emacs initialization file before the above ''require'' line:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;;; Tell Emacs it can load ELisp files from there&lt;br /&gt;
(add-to-list 'load-path &amp;quot;~/.emacs.d/manual-installs&amp;quot;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once this is done, restart Emacs, check that no error is reported and open a .nas file.&lt;br /&gt;
&lt;br /&gt;
Optional step: in order to speed up loading of nasal-mode.el, you can open it and choose ''Byte-compile this file'' from the ''Emacs-Lisp'' menu (or equivalently, run M-x byte-compile-file).&lt;br /&gt;
&lt;br /&gt;
{{Tip|In case you have a clone of the {{simgear source&lt;br /&gt;
| text = SimGear repository&lt;br /&gt;
}} on your hard drive, you may create a symbolic link from ~/.emacs.d/manual-installs/nasal-mode.el to the file inside that repository; this way, you'll get automatic updates of nasal-mode.el when your SimGear repository is updated (Emacs will ignore the .elc file resulting from byte compilation if the corresponding .el file is more recent).}}&lt;br /&gt;
&lt;br /&gt;
The '''true''' and '''false''' keywords introduced in January 2023 are already supported.&amp;lt;ref&amp;gt;https://forum.flightgear.org/viewtopic.php?f=30&amp;amp;t=41115&amp;amp;p=409029#p409029&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Geany ==&lt;br /&gt;
&lt;br /&gt;
A syntax highlighting solution for [https://www.geany.org/ Geany], a lean text editor/IDE is available from [https://forum.flightgear.org/viewtopic.php?f=30&amp;amp;t=36838#p360677 this thread] in the FlightGear forum.&lt;br /&gt;
&lt;br /&gt;
== gedit ==&lt;br /&gt;
[[File:Philosopher's nasal highlighting in gEdit.jpeg|400px|thumb|Screen shot illustrating syntax highlighting in gedit]]&lt;br /&gt;
&lt;br /&gt;
'''Philosopher''' on the FlightGear Forum has created syntax highlighting for gedit, a popular and simple text editor for Mac OS X, Linux, and Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--http://theomegahangar.flymerlion.com/downloads/nasal.lang --&amp;gt;&lt;br /&gt;
To install, copy the ''nasal.lang'' file &amp;lt;!--from the link above or--&amp;gt; from the first post of the forum topic {{forum link|p=164133}} and:&lt;br /&gt;
&lt;br /&gt;
* If you use Mac, move it into your ''Applications/gedit/Contents/Resources/share/gtksourceview-X.0/language specs'' folder.&lt;br /&gt;
* For Linux, move it into your ''/usr/share/gtksourceview-X.0/language-specs'' folder.&lt;br /&gt;
&lt;br /&gt;
In the same post given above, there are instructions for how to edit ''xml.lang'' (in the same directory) to add the embedded XML content support (with this minor edit, Nasal highlighting will be used inside of certain tags, instead of plain text).&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;snippets&amp;quot; support, nasal.xml from the above post has to be moved into ''/usr/share/gedit/plugins/snippets/'' folder or installed using the &amp;quot;import&amp;quot; feature. See this image for more details: &lt;br /&gt;
&lt;br /&gt;
[[:File:Install nasal snippets in gedit.png|how to import Nasal snippets]].&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== jEdit ==&lt;br /&gt;
There's a syntax highlighting mode for jEdit, programmer's text editor&lt;br /&gt;
&lt;br /&gt;
Included are some of Nasal's internal functions and those functions currently implemented in NasalSys.cxx&lt;br /&gt;
To use, add the content of the catalog inside your own catalog (do NOT overwrite the file) and nasal.xml in /home/USER/.jedit/modes&lt;br /&gt;
&lt;br /&gt;
Restart jEdit and you can use it. Current extension is .nas, you can add your own extension and functions.&lt;br /&gt;
This mode is heavily based on the Javascript mode.&lt;br /&gt;
&lt;br /&gt;
Get it here: https://sourceforge.net/projects/fgscheduleview/files/jedit/catalog.zip/download&lt;br /&gt;
&lt;br /&gt;
== KDE Editors ==&lt;br /&gt;
There's a highlighting definition for nasal available at '''opendesktop.org''' (https://www.opendesktop.org/p/1187022/)&lt;br /&gt;
&lt;br /&gt;
Download the file and copy it into:&lt;br /&gt;
:~/.kde4/share/apps/katepart/syntax/ (for KDE4)&lt;br /&gt;
:or&lt;br /&gt;
:~/.local/share/katepart5/syntax/ (for KF5 pre 5.29) &lt;br /&gt;
:or &lt;br /&gt;
:~/.local/share/org.kde.syntax-highlighting/syntax/ (for current KF5 versions)&lt;br /&gt;
&lt;br /&gt;
(you can create the folders if they don't exist yet).&lt;br /&gt;
&lt;br /&gt;
Note that the syntax highlighting in KDE doesn't set colors, it just identifies structural elements, colors are defined by the '''schemas''' used by each editor, thus you get consistent highlighting between different languages.&lt;br /&gt;
&lt;br /&gt;
The highlighting file should work with all editors based on the katepart: KWrite, Kate, and the editor component of KDevelop.&lt;br /&gt;
&lt;br /&gt;
== Notepad++ ==&lt;br /&gt;
[[File:Highlight parse.png|400px|thumb|Screenshot of Nasal support for Notepad++]]&lt;br /&gt;
Provides comprehensive syntax highlighting and a function list parser with support for hierarchical display of both inline and out-of-body class member functions.&lt;br /&gt;
* [http://github.com/Slaiyer/nasal-npp GitHub repository for download and instructions]&lt;br /&gt;
&lt;br /&gt;
'''Alternative (syntax highlighting only):'''&lt;br /&gt;
* [http://dl.dropbox.com/u/1463693/nasal.xml Download here]&lt;br /&gt;
** [http://superuser.com/questions/62474/notepad-custom-syntax-highlighting-setting-where-to-look-for-it Instructions are here]&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== Sublime Text 2 ==&lt;br /&gt;
[[File:Sublime Text 2 syntax highlighting.png|400px|thumb|Sublime Text 2 syntax highlighting]]&lt;br /&gt;
&lt;br /&gt;
Scripts and installation instructions are here: https://github.com/freevryheid/nasal&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== Vim ==&lt;br /&gt;
[[File:Vim-nasal-syntax-highlighting.png|400px|thumb|Screen shot illustrating syntax highlighting in Vim]]&lt;br /&gt;
&lt;br /&gt;
One such editor is the free vim or its GUI variant gvim. &lt;br /&gt;
&lt;br /&gt;
It's not for everyone but it's free, and testing it doesn't hurt: http://www.vim.org/. &lt;br /&gt;
&lt;br /&gt;
The syntax definition file comes with the FlightGear code ({{flightgear file|scripts/syntax/nasal.vim}}). Highlighting works even for Nasal embedded in XML files (type &amp;quot;:set ft=nasal&amp;quot;, where ft stands for file-type)&lt;br /&gt;
&lt;br /&gt;
Here's an example, which demonstrates a short code segment with three syntax errors as well as the highlighting of a matching pair of parentheses (yellow) and trailing spaces (blue x). (The leading blue dots aren't on by default. They help to spot tab crimes.)&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== Visual Studio Code ==&lt;br /&gt;
[[File:Vscode-sintaxhighlight.jpg|thumb|Screen shot illustrating syntax highlighting in VSCode]]&lt;br /&gt;
&lt;br /&gt;
[https://code.visualstudio.com Visual Studio Code] is a source-code editor developed by Microsoft for Windows, Linux and macOS. Its open source and free.&lt;br /&gt;
&lt;br /&gt;
The nasal extension is available from [https://github.com/RenanMsV/nasal-vscode Github] and can also be found in the [https://marketplace.visualstudio.com/items?itemName=Renan-MsV.nasal-lang VSCode's marketplace].&lt;br /&gt;
It supports basic syntax highlighting and snippets to improve development speed.&lt;br /&gt;
&lt;br /&gt;
For installation from the marketplace:&lt;br /&gt;
&lt;br /&gt;
# Open VSCode&lt;br /&gt;
# Go to File -&amp;gt; Preferences -&amp;gt; Extensions or {{key press|Ctrl|Shift|X}},&lt;br /&gt;
# Search for nasal&lt;br /&gt;
# Click install for Nasal Language (FlightGear)&lt;br /&gt;
&lt;br /&gt;
Manual installation:&lt;br /&gt;
&lt;br /&gt;
# Download the latest release from the repository, it should be a .vsix file.&lt;br /&gt;
# Install the extension manually by doing the command 'code --install-extension path_to_extension.vsix'&lt;br /&gt;
&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== TextMate==&lt;br /&gt;
[[File:Nasal syntax highlighting in TextMate.png|thumb|Screen shot illustrating syntax highlighting in TextMate]]&lt;br /&gt;
[https://macromates.com/ TextMate] is a general-purpose GUI text editor for macOS created by Allan Odgaard. It is open source and free to use.&lt;br /&gt;
&lt;br /&gt;
There is a TextMate Bundle for Nasal available on [https://github.com/BobDotCom/Nasal.tmbundle GitHub] which can be [https://macromates.com/manual/en/bundles#installing_a_bundle installed in TextMate] for basic syntax highlighting.&lt;br /&gt;
&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
==IntelliJ Family Editors (JetBrains)==&lt;br /&gt;
[[File:Nasal syntax highlighting in PyCharm.png|thumb|Screenshot illustrating syntax highlighting in PyCharm]]&lt;br /&gt;
[https://www.jetbrains.com/idea/ IntelliJ IDEA] is an integrated development environment written in Java for developing computer software written in Java, Kotlin, Groovy, and other JVM-based languages. It is developed by JetBrains and is available as an Apache 2 Licensed community edition, and in a proprietary commercial edition.&lt;br /&gt;
&lt;br /&gt;
Although there is not a native IntelliJ plugin for Nasal, IntelliJ supports [https://www.jetbrains.com/help/idea/textmate-bundles.html installing TextMate bundles] for syntax highlighting, so the [https://github.com/BobDotCom/Nasal.tmbundle Nasal TextMate Bundle] can be used. Installation instructions are available [https://www.jetbrains.com/help/webstorm/tutorial-using-textmate-bundles.html here].&lt;br /&gt;
&lt;br /&gt;
There are many [https://www.jetbrains.com/products/ JetBrains products] that are based on IntelliJ such as [https://www.jetbrains.com/pycharm/ PyCharm] (Python) and [https://www.jetbrains.com/webstorm/ WebStorm] (Javascript). These IDEs can also be used with nasal syntax highlighting, in the same way as above.&lt;br /&gt;
&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
==Other editors==&lt;br /&gt;
Nasal being syntactically very close to other programming languages like C, Php or JavaScript, you can get some usable highlighting even without real Nasal support:&lt;br /&gt;
&lt;br /&gt;
* TextMate {{forum link|hilit=syntax+nasal|p=127828}}&lt;br /&gt;
*SciTe {{forum link|hilit=syntax+nasal|p=94521}}&lt;br /&gt;
&lt;br /&gt;
==FlightGear Wiki==&lt;br /&gt;
{{Note|As of 02/2016, we do not currently have a dedicated Nasal module available [http://wiki.flightgear.org/FlightGear_wiki:Village_pump/Archive_2016#Nasal_Syntaxhighlighting]}}&lt;br /&gt;
{{main article|Help:Formatting#Syntax highlighting}}&lt;br /&gt;
&lt;br /&gt;
Using the &amp;amp;lt;syntaxhighight&amp;amp;gt; tag with a lang=&amp;quot;nasal&amp;quot; attribute, we can have highlighting right here on the wiki. Use enclose=&amp;quot;div&amp;quot; to wrap the text, if it happens to be particularly wide.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;nasal&amp;quot;&amp;gt;&lt;br /&gt;
  # hello.nas&lt;br /&gt;
  print('Hello World!');&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which renders into:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nasal&amp;quot;&amp;gt;&lt;br /&gt;
# hello.nas&lt;br /&gt;
print('Hello World!');&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax highlighting test==&lt;br /&gt;
Just a collection of keywords, etc. to test whether highlighting works (you can copy this to test your own highlighting):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nasal&amp;quot;&amp;gt;&lt;br /&gt;
# this is a comment&lt;br /&gt;
# operators (if applicable):&lt;br /&gt;
!a ? a+b - c/d*e : f~g; expr1 and expr2 or expr3;&lt;br /&gt;
# Builtin functions, strings&lt;br /&gt;
print('Hello World!');&lt;br /&gt;
die(&amp;quot;We have an error, Houston!&amp;quot;, arg[0]);&lt;br /&gt;
cmdarg().getNode(&amp;quot;setting&amp;quot;).getValue();&lt;br /&gt;
streq(typeof(id(keys(hash))),10);&lt;br /&gt;
# Loopoids&lt;br /&gt;
foreach (var a; [&amp;quot;haha&amp;quot;, {command:&amp;quot;NASAL!&amp;quot;}, me]) {&lt;br /&gt;
    if(0) break;&lt;br /&gt;
    elsif(1) continue;&lt;br /&gt;
    else return;&lt;br /&gt;
    while(1) sprintf(&amp;quot;%s%s\n%s=%f&amp;quot;, &amp;quot;Spam&amp;quot;, &amp;quot;spam&amp;quot;, &amp;quot;spam&amp;quot;, 0e-0);&lt;br /&gt;
    for (var i=0; i &amp;lt; 0.00; i += 0x0) printf(&amp;quot;%d&amp;quot;, int(i));&lt;br /&gt;
    forindex(var o; a) (func {&lt;br /&gt;
        var o = o;&lt;br /&gt;
        setlistener(&amp;quot;/&amp;quot;, func print(o), 1, 2);&lt;br /&gt;
    })();&lt;br /&gt;
}&lt;br /&gt;
# String escaping stress tests:&lt;br /&gt;
'\a\b\c\&amp;quot;\\\?' # none of these&lt;br /&gt;
&amp;quot;\e\?\'\f\a&amp;quot; # none of these&lt;br /&gt;
'\'' # this one&lt;br /&gt;
&amp;quot;\&amp;quot;\r\n\t\\\t&amp;quot; # and all of these&lt;br /&gt;
# And optionally string formatting:&lt;br /&gt;
&amp;quot;%s%%s%.0f%8d&amp;quot; # the second &amp;quot;s&amp;quot; shouldn't be highlighted, otherwise everything else&lt;br /&gt;
# Syntax error!:&lt;br /&gt;
%$@&amp;amp;^|\`&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related content==&lt;br /&gt;
*{{forum url|p=164155}}&lt;br /&gt;
*{{forum url|t=12495}}&lt;br /&gt;
*{{forum url|t=15972}}&lt;br /&gt;
*{{forum url|t=9812}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Nasal howto]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>BobDotCom</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:Nasal_syntax_highlighting_in_PyCharm.png&amp;diff=137687</id>
		<title>File:Nasal syntax highlighting in PyCharm.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:Nasal_syntax_highlighting_in_PyCharm.png&amp;diff=137687"/>
		<updated>2023-05-15T14:14:55Z</updated>

		<summary type="html">&lt;p&gt;BobDotCom: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot illustrating syntax highlighting in PyCharm&lt;/div&gt;</summary>
		<author><name>BobDotCom</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:Nasal_syntax_highlighting_in_TextMate.png&amp;diff=137686</id>
		<title>File:Nasal syntax highlighting in TextMate.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:Nasal_syntax_highlighting_in_TextMate.png&amp;diff=137686"/>
		<updated>2023-05-15T14:06:05Z</updated>

		<summary type="html">&lt;p&gt;BobDotCom: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screen shot illustrating syntax highlighting in TextMate&lt;/div&gt;</summary>
		<author><name>BobDotCom</name></author>
	</entry>
</feed>