windows 安装vim过程记录
2015-11-05 22:23
525 查看
windows 安装vim过程记录
下载安装文件
在网站http://www.vim.org/download.php下载。文件编码问题
在_vimrc中,输入:"the chinese encoding set encoding=utf-8 set fileencodings=utf-8,chinese,latin-1 if has("win32") set fileencoding=chinese else set fileencoding=utf-8 endif source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim language messages zh_CN.utf-8 set termencoding=gbk
OK,这样gvim和命令行的vim显示均正常。
字体设置
英文采用Inconsolata字体,中文采用微软雅黑(YaHei_mono.ttf)。安装好字体后,在vimrc中加入:" The fonts set guifont="Inconsolata 20" set gfw=Yahei_Mono:h10.5:cGB231
设置基本的配置文件内容
set history=400 set tabstop=8 set nobackup set softtabstop=4 set shiftwidth=4 set expandtab set nu set wildmenu set wildmode=full "colorscheme desert syntax enable set background=dark set foldenable set nocompatible set completeopt=longest,menu set autoindent set autochdir set magic set cursorline set cursorcolumn set syntax=on set cindent set guioptions-=T set guioptions-=r set guioptions+=c set guioptions-=L filetype plugin indent on filetype plugin on "F4 to toggle highlighting on/off noremap <F4> :set hlsearch! hlsearch?<CR> "F3 to toggle caseinsensetive noremap <F3> :set ic! ic?<CR>
Pathogen插件安装
此插件可用于管理其它插件。下载地址:http://www.vim.org/scripts/script.php?script_id=2332
安装方法见官方网站。记录:
将pathogen.vim拷贝至vimfiles/autoload文件夹下(autoload文件夹需手动创建)
在vimrc中添加:
execute pathogen#infect()
Solarized 配色方案
从网站https://github.com/altercation/vim-colors-solarized下载所有的文件将zip移动到vimfires/bundle文件夹(需要手动创建),并在此解压。
在vimrc中加入:
colorscheme solarized let g:solarized_italic=(abs(g:solarized_italic-1)) | colorscheme solarized
第二行用于关闭斜体显示。斜体在Windows中显示不正常。
安装Ctags
下载Ctags,解压,添加至PATH变量即可。vimrc中加入:
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>:set tags+=tags<CR>
安装Taglist插件
下载http://www.vim.org/scripts/script.php?script_id=273将文件拷贝到vimfires/bundle/taglist并解压到此目录。
在vimrc中加入:
let Tlist_Show_One_File=1 let Tlist_Exit_OnlyWindow=1
安装OmniCppComplete
下载http://www.vim.org/scripts/script.php?script_id=1520解压到vimfiles/bundle/omnicppcomplete
vimrc中加入
set nocp autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags let OmniCpp_NamespaceSearch = 2 let OmniCpp_GlobalScopeSearch = 1 let OmniCpp_ShowAccess = 1 let OmniCpp_MayCompleteDot = 1 let OmniCpp_MayCompleteArrow = 1 let OmniCpp_MayCompleteScope = 1 let OmniCpp_SelectFirstItem = 2 let OmniCpp_DefaultNamespaces = ["std", "GLIBCXX_STD"]
安装SuperTab
下载:http://www.vim.org/scripts/script.php?script_id=1643用vim打开vmb文件,输入
:so %,即安装成功。
vimrc中加入:
let g:SuperTabDefaultCompletionType="context"
安装NERDTree
下载:http://www.vim.org/scripts/script.php?script_id=1658解压至vimfires/bundle/nerdtree
安装Winmanager
下载:http://www.vim.org/scripts/script.php?script_id=95解压到vimfiles/bundle/winmanager
vimrc中加入:
let g:NERDTree_title="[NERDTree]" let g:winManagerWindowLayout="NERDTree|TagList" function! NERDTree_Start() exec 'NERDTree' endfunction function! NERDTree_IsValid() return 1 endfunction "nmap wm :WMToggle<CR>
注意最好不要map wm,因为这会导致单词移动指令w很慢,而这个指令是很常用的。
这个版本的winmanager要打开窗口时会又打开一个小窗口。修正:
打开plugin/winmanager.vim
找到函数ToogleWindowsManager,并添加
exe 'q',即改为如下形式:
function! <SID>ToggleWindowsManager() if IsWinManagerVisible() call s:CloseWindowsManager() else call s:StartWindowsManager() exe 'q' end endfunction
安装MiniBufExplorer
下载:http://www.vim.org/scripts/script.php?script_id=159将minibufexpl.vim拷贝到vimfiles/plugin中
vimrc中加入:
let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 let g:minBufExplMoreThanOne=0
C++文件的自动加载STL tags
vimrc:autocmd FileType cpp set tags+=d:\software\tags\stdcpp.tags
安装javacomplete
下载:http://www.vim.org/scripts/script.php?script_id=1785解压至vimfiles/bundle/javacomplete
vimrc:
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
第一次运行会有点慢,因为要编译Reflection.java。以后就好了。
STL语法高亮
下载:http://www.vim.org/scripts/script.php?script_id=4293将stl.vim拷贝到vimfiles/after/syntax/cpp文件夹中,没有此路径就手动创建。
Python Complete
下载http://www.vim.org/scripts/script.php?script_id=1542将pythoncomplete.vim复制到vimfiles/autoload中
Python语法高亮强化
下载:http://www.vim.org/scripts/script.php?script_id=790得到python.vim到vimfiles/syntax下。
windows 全屏
下载http://www.vim.org/scripts/script.php?script_id=2596#1.0将dll文件放在和gvim.exe一个目录下。在vimrc中加入:
autocmd VimEnter * call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0) map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
其中,第一行的作用是启动就全屏。第二行的作用是按F11全屏。
安装html
下载http://www.vim.org/scripts/script.php?script_id=453解压至bundle目录下的HTML文件夹。
在HTML文件夹下新建一个template文件夹,里面加入template.html,内容如下:
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <title>This is a test</title> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" /> </head> <body> </body>
在vimrc中加入:
autocmd Filetype html set guioptions-=T let g:html_template = 'F:\mytools\vim\vimfiles\bundle\HTML\template\template.html' let g:no_html_tab_mapping = 'yes'
其中第一句是因为html插件会在工具栏中加入内容,导致显示不正常。需要再次去掉工具栏并按回车确认错误并继续。第二句是指向template.html文件。第三行避免则是HTML.vim的TAB和supertab.vim冲突。可以在html文件的决普通模式下,输入
;html试试。
安装css_color
下载:http://www.vim.org/scripts/script.php?script_id=2150将css.vim保存至vimfiles/aftwr/syntax/css.vim
现在css就可以显示颜色了。
安装AutoComplPop
下载:http://www.vim.org/scripts/script.php?script_id=1879javascript语法高亮
下载http://www.vim.org/scripts/script.php?script_id=1491将javascript.vim移动至vimfiles/syntax中
jspc.vim : JavaScript Parameter Complete
下载https://github.com/othree/jspc.vim解压至bundle目录即可
安装tern for vim
下载:https://github.com/marijnh/tern_for_vim在其目录下运行npm install(需要安装好nodejs)
安装前端神器Emmet
下载https://github.com/mattn/emmet-vim解压至bundle目录即可。
使用Linux模式
将vim74目录下的mswin.vim重命名为其它名字,将_vimrc中的两行注释掉:"source $VIMRUNTIME/mswin.vim "behave mswin
在默认的配置文件中,应该是3、4行
现在就可以使用
<C-a>、
<C-x>、
<C-v>等键了。
安装the better javascript completion
下载https://github.com/1995eaton/vim-better-javascript-completion解压至bundle目录即可。
安装easy-motion
下载http://www.vim.org/scripts/script.php?script_id=3526解压至bundle目录即可。
安装vim-surround
下载https://github.com/tpope/vim-surround解压至bundle目录。
安装nerdcommenter
下载https://github.com/scrooloose/nerdcommenter解压至bundle目录。
相关文章推荐
- VIM编译器显示TAB和TAB转换为空格
- 不喜欢 IDE?试试看 grepgitvi
- 菜鸟说给菜鸟听之VIM--入门篇(1)
- 如何重装TCP/IP协议
- Windows 8 官方高清壁纸欣赏与下载
- 谁是桌面王者?Win PK Linux三大镇山之宝
- 对《大家都在点赞 Windows Terminal,我决定给你泼一盆冷水》一文的商榷
- Windows Clang开发环境备忘
- cygwin下vim方向键不好用的解决方案
- 从Windows系统下访问Linux分区相关软件
- 对《大家都在点赞 Windows Terminal,我决定给你泼一盆冷水》一文的商榷
- Windows下搭建本地SVN服务器
- 安装使用Ubuntu之vim必须知道的细节
- [游戏资讯]《极品飞车16:亡命狂飙》配置需求公布
- Visual Studio 2012 示例代码浏览器 - 数以千计的开发示例近在手边,唾手可得
- Visual Studio 2012 示例代码浏览器 - 数以千计的开发示例近在手边,唾手可得
- 微软镜像下载
- windows server域用户提升到本地更高权限组中的方法