logo头像

吾之初心,永世不忘

vim基础配置

前言

vim配置出来特别强大,它可以安装插件,我现在还没安装什么插件,就简单叙述一下基本配置。

  • 可以去github搜索一些人写的配置,好多大牛
  • 谷歌到一些人的配置,多看一些,搜索适合自己的配置
  • 学习安装插件,插件的功能就比较有针对性

我的配置

系统的vim的配置文件在

/etc/vim/vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
" my set ---zhang

"设置行号
set nu

"设置语法高亮
syntax enable
syntax on

"设置配色方案
colorscheme desert

" 自适应不同语言的智能缩进
filetype indent on
" 将制表符扩展为空格
set expandtab
" 设置编辑时制表符占用空格数
set tabstop=4
" 设置格式化时制表符占用空格数
set shiftwidth=4
" 让 vim 把连续数量的空格视为一个制表符
set softtabstop=4

" 让配置变更立即生效
autocmd BufWritePost $MYVIMRC source $MYVIMRC

" 关闭兼容模式
set nocompatible
" vim 自身命令行模式智能补全
set wildmenu

" 高亮显示当前行/列
"set cursorline
"set cursorcolumn
" 高亮显示搜索结果
set hlsearch

"c++的头文件
map <F3> :call SetTitle()<CR>
func SetTitle()
let l = 0
let l = l + 1 | call setline(l,'/* ***********************************************')
let l = l + 1 | call setline(l,'Author :zhangxiaofeng')
let l = l + 1 | call setline(l,'Email :154704230@qq.com')
let l = l + 1 | call setline(l,'Created Time :'.strftime('%c'))
let l = l + 1 | call setline(l,'File Name :'.expand('%'))
let l = l + 1 | call setline(l,'************************************************ */')
let l = l + 1 | call setline(l,'')
let l = l + 1 | call setline(l,'#include <stdio.h>')
let l = l + 1 | call setline(l,'#include <string.h>')
let l = l + 1 | call setline(l,'#include <iostream>')
let l = l + 1 | call setline(l,'#include <algorithm>')
let l = l + 1 | call setline(l,'#include <vector>')
let l = l + 1 | call setline(l,'#include <queue>')
let l = l + 1 | call setline(l,'#include <set>')
let l = l + 1 | call setline(l,'#include <map>')
let l = l + 1 | call setline(l,'#include <string>')
let l = l + 1 | call setline(l,'#include <math.h>')
let l = l + 1 | call setline(l,'#include <stdlib.h>')
let l = l + 1 | call setline(l,'#include <time.h>')
let l = l + 1 | call setline(l,'using namespace std;')
let l = l + 1 | call setline(l,'')
let l = l + 1 | call setline(l,'int main()')
let l = l + 1 | call setline(l,'{')
let l = l + 1 | call setline(l,' //freopen("in.txt","r",stdin);')
let l = l + 1 | call setline(l,' //freopen("out.txt","w",stdout);')
let l = l + 1 | call setline(l,' ')
let l = l + 1 | call setline(l,' return 0;')
let l = l + 1 | call setline(l,'}')
endfunc

就这么多了吧,研究插件中,以后有时间了再回来更新!!!