Syntax Highlighting sul terminale di Mac OS

inserito nella categorie: Mac OS Tips
marchiato con i tag: , , , , , ,
Terminal Mac os

Una delle cose più belle e da invidiare al terminale di Linux è il syntax highlighting su VI e LS.

Come abilitarli anche su Mac OS?

Bene, per il file listing è semplicissimo, dato che Mac OS supporta nativamente questa funzione tramite ls -G, vi basterà aggiungere un alias. Per farlo, lanciate questi comandi nella vostra home directory da terminale:

sudo vi .profile

Quindi premete il tasto I per iniziare a scrivere, e aggiungete:

alias ls='ls -G'

Quindi date ESC, :wq, ENTER e riavviate il terminale.

Per quanto riguarda il SyntaxHighlighting sull’editor vi, date questi comandi:

cd /usr/share/vim/
sudo vim vimrc

Quindi aggiungete (sempre premendo prima il tasto I) le seguenti impostazioni:

set ai                  " auto indenting
set history=100         " keep 100 lines of history
set ruler               " show the cursor position
syntax on               " syntax highlighting
set hlsearch            " highlight the last searched term
filetype plugin on      " use the file type plugins

Quindi salvate nello stesso modo di prima, e riavviate il terminale: ora VI avrà tante belle nuove features ;)

Se hai letto questo articolo, potrebbero interessarti anche:

Commenta anche tu!