Tag Archives: color highlighting

Add Twig syntax highlight in Sublime Text 2

  1. Select the “Preferences->Browse Packages…” menu to open the folder that contains Sublime Text 2 packages.
  2. Download the Anomareh/PHP-Twig.tmbundle repository contents to a folder called PHP-Twig inside that packages folder.
  3. Move all the files inside PHP-Twig/Syntaxes folder to the PHP-Twig root folder.
  4. Restart Sublime Text 2.

You can also use the terminal to do this using git:

$ cd ~/.config/sublime-text-2/Packages/
$ git clone https://github.com/Anomareh/PHP-Twig.tmbundle.git PHP-Twig
$ mv PHP-Twig/Syntaxes/* PHP-Twig/

Once restarted you’ll see a new option called “HTML (Twig)” in “View->Syntax” menu. To automaticaly highlight files with html.twig extension just open one of them and select “View->Syntax->Open all current extension as…->HTML (Twig)”.


Turn on syntax highlighting for vi and vim in Mac OS X

Turning syntax highlighting for vi and vim in Mac OS X is as simple as creating a file called “.vimrc” in your home folder with the following content:

set nocompatible
syntax on


You may not like the standard color highlighting schema, but it can be easily changed. For example open some “.php” file and type :colorscheme followed by an space and the hit the tab key (or shift-tab to go backwards). You will see the different color schema names available in the system and then if you hit enter you’ll se immediately how it changes to the one you selected.

You can also set your default color highlighting schema in the “.vimrc” with “colo schemaname“:

set nocompatible
syntax on
colo default

The available schema names are those folder names inside the folder “/usr/share/vim/vimXX/” (the XX are 2 numbers that change for version to version of Mac OS X) without the “.vim” extension:

$ ls /usr/share/vim/`echo vim[0-9][0-9]`/colors/*.vim

My favorite one is “peachpuff”.

Ref: http://igoles.wordpress.com/2006/09/01/anadiendo-color-a-vim-en-mac-os-x/