Windows下Gvim安装与配置

这是以前实验室电脑上的笔记,当时记录的很详细,今天在笔记本上打开发现就只有一点儿内容。这里留个坑,下次配置再详细记录下。

参考

基本配置:

插件:

1 下载gvim:

官网or软件管家

2 安装插件管理工具

在Vim/vimfiles路径下新建文件夹bundle,然后在此文件夹下克隆github上的vundel项目:

img

3 分享自己的配置文件:

部分配置需要写备注解释下比较好,暂时无。

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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
source $VIMRUNTIME/vimrc_example.vim

set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction

"行号、颜色风格、语法支持
set nu!
colorscheme desert
syntax enable
syntax on

" 设置字体和字号
set guifont=courier_new:h10

" 设置Tab缩进4个空格
set expandtab
set ts=4
set cursorline "高亮光标所在行
set cursorcolumn "突出显示当前列

set nobackup " 不要备份
set noundofile " 不生成undo文件
set noswapfile " 不创建临时交换文件
set nowritebackup
set wrap " 自动换行

"不显示工具/菜单栏
set guioptions-=T
"set guioptions-=m
"set guioptions-=L
"set guioptions-=r
"set guioptions-=b
" Vim 的默认寄存器和系统剪贴板共享
set clipboard+=unnamed

" Lang & Encoding {{{
set fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,gb18030,latin1,cp936
set encoding=utf-8
let $LANG = 'en_US.UTF-8'
language messages zh_CN.UTF-8
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" }}}


" for vundle {{{
filetype off
"Vundle的路径
set rtp+=$VIM/vimfiles/bundle/Vundle.vim
"插件的安装路径
call vundle#begin('$VIM/vimfiles/bundle/')
Plugin 'gmarik/Vundle.vim'
Plugin 'L9'
Plugin 'The-NERD-tree'
Plugin 'Shougo/neocomplcache.vim'
Plugin 'junegunn/vim-easy-align'
Plugin 'dense-analysis/ale'
call vundle#end()
filetype plugin indent on
" cmd: ':BundleInstall'
"}}}

" for plugin 'NERDTree'{{{
nmap <silent> <F3> :NERDTreeMirror<CR>
nmap <silent> <F3> :NERDTreeToggle<CR>
" "窗口大小
" let NERDTreeWinSize=25
" "窗口位置
" let NERDTreeWinPos='left'
" "是否默认显示行号
" let NERDTreeShowLineNumbers=1
" "是否默认显示隐藏文件
" let NERDTreeShowHidden=0
"}}}

" for plugin 'neocomplcache' {{{
" cache 自动补全
" set completeopt-=preview
let g:acp_enableAtStartup = 0
let g:neocomplcache_enable_at_startup = 1
let g:NeoComplCache_DisableAutoComplete = 1
" For cursor moving in insert mode(Not recommended)
inoremap <expr><Left> neocomplcache#close_popup() . "\<Left>"
inoremap <expr><Right> neocomplcache#close_popup() . "\<Right>"
inoremap <expr><Up> neocomplcache#close_popup() . "\<Up>"
inoremap <expr><Down> neocomplcache#close_popup() . "\<Down>"
"}}}

" for plugn 'vim-easy-align' {{{
" 对齐插件
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
"}}}

" for plugn 'dense-analysis/ale' {{{
" 异步语法检查插件
"keep the sign gutter open
let g:ale_sign_column_always = 1
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
"打开文件时进行检查
let g:ale_lint_on_enter = 1
" show errors or warnings in my statusline
let g:airline#extensions#ale#enabled = 1
" only enable these linters
let g:ale_linters = {
\ 'verilog': ['iverilog']
\}
"}}}

4 安装插件

先在 .vimrc文件中写入增加插件的代码然后在vim的底部命令输入:BundleInstall。这样bundle就会自动下载插件了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
" for vundle {{{
filetype off
"Vundle的路径
set rtp+=$VIM/vimfiles/bundle/Vundle.vim
"插件的安装路径
call vundle#begin('$VIM/vimfiles/bundle/')
Plugin 'gmarik/Vundle.vim'
Plugin 'L9'
Plugin 'The-NERD-tree'
Plugin 'Shougo/neocomplcache.vim'
Plugin 'junegunn/vim-easy-align'
Plugin 'dense-analysis/ale'
call vundle#end()
filetype plugin indent on
" cmd: ':BundleInstall'
"}}}

1689778076364

插件还需要配置。