How to configure the VI to autocomplete and format the files in a standardized way according to each language?

2

I've been using VI for a few years, I think about 20 years, still XCO Unix and Xenix, but I never took the initiative to make my environment totally parameterized to programming in languages like C / C ++, PHP and Java .

I would like to prepare my VI to be successful in using these languages, I still have situations that need to connect to remote servers and recompile programs, so it is necessary to edit the files urgently and VI is the best choice for me.

How can I configure it to autocomplete and format the files in a standard way for each language?

    
asked by anonymous 20.06.2015 / 16:52

2 answers

1

There is a possibility to autocomplete existing words in your code from vim 7 . You can use this function using the CTRL + n combination.

To autocomplete reserved words from some languages already available, use the commands below (for php)

:set omnifunc=phpcomplete#CompletePHP

Or add the following line to your ~/.vimrc :

autocmd FileType php set omnifunc=phpcomplete#CompletePHP

Use CTRL + x , CTRL + o to autocomplete.

If I'm not mistaken, there is no autocomplete for java and C ++, so you'll have to install a plugin to the part. I suggest the vjde and the following link to install it: link

Another thing I think is legal is automatic indentation (% w / o% is the amount of whitespace. add% w /%),

set sw=4
set autoindent

and the plugins sw and ~/.vimrc .

    
22.06.2015 / 16:23
0

I recommend using link It's a real hand on the wheel when it's time to start. To auto complete, I recommend YCM (YouCompleteMe) link along with link

    
31.08.2015 / 16:51