Vim的安装与使用
条评论Vim
Vim的配置以spf-13为例子
项目地址: https://github.com/spf13/spf13-vim
Vim的安装
- Linux, *nix, Mac OSX Installation
The easiest way to install spf13-vim is to use our automatic installer by simply copying and pasting the following line into a terminal. This will install spf13-vim and backup your existing vim configuration. If you are upgrading from a prior version (before 3.0) this is also the recommended installation.
Requires Git 1.7+ and Vim 7.3+
1 | curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh |
If you have a bash-compatible shell you can run the script directly:1
sh <(curl https://j.mp/spf13-vim3 -L)
此过程会比较长,包括插件的下载还有安装,这个过程将近1个多小时
- Installing on Windows
On Windows and *nix Git and Curl are required. Also, if you haven’t done so already, you’ll need to install Vim. The quickest option to install all three dependencies (Git, Curl, Vim and spf13-vim) is via Chocolatey NuGet. After installing Chocolatey, execute the following commands on the command prompt:
Install with cmd.exe(run as admin mode)1
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
1 | C:\> choco install spf13-vim |
一直Y,整个过程大概2h左右
Vim插件的介绍
Vundle is an excellent system built on the same principles as Pathogen, but with an integrated plugin management system that is Git and Github aware.
spf13-vim uses the Vundle plugin management system to have a well organized vim directory (Similar to mac’s app folders). Vundle also ensures that the latest versions of your plugins are installed and makes it easy to keep them up to date.
NERDTree is a file explorer plugin that provides “project drawer” functionality to your vim editing. You can learn more about it with :help NERDTree or checkout my post on NERDTree.
Use Ctrl+e
to toggle NERDTree
Ctrlp replaces the Command-T plugin with a 100% viml plugin. It provides an intuitive and fast mechanism to load files from the file system (with regex and fuzzy find), from open buffers, and from recently used files.
Use Ctrl+p
to toggle Ctrlp
NeoComplCache is an amazing autocomplete plugin with additional support for snippets. It can complete simulatiously from the dictionary, buffer, omnicomplete and snippets. This is the one true plugin that brings Vim autocomplete on par with the best editors.
Use Ctrl+n
to toggle neocomplcache
spf13-vim includes the Tagbar plugin. This plugin requires exuberant-ctags and will automatically generate tags for your open files. It also provides a panel to navigate easily via tags
Use ,tt
to toggle neocomplcache
关于在Mac端ctags无效的解决方法
https://github.com/universal-ctags/ctags
https://github.com/universal-ctags/homebrew-universal-ctags
在Windows端,如果想切换到别的盘符进行操作的话,使用
:NERDTree D:\\
进行目录的跳转
Preview: To preview markdown format you need to install bluecloth gem
在使用previewMarkdown的时候出现了Preview: To preview markdown format you need to install bluecloth gem
解决方法:
sudo gem install redcarpet
sudo gem install bluecloth
Linux出现的问题
can’t find header files for ruby at /usr/lib/ruby/include/ruby.h
解决方法:sudo apt-get install ruby-dev
提示找不到tag文件
1 | 用法: |
窗口切换快捷键
Ctrl+w+w
关闭分屏
1 | 关闭当前窗口。 |
打开多个窗口了之后,怎么快速切换
:buffers 列表 :bn下一个 :bp 上一个 :b17
取消查找遗留的边框
1 | set: nohlseach |
发现更多更好玩的,欢迎关注我的微信公众号: FullStacker
![](/img/fullstacker.jpg)