You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
" Auto Session Save/Restorefunction!SaveSession()
if (!isdirectory('~/.vim'))
callmkdir('~/.vim')
endifexecute'mksession! ~/.vim/session.vim'endfunctionfunction!RestoreSession()
ifargc() ==0iffilereadable(expand('~/.vim/session.vim'))
execute'source ~/.vim/session.vim'ifbufexists(1)
forlinrange(1, bufnr('$'))
ifbufwinnr(l) ==-1exec'sbuffer ' . lendifendforendifelseecho'No session loaded.'endifendifendfunction"NERDTree doesn't support session, so close before savingautocmdVimLeave* :NERDTreeClose
autocmdVimLeave*callSaveSession()
autocmdVimEnter* nested callRestoreSession()
setsessionoptions-=options
对调键盘上 CapsLock键 与 Ctrl键位置
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,00,00,00,00,00
代码格式化
默认的js风格检查插件用的是standard
见文件
C:\Users\abeet.vim\bundle\syntastic\doc\syntastic-checkers.txt
let g:syntastic_javascript_checkers = ["standard"]
VIM下载地址为
http://www.vim.org/download.php
网上有一个neovim,说是vim的分支上作了很多改进,但也有人说不成熟就不用了。
下载window下的安装包,安装完后打开界面空空的,当然要去找插件了,
在github上搜索 vim distribution 会发现有一个标星非常多的项目
https://github.com/spf13/spf13-vim
安装起来要费点工夫,
http://msysgit.github.io/
先安装git的命令行工具msysgit,
下载msysgit2.x老不成功,在另外一个网站上找到
Git-1.9.2-preview20140411.exe
的下载地址,也许是因为镜像多,用迅雷下载成功。
安装过程中记得勾选安装命令行工具集。
还要装curl.exe,但我发现命令行里已经有curl.exe了,不知道是msysgit带的还是windows自带的。
按https://github.com/spf13/spf13-vim
里的说明在 git\cmd目录下新建了 curl.cmd。
执行
curl https://j.mp/spf13-vim3 -L -o - | sh
没有成功,说 HOME 找不到,只能参考curl.cmd手动设置一下HOME。
执行
curl https://j.mp/spf13-vim3 -L -o - | sh
安装 spf13-vim3 但安装到哪了我也不记得了。。
进入vim的输入
:echo $HOME
得到 home文件所在的路径C:\Users\abeet
找到
C:\Users\abeet\.spf13-vim-3
目录下的spf13-vim-windows-install.cmd
以管理员身份运行之,会有十几分钟的插件安装过程。
全部插件安装完成后,再找到gvim.exe,就发现界面已经变了,查看已安装的插件的命令是在vim里输入
:BundleList
可以看到有插件
neocomplete
,没有youcompleteme
。试写js,发现没有自动完成功能,注意到状态栏里有提示,大意是因为没有lua 导致 neocomplete 插件不能用。
又到网上搜索 neocomplete 插件的安装。
neocomplete 依赖 lua,首先 vim得用支持lua的版本。
vim里输入
:version
发现-lua
,表示不支持lua。但我又不想自己编译,就去找已经编译好的。
http://wyw.dcweb.cn/index.htm#download
http://wyw.dcweb.cn/vim/gvim80.zip
从这儿下载了新的,覆盖原来的gvim.exe vim.exe。
还有其他几个下载地址记下备用
https://github.com/vim/vim-win32-installer/releases
https://tuxproject.de/projects/vim/
新的gvim输入
:version
发现+lua/dyn
,表示支持lua。那么是否支持lua?在vim里执行lua语句测试
:lua print('asdf')
会有出错提示 因为 lua51.dll没有找到执行lua失败。又去网上找lua51.dll。百度信不过,在bing里搜索
lua51.dll
然后在http://originaldll.com/file/lua5.1.dll/22745.html
找到下载地址,下载得到 lua5.1.dll 重命名为 lua51.dll放入到 gvim.exe同一目录下,
再执行
:lua print('asdf')
成功,这时
neocomplete
插件可以用了。参考文章:
http://www.bubuko.com/infodetail-1876966.html
设置使用相对行号
设置字号,搜索guifont
设置退出时保存Session(注意经测试expand方法转换路径是必须的)
中间遇到两个问题,查了半天资料才改成下面这样,
filereadable(expand('~/.vim/session.vim'))
没有expand方法时文件读不到,并且没错误提示,很难发现这个问题
set sessionoptions-=options
文件打开后没有高亮,百度上搜索好多资料没有解决问题,甚至加脚本判断文件后缀后再
set syntax=javascript
也不好用,真到在bing上用英文搜索才找到这个页面http://stackoverflow.com/questions/9281438/syntax-highlighting-doesnt-work-after-restore-a-previous-vim-session
问题得以解决。还是得多用stackoverflow呀
对调键盘上 CapsLock键 与 Ctrl键位置
默认的js风格检查插件用的是standard
见文件
但standard对jsx的格式化可能并不好,这时我们可以使用格式化更完美的prettier
有一个配合standard的prettier格式化工具,见prettier-standard
先安装命令行工具
npm install -g prettier-standard
再在vim的配置文件.vimrc里添加
autocmd FileType javascript set formatprg=prettier-standard
The text was updated successfully, but these errors were encountered: