sábado, junho 18, 2016

vim syntax highlighting

vim is a modal editor: in different modes of vim, the same keystroke is interpreted differently.

You can open vim from the command line by typing 'vim'. If you want to learn more, then type ':vimtutor' for a relatively quick (~30 min) introduction. For help type ':help' or press 'F1'.


Small tips to survive in Vim

To insert text (and be in the insert mode): press 'i' then edit your text. To come back to the command mode press "ESC".

To save text (in command mode): press ':w'

To quit vim (in command mode): press ':q'

To quit vim without saving (in command mode): press ':q!'

To delete the line where the cursor is (in command mode): press 'dd'


Syntax highlighting

Vim supports syntax highlighting. To activate it open up

/etc/vim/vimrc

and uncomment the line

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.

syntax on



http://vim.wikia.com/wiki/Forcing_Syntax_Coloring_for_files_with_odd_extensions
If you are editing a file containing PHP script (for example) but the file doesn't have the extension .php, you can force the desired syntax coloring with:set syntax=php


similarly:set syntax=perl :set syntax=html


Alternatively if the extension causes an undesired coloring, switch off coloring with:set syntax=off


look in the directory */vim/vim61/ftplugin / for supported languages (ftplugin == FileType Plugin).

Nenhum comentário: