plug.vim
文件放到~/vimfiles/autoload文件夹(可能需要自行创建)" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')"插件管理开始,确保使用的是单引号
Plug 'morhetz/gruvbox'
Plug 'scrooloose/nerdtree'
Plug 'Yggdroot/indentLine' "对齐线
" Initialize plugin system
call plug#end() "插件管理结束
:PlugInstall
,需要全局代理:PlugInstall
这些代码分别为了解决特定的问题,或者添加某些功能
"Gvim中文菜单乱码解决方案#############################
"设置文件编码格式
set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,chinese,latin-1,gbk,gb18030,gk2312
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"解决consle提示信息输出乱码
language messages zh_CN.utf-8
"快捷键映射###################################
map <C-v> "+gP " Ctrl-V
map <C-c> "+y " CTRL-C
"NerdTree设置#################################
"autocmd VimEnter * NERDTree "自动打开NerdTree
map <F3> :NERDTreeToggle<CR> "设定插件的快捷键
let NERDTreeQuitOnOpen=1 "自动退出插件
autocmd BufEnter * if 0 == len(filter(range(1, winnr('$')), 'empty(getbufvar(winbufnr(v:val), "&bt"))')) | qa! | endif "自动退出插件
"设置树的显示图标
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
"设置自动缩进和tab键功能
set autoindent "开启自动缩进
set smartindent "智能选择缩进
set smarttab
set tabstop=4
set shiftwidth=4
set expandtab
"其他设置#####################################
set guifont=Microsoft_YaHei_Mono:h12 "字体&大小
set lines=35 columns=140 "更改高度和宽度
set number "显示行号
set backspace=2 "设置退格键
set ruler "底部的行号等显示
set showmatch "自动匹配标点,只是显示而不是自动补全
set autowrite "自动保存
set guioptions-=T "去除工具栏
set guioptions-=m "去除菜单栏
set guioptions-=L "去除左滚动条
set guioptions-=r "去除右滚动条
colorscheme gruvbox "设定主题
set background=dark "暗黑模式主题
set laststatus=2 "状态栏