TinyOS NesC syntax highlighting settings under Vim

The default vim does not support nesC syntax highlighting, which brings inconvenience to reading the source code. However, this problem can be solved by installing the NesC Syntax Highlighting plugin. The specific operations are as follows:

1. Download the plugin

Download NesC Syntax Highlighting : The Syntax Highlighting for NesC Files at http://www.vim.org/scripts/script.php?script_id=1847 , there are currently two versions, download the new version vim.tar.gz.

2. Install the plugin

(1) Unzip vim.tar.gz to get the synax folder

tar zxvf vim.tar.gz

(2) Copy synax, usually to the ~/.vim/ (or use the directory /etc/vim/)) directory, as follows:

sudo cp -r syntax /ect/vim/

(3) Modify the vimrc file, open the vimrc (/etc/vim/vimrc) file, and add the following statement at the end of the file:
augroup filetypedetect
au! BufRead,BufNewFile *nc setfiletype nc
augroup END

(4) Save and exit

3. Other common vim settings

(1) Turn on syntax highlighting
Method 1:

sudo vim ~/.vimrc

In the file write:
if &t_Co>1
syntax enable
endif

Method 2:

sudo vim /etc/vim/vimrc

Remove the "before syntax on"

(2) Display the line number Add set nu to /etc/vim/vimrc

(3) Automatic indentation Add set autoindent set cindent
to /etc/vim/vimrc

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324936805&siteId=291194637