基于vim 8.2设置。
1.golang在8.2版本中已自带golang语法高亮。
2.vim安装程序的html对css和javascript的缩进很难看,需要下载这个插件才能完美利用gg=G命令对带css和javascript代码的html文件完善格式化。下载地址:web_indent
3.emmet的安装,下载地址:emmet,下载后将相应文件copy至vim中对应的文件夹即可。缺省的emmet快捷键:“ctrl+y+,”。
4.我的vim配置文件:
" Ultimate VIMRC without plugin " Copyrights @ Yavobo " Version 0.10 " Created in 2016.11.02 11:11 " Updated in 2020.03.10 16:19 " " Describe: " This is an version of no plugin. " That's my favours! " " 1.base {{{ syntax on filetype indent plugin on set nocompatible set nobackup set noswapfile set history=2048 set autochdir set whichwrap=b,s,<,>,[,] set nobomb set backspace=indent,eol,start whichwrap+=<,>,[,] set ff=unix set cindent shiftwidth=4 " Vim 的默认寄存器和系统剪贴板共享 set clipboard+=unnamed " 设置 alt 键不映射到菜单栏 set winaltkeys=no " }}} " 2.Lang & Encoding {{{ let $LANG = 'en_US.UTF-8' language messages zh_CN.UTF-8 set encoding=utf-8 set termencoding=cp936 set fileencoding=utf-8 set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 set langmenu=zh_CN.utf-8 set imcmdline " 防止菜单出现乱码 source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim " }}} " 3.Theme {{{ " Set Number line and Cursor line " Set Status line set laststatus=2 set statusline=[%{&ff}:%{&fenc}]%F%m%r%h\ %w\ \ %=%l,%c\ %L set cmdheight=1 " Set font if has("win32") set guifont=YaHei_Consolas_Hybrid:h16 endif " Normal setup " 不显示工具/菜单栏 set guioptions-=T set guioptions-=m set guioptions-=L set guioptions-=r set guioptions-=b " 最大化启动 if has("gui_running") && has("win32") map:call libcallnr("gvimfullscreen.dll","ToggleFullScreen", 0) au GUIEnter * simalt ~x endif " 按F11切换全屏 imap :call libcallnr( "gvimfullscreen.dll","ToggleFullScreen", 0)" }}} " 4.Behavior {{{ set autoindent set mouse=a set backspace=2 set wrap set smartindent set tabstop=4 set softtabstop=4 set expandtab "set ai! map :tabnext map :tabnew set number set cursorline " For windows 7 " Display will not be normal in terminal when set t_Co to 256, it must be set to 8 " ------------------------------------------------------------------------ "set t_Co=8 colorscheme ron highlight Normal ctermbg=Black "highlight LineNr term=NONE cterm=NONE ctermbg=DarkCyan ctermfg=Yellow highlight LineNr term=NONE cterm=NONE ctermfg=Green highlight CursorLine term=NONE cterm=NONE ctermbg=DarkBlue highlight CursorLineNr term=NONE cterm=NONE ctermbg=DarkGreen ctermfg=Red " For windows 10 " Display will be same as gui in terminal to set t_Co to 256 " ---------------------------------------------------------- "set t_Co=256 "colorscheme torte "highlight Normal ctermbg=235 "highlight LineNr term=NONE cterm=NONE ctermbg=234 ctermfg=yellow "highlight CursorLine term=NONE cterm=NONE ctermbg=238 "highlight CursorLineNr term=NONE cterm=NONE ctermbg=236 ctermfg=red if has("gui_running") colorscheme desert highlight CursorLine guibg=#555555 highlight LineNr guibg=#222222 highlight CursorLineNr guifg=yellow endif " 设置标签 highlight TabLine guibg=#121212 guifg=red term=underline cterm=bold ctermfg=red ctermbg=gray highlight TabLineSel guibg=#121212 guifg=yellow term=bold cterm=bold ctermbg=Red ctermfg=yellow " 5.others 其它设置 if has("win32") " vimrc文件修改之后自动加载, windows autocmd! bufwritepost _vimrc source % else " vimrc文件修改之后自动加载, linux autocmd! bufwritepost .vimrc source % endif " 6.Extend " 快捷输入 " 自动完成括号和引号 " inoremap ' '' i " inoremap " "" i " inoremap ( () i " inoremap [ []i " inoremap { { } " }}}O