VIM开发C/C++插件cvim的安装及使用
利用c.vim插件,你可以实现
添加文件头
添加注释
插入一些代码片段
语法检查
读函数文档
注释代码块
这一插件的作者是 Fritz Mehner, 目标就是打造程序员流畅的编辑环境。
这一插件还能完成:
Statement oriented editing of C / C++ programs
Speed up writing new code considerably.
Write code and comments with a professional appearance from the beginning.
Use code snippets
接下来我们对这一插件详细介绍.
3 安装插件
Step 1: 下载c.vim
$ cd /usr/src
$ wget http://www.vim.org/scripts/download_script.php?src_id=9679
Step 2: 安装
$ mkdir ~/.vim
$ cd ~/.vim
$ unzip /usr/src/cvim.zip
Step 3: 启用这一插件
$ vim ~/.vimrc
filetype plugin on
8 c.vim的使用
Feature 1: Add Automatic Header to *.c file
当你新建一个扩展名.c的文件时候,自动在文件头部增加头部注释
$ vim myprogram.c
/*
* =================================================
* Filename: myprogram.c
*
* Description:
*
* Version: 1.0
* Created: 01/19/09 20:23:25
* Revision: none
* Compiler: gcc
*
* Author: Dr. Fritz Mehner (mn),
mehner@fh-swf.de
为防备电子邮件地址收集器,这个 E-mail 地址被隐藏,你的浏览器必须支持 Javascript 才可看到这个邮件地址
* Company: FH Südwestfalen, Iserlohn
*
* =================================================
*/
其中如果你要改变 AUTHOR 和 COMPANY的值, 要修改模板文件 ~/.vim/c-support/templates/Templates
$ vim ~/.vim/c-support/templates/Templates
|AUTHOR| = geekstuff
|AUTHORREF| = gk
|EMAIL| = subscribe@geekstuff
|COMPANY| = thegeekstuff.com
现在编辑一个新文件,看看你的作者和公司名称改变了没有。
$ vim myprogram.c
/*
* =================================================
*
* Filename: myprogram.c
*
* Description:
*
* Version: 1.0
* Created: 01/19/09 20:26:43
* Revision: none
* Compiler: gcc
*
* Author: geekstuff (gk), subscribe@geekstuff
* Company: thegeekstuff.com
*
* =========================================
相关文档:
最近对基础知识进行了学习,发现以前很多东西都没有搞清楚
1. 编译的问题,头文件主要是定义
//////// add.c
int add(int a, int b)
{
return a + b;
}
///////// main.c
#include <stdio.h>
int add(int a, int b);
int main ()
{
printf("%d" ......
标签:
it
分类:C/C++
我的回忆和有趣的故事 --- C/C++圣战篇
李维
------------------------------------------------------------------------------------------
声明
以下的这篇文章内容是我个人的回忆以及看法,没有任何特别的偏见,许多的事情是根据我的记忆以及从许多人的诉说中得知的,也许内容不是百分 ......
C/C++
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010年4月29日, 上午9:46
*/
#include <iostream>
using namespace std;
int maximum(int[], int);
int main(int argc, char** argv) {
// int sg[3][4] = {
int sg[][4] = {
{68, 77, 73, 86},
{87, 96, 7 ......
C和C++互相调用函数时,使用extern "C"。
原因:
C不支持函数重载,而C++支持函数重载。函数被C++编译后会名字与C语言不同。假设某函数原型为foo(ing x, int y),被C++编译后名字为_foo_int_int,而C编译器编译后名字为_foo。 ......