ANSI C支持的Vim [英] Ansi C support in Vim
问题描述
我刚开始学习VIM(和我想写一些C code在它)。所以我安装CVIM。但我不喜欢它。 u有写的真快(一个IF()......否则我只好preS \\,并以1秒SIF)。也是C风格是K&安培; R - 我真的很讨厌。因此,如果有对VIM汽车竞争的任何插件?
我在Linux下,我结合使用vim有:
- YCM 以获取自动完成功能
- 我已经定制了
文件类型插件
在〜/的.vim /文件类型插件/ cpp.vim里
有点像这样
设置equalprg =铛格式
NMAP< F9> GG = G``a
IMAP< F9> < ESC> GG = G``a
集自动缩进
集cindent
块引用>
铛格式
是铿锵编译器套件的一部分,我没有任何想法,如果这个工程在Cygwin下,但equalprg
只是一个代理的任何程序,它能够格式化源文件,例如的astyle
是一个很受欢迎的选择。有了这个设置,如果你preSS
F9
在vim铛格式
将被要求格式化code。这就是我需要亲自到有一个功能VIM。
如果您的计算机可以处理它,我建议只使用一个虚拟机。
I've just start learning vim (and i want to write some C code in it). So I installed cvim. But i don't like it. U have write really fast (for one if() .. else u have to pres \ and in 1 second "sif"). Also the C style is K&R - i really hate. SO if there are any plugin for auto competition for vim ?
解决方案I'm under Linux and I use vim in conjunction with:
- YCM to get the autocomplete feature
- I have customized the
ftplugin
under~/.vim/ftplugin/cpp.vim
a little bit like soset equalprg=clang-format nmap <F9> gg=G``a imap <F9> <ESC>gg=G``a set autoindent set cindent
clang-format
is part of the clang compiler suite, I don't have any idea if this works under CygWin butequalprg
is just a proxy to any program that is capable to format a source file, for exampleastyle
is a quite popular alternative.With this setup if you press
F9
in vimclang-format
will be called to format your code.And that's all I need personally to have a functional vim.
If your computer can handle it, I suggest to just use a Virtual Machine.
这篇关于ANSI C支持的Vim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!