ANSI C支持的Vim [英] Ansi C support in Vim

查看:153
本文介绍了ANSI C支持的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 so

set 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 but equalprg is just a proxy to any program that is capable to format a source file, for example astyle is a quite popular alternative.

With this setup if you press F9 in vim clang-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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆