1.复制粘贴

vi /root/.vimrc

map mf i#include<stdio.h><ESC>o#include<stdlib.h><Esc>o#include<sys/types.h><Esc>o#include<sys/stat.h><Esc>o#include<error.h><Esc>o#include<string.h><Esc>o#include<unistd.h><Esc>o#include<math.h><Esc>o#include<time.h><Esc>o<CR><CR><CR><CR><CR>int main(int argc,char *argv[])<Esc>o{<Esc>o<CR><CR><TAB>return 0;<CR><Esc>o}<Esc>2ko

map mfc i#include<iostream><ESC>ousing namespace std;<CR>#include<vector><Esc>o#include<string><Esc>o#include<list><Esc>o#include<map><Esc>o#include<algorithm><Esc>o#include<functional><Esc>o#include<numeric><Esc>o#include<time.h><Esc>o#include<math.h><Esc>o<CR><CR><CR><CR><CR>int main(int argc,char *argv[])<Esc>o{<Esc>o<CR><CR><TAB>return 0;<CR><Esc>o}<Esc>2ko






在这里插入图片描述
命令模式下敲mf就生成c语言的main函数
敲mfc就生成c++的main函数





2.使用方法

1.用vi打开一个文件,此时是命令模式
2.在命令模式下敲mf或mfc就可生成C/C++的文件

在这里插入图片描述




在这里插入图片描述




在这里插入图片描述





Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐