Syntax highlighting support for Julia in Nano - julia

I use the minimal Nano text editor quite frequently. Recently, I've began to experiment with the young Julia programming language, but found that the .ji extension does not trigger appropriate highlighting in the editor environment as it does for recognized languages like Python.
Does syntax highlighting support exist for Julia x Nano? If it does not, how could I go about adding syntax highlighting support for a new language to Nano? Is there a standard template for each language?

Quoting Matt B.'s comment, see Google's top result for nano julia syntax is this reddit thread.
Just copy and paste this into your .nanorc (typically located in ~/.nanorc):
syntax "julia" "\.jl$"
color brightblack "\<(begin|break|catch|continue|function|elseif|else|end)\>"
color brightblack "\<(finally|for|global|local|if|include|using|require|macro)\>"
color brightblack "\<(println|return|try|type|while|module)\>"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
color white "[(]"
color red "[-+*/|=%<>&~^]|\<(and|not|or|is|in)\>"
color brightyellow "#[A-Za-z0-9_]+"
color brightmagenta "__[A-Za-z0-9_]+__"
color brightcyan "\<(true|false)\>"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color yellow "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
color yellow start=""""[^"]" end="""""
color yellow start="'''[^']" end="'''"
color magenta "\\.?"
color cyan "(^|[[:space:]])#([^{].*)?$"
color brightwhite,cyan "TODO:?"
See https://github.com/Naereen/nanorc/blob/master/julia.nanorc for an updated version.

Related

Testkitchen / KitchenCI - How to change console output colors?

In the present case Ansible is used with KitchenCI/Testkitchen.
Question: How can I control the color of the kitchen output?
I tried different coloroptions in ansible but for kitchen I didn't find any options, but this bugs me, especially if the color of the kitchenoutput turns darkblue suddenly.
Problem:
The color of the kitchen-output changes, depending on ...I don't know...
(It doesn't change every run, but at some time, something initiates the colorchange and then it will keep the color for a while)
Sometimes it's an ugly pink:
Sometimes it's yellow, green or cyan:
... But most annoyingly, if it's darkblue, suddenly, and I can't read stuff:
Setup: i3, xfce4-terminal, zsh, sometimes in tmux, with echo $TERM # -> screen-256color
I think, if something in the folderstructure change, or something in the current ansible environment (the shell-options are always the same), e.g. if I clone the whole directory (at least thats where I recognized it last time). It can even be a different color if I change the directory in the "roles" directory. But all in all I can't point my finger at it and I would be glad for help.
If more Information is needed, I would gladly provide it.
Update:
Maybe it's something in ~/.rvm/gems/ruby-2.5.1/gems/...
Theres a lot of code regarding "tty"
This does not answer the question (that's still interesting! because I don't want the color to change), but targets the underlying problem, meaning the non-readablitity of the blue color.
The reason was the configuration of "xfce4-terminal".
In xfce4-terminal one can define the representation for colors in the right-click: 'preferences' > 'colors' > 'Palette'
If a background-color is set, that would conflict with the color "blue" (dark blue), the representation for the color "blue" can be change (e.g. to grey, or light blue, or everything else).
See the screenshot:

Changing directory color with zsh + Prezto

I am using Prezto + zsh as my shell. I would like to change the color of
directories when I ls my directory. For instance, here is what I currently
have:
Obviously, this is no fun, as I’m hardly able to read my directories because the
blue is so dark. I’d like to change it to white or orange or something lighter.
This dark blue is specific only to directories. Files show up in a nice white
text. Where and what settings must I find to change this?
Update
I've seen this answer still getting attention, so here's an update. Instead of messing with individual colours as below, simply adjust the Minimum Contrast within Preferences ... -> Profiles -> Colors. I set mine to 60.
Original answer
The easier way to do this is to change the colour scheme of your terminal. For example if you are using iTerm2 on a Mac then:
Launch iTerm2
type CMD+i
In the "Colors" tab, change the setting for "Blue" (and potentially the "Bright" equivalient)
In the "General" tab, click "Copy Current Settings to Selected Profile"
If you want to revert back to the defaults you can always select a value from the "Color presets..." dropdown in the "Colors" tab.
Do the equivalent in your favourite terminal if you don't use iTerm2 on a Mac.
The answer depends on your ls. BSD ls uses the environment variable LSCOLORS; coreutils ls uses LS_COLORS instead. See your man page.
The utility module of Prezto uses dircolors (if available) to customize the colors of coreutils ls, which also comes with coreutils. So if you have coreutils, then you can use dircolors to provide actually human-readable color definitions. Read the man page of dircolors for details. Prezto reads from $HOME/.dir_colors by default, otherwise it just use the default colors defined by dircolors. You can of course specify other locations by editing on top of Prezto.
For BSD ls, there's probably no utility comparable to dircolors, so one has to manually define LSCOLORS. See the ENVIRONMENT section of the man page on its format, which should be pretty clear. An example is LSCOLORS='exfxcxdxbxGxDxabagacad', used by Prezto by default. To have it take effect, put it in runcoms, after loading Prezto's utility module.
I may be late to the party but I found the answer here: https://github.com/sorin-ionescu/prezto/issues/1539
Run in the Terminal or add to your .zshrc file
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"

256 colors in zsh-syntax-highlighting?

OK, so I'm using this little fancy cutting edge technology called zsh-syntax-highlighting and although I'm overall happy with the result I don't know how to set styles to anything but 8 basic colors (black, red, green, yellow, blue, magenta, cyan, white), e.g.
#works
ZSH_HIGHLIGHT_STYLES[path]='fg=red'
ZSH_HIGHLIGHT_STYLES[path]='fg=1'
#doesn't work
ZSH_HIGHLIGHT_STYLES[path]='fg=31m'
ZSH_HIGHLIGHT_STYLES[path]='fg=\e[31m'
ZSH_HIGHLIGHT_STYLES[path]='fg=%{\e[31m%}'
ZSH_HIGHLIGHT_STYLES[path]='31m'
ZSH_HIGHLIGHT_STYLES[path]='\e[31m'
ZSH_HIGHLIGHT_STYLES[path]='%{\e[31m%}'
ZSH_HIGHLIGHT_STYLES[path]='%{\e[1;38;5;118m%}'
So, how do I set more fancy colors for this zshzle plugin?
As you pointed out in the comment to chepner answer terminator is a fork of gnome-terminal and it still uses a lot of functions from gnome. In fact it seems that the whole terminator VTE widget comes from gnome and gnome-terminal by defaults "supports" only 8 basic colors. You can check that with echotc Co command. It will return 8 for both of them and for xterm too (although in xterm case this is true and only 8 colors), so basically all 3 terminal emulators you tried so far.
Now, you noted that teminator (and gnome-terminal) can in fact display more colors, but this is only because it more or less processes all those special color codes without paying attention to TERM settings what does not obey standards but well, this is gnome. Anyway to make long story short you need to set TERM environment variable to something like xterm-256color and check again with echotc Co - you should now see 256, and your ZSH_HIGHLIGHT_STYLES[path]='fg=217' should work as well.
To always start with 256 colors you can put into you .zshrc
[[ "$TERM" == "xterm" ]] && export TERM=xterm-256color
and if you have any gnome shortcuts with terminator then change them as follows
terminator -e "TERM=xterm-256color pine"
http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting suggests that the value for fg be a single integer from 0 to 255:
ZSH_HIGHLIGHT_STYLES[path]='fg=167' # Whatever color 167 is in the 256-color palette.
I Notice you are using [path], it could be that a custom path with it's own color setting is interfering with your highlight setting. Try testing with a different item such as [command]:
ZSH_HIGHLIGHT_STYLES[command]='fg=222'
I tried the above line and it works for me. I tried using the same value for path already knowing my custom prompt has its own colors and my prompts custom colors won out over the highlight.
I use a ZSH helper called Oh-My-ZSH so the following may be a bit different or not apply to you:
Make sure you are changing the color definition after the highlight plugin is loaded. On my setup it will actually generate an error but since I only tested on my syetem (OSX10,9, ZSH 5.0.7, Oh-My-ZSH, iTerm v2) your experience may be different.
Doesn't work:
ZSH_HIGHLIGHT_STYLES[command]='fg=222'
...
plugins=(git osx jim colorize zsh-syntax-highlighting)
Does work:
plugins=(git osx jim colorize zsh-syntax-highlighting)
...
ZSH_HIGHLIGHT_STYLES[command]='fg=222'

What do colour codes mean in Isabelle/jEdit?

What do the colour codes mean in Isabelle/jEdit? I could not find their description in the Isabelle/jEdit manual. The only thing it writes is
Prover feedback works via colors, boxes, squiggly underline, hyper-
links, popup windows, icons, clickable output — all based on semantic
markup produced by Isabelle in the background.
Colours are used as proof script background and on a vertical bar beside the scrollbar.
Could you point to some documentation or explain it here?
You can see their names and change them in "Plugins/Plugin Options" and then "Isabelle/Rendering". The names give a relatively clear explanation, and you can refer to the manuals from the terms used in the names.
There is a lot of colors so I won't describe them all.
For the most important default colors:
Logic:
blue : free variable
green : bound variable
orange : skolem constant ("free" variables existentially "quantified")
cyan : syntax (not a variable or a constant, like case or if)
Isar Keywords:
sky blue : commands (like lemma, proof or have)
red : tactic-style commands (like apply, done or prefer)
turquoise : statements (like where, fixes, shows or and)
Messages highlighting in output:
red : error
yellow : warning
light blue : info
Highlighting in editor:
red : error
light yellow : current line
gray : quoted text (logic and types)
light gray : comment and formal text (introduced with text or section)
purple : running process on the command (also shown on the right)
pink : unprocessed (outdated) command (also shown on the right)
In general, an underlined command displays a message in the output (possibly associated with an icon and a box on the right). More specifically:
Icons, [boxes] and {in text}:
red exclamation mark [red box] {squiggly red underline} : error
orange exclamation mark [orange box] {squiggly orange underline} : warning
blue i {squiggly blue underline}: information (often provided by automatic tools)
{squiggly gray underline} : the command shows a message in the output
{red text} : comment (like (* This is a comment *))

vim syntax highlighting

How can I change the syntax highlighting in vim for C/C++/PHP in particular?
Can I also change the background color so it won't be the same as the shell's?
Before you start installing various plugins, check out pre-installed color schemes that ships with your Vim. In my case I have many of them:
# rpm -ql vim vim-common | grep color
/usr/share/vim/vim72/colors
/usr/share/vim/vim72/colors/README.txt
/usr/share/vim/vim72/colors/blue.vim
/usr/share/vim/vim72/colors/darkblue.vim
/usr/share/vim/vim72/colors/default.vim
/usr/share/vim/vim72/colors/delek.vim
/usr/share/vim/vim72/colors/desert.vim
/usr/share/vim/vim72/colors/elflord.vim
/usr/share/vim/vim72/colors/evening.vim
/usr/share/vim/vim72/colors/koehler.vim
/usr/share/vim/vim72/colors/morning.vim
/usr/share/vim/vim72/colors/murphy.vim
/usr/share/vim/vim72/colors/pablo.vim
/usr/share/vim/vim72/colors/peachpuff.vim
/usr/share/vim/vim72/colors/ron.vim
/usr/share/vim/vim72/colors/shine.vim
/usr/share/vim/vim72/colors/slate.vim
/usr/share/vim/vim72/colors/torte.vim
/usr/share/vim/vim72/colors/zellner.vim
/usr/share/vim/vim72/ftplugin/dircolors.vim
/usr/share/vim/vim72/syntax/colortest.vim
/usr/share/vim/vim72/syntax/dircolors.vim
/usr/share/vim/vim72/syntax/syncolor.vim
/usr/share/vim/vimfiles/after/colors
/usr/share/vim/vimfiles/colors
To change it just use this:
colorscheme darkblue
Also you can download color schemes and just drop them into your VIMRC subdirectory "colors" and load them the same way. I like this one for example: http://ethanschoonover.com/solarized
And of course, you can modify those color schemes. Just copy the "default.vim" (or the one you like) to your VIMRC/colors and edit it to change colors you want.
You have to give it a syntax file to load and play around with it:
http://www.vim.org/scripts/script.php?script_id=1571
To enable it (in case you don't know) its :set syntax
For info on changing vim's background check here:
Setting the VIM background colors

Resources