`

vim安装command-t插件

 
阅读更多
commnad-t是一个很好的vim插件

安装的步骤似乎很简单,下载最新版本的commnad-t,进入到.vim目录
一次执行:
vim command-t-1.4.vba
:so %
cd ~/.vim/ruby/command-t 
ruby extconf.rb 
make 


但是我这里编译出现了问题

问题一
/usr/include/ruby/intern.h:412:1: error: unknown type name ‘fd_set’
 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
 ^
make: *** [ext.o] Error 1


问题原因是编译中依赖的一些c库,有问题,在网上查了很多资料,最后升级ruby版本解决
rvm upgrade 1.9.2-p136 1.9.2-p180



问题二
command-t.vim requires Vim to be compiled with Ruby support


通过 vim --version
可以看到 字符串中赫然显示着 -ruby 这说明vim没有ruby的安装依赖

引用

One of my favourite plugins for Vim is Command-T:
an extremely fast, intuitive mechanism for opening files with a minimal number of keystrokes. It’s named “Command-T” because it is inspired by the “Go to File” window bound to Command-T in TextMate.
Sadly, the default installation of Vim on Snow Leopard does not have support for the ruby interpreter compiled in, which is a pre-requisite for using the plugin. Luckily, that’s easy enough to remedy, and in the process we’ll learn a thing or two about compiling your own custom Vim binary.

Let’s start off by getting the source code from the official Mercurial repository:

$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim

(Note: You don’t need to use the Mercurial repository – there are mirror sources for Subversion, CVS, as well as good ol’ tarballs with patches.)

The default branch for the mercurial repository contains the code for Vim 7.2 at the time of this writing. There is also a vim73 branch available for those feeling a bit more adventurous and wishing to compile the beta release of the next version. For this article, we’ll be sticking to the stable 7.2 release in the default branch.

Now, let’s take a look at the possible configuration options:

$ ./configure --help

There are quite a few, and I suggest that you take the time to read through them – most are quite self-explanatory. For Command-T, the one that we are interested in is the

--enable-rubyinterp
option.

So let’s take a shot at the simplest installation for terminal-based Vim usage, one without the GUI interface and (Linux) mouse daemon support:

$ ./configure --prefix=/my/install/prefix --enable-rubyinterp --enable-gui=no --disable-gpm
$ make

After the compilation process finishes (presumably with no errors), the first thing you’ll want to do is ensure that the binary you just built functions as expected:

$ ./src/vim --version | grep ruby
# you should see a `+ruby` line entry
$ ./src/vim

If you see the +ruby entry in the –version output and the binary launches without any errors, rejoice in your own awesomeness. That’s all there is to it.

If, however, you see something similar to this:

Vim: Caught deadly signal SEGV
Vim: Finished.
zsh: segmentation fault  ./src/vim
you’ve probably fallen prey to a (currently) not very well documented issue: Vim 7.2 does not support the integration of Ruby 1.9.x on Snow Leopard.

This means that if you’ve used a package manager such as Homebrew, MacPorts or Fink (shudder) to install the latest version of Ruby, Vim will link to that latest version instead of the system default installation of ruby 1.8.7.

Let’s fix that.

We’re going to edit the src/auto/config.mk generated by configure that was run earlier. Note that if you re-run configure at a later time, your changes to config.mk will be lost.

Find the lines that look like this:

RUBY            = /usr/local/bin/ruby
RUBY_SRC        = if_ruby.c
RUBY_OBJ        = objects/if_ruby.o
RUBY_PRO        = if_ruby.pro
RUBY_CFLAGS     = -I/usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1 -I/usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1/i386-darwin10.4.0 -DRUBY_VERSION=19
RUBY_LIBS       = -lruby -lpthread -ldl -lobjc

(Note: Your specific paths and/or versions may differ depending on the package manager that you are using. The above paths are actually not important, however, since we actually want to reset them to the system defaults.)

and replace them with the following:

RUBY            = /usr/bin/ruby
RUBY_SRC        = if_ruby.c
RUBY_OBJ        = objects/if_ruby.o
RUBY_PRO        = if_ruby.pro
RUBY_CFLAGS     = -I/System/Library/Frameworks/Ruby.framework/Versions/1.8 -I/usr/lib/ruby/1.8/universal-darwin10.0
RUBY_LIBS       = -framework Ruby

Alright, let’s see if this worked.

$ make clean && make

Before we check the binary as we did before, let’s see if we linked to the correct ruby libraries:

$ otool -L src/vim
src/vim:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
    /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.29.0)

Looking good so far – the binary is linked to the framework version of Ruby that comes as a default on Snow Leopard.

Let’s do a version check:

$ ./src/vim --version | grep ruby
# you should see a `+ruby` line entry
$ ./src/vim

And voilà: A custom-built Vim with ruby integration that will happily run the Command-T plugin.

All that’s left is to install it:

$ make install

Assuming your PATH is setup to correctly find the new Vim binary, you should be all set.


http://nerderati.com/2010/07/compiling-vim-with-ruby-integration-on-snow-leopard/
分享到:
评论

相关推荐

    command-t::keyboard_selector:VIM的快速文件导航

    Command-T Command-T是Vim插件,为以下应用程序提供了非常快速的“模糊”机制: 打开文件和缓冲区跳转到标签和帮助运行命令或先前的搜索和命​​令只需最少的击键次数。 通过键入出现在文件路径中的字符来选择文件,...

    Vim-for-Rails:这是使用vim开发Ruby on Rails的出色配置文件

    您只需要Command-t插件的ruby支持。 因此,您可以删除+ ruby​​以在不支持ruby的情况下安装它: 然后添加配置文件: git clone git://github.com/framallo/Vim-for-Rails.git〜/ .vim cd ~/.vimgit

    完美版vim配置,内含经典插件,用着绝对舒适。

    4. **command-t**:Command-T是Vim的一个非常受欢迎的插件,它通过模糊匹配快速打开文件。只需输入文件名的一部分,就可以迅速定位并打开文件,极大地提高了文件查找的效率。 5. **nerdtree**:NerdTree是Vim中的...

    dot-vim:我的 VIM 配置和插件

    $ cd ~ /.vim/bundle-available/command-t/ruby/command-t $ ruby extconf.rb $ make 空格与制表符 默认情况下启用制表符间距。 如果您想在项目上切换到空格,请在项目的根路径上创建一个.lvimrc文件,其内容如下: ...

    vim配置,包含自己写的说明,很全,很好用

    vcscommand.zip 是 vim 的版本控制 (咱们用的是 svn) 插件, 提供一些方便的辅助功能. 在 gvim 中它会提供一项菜单, 另外也提供快捷键来直接访问 安装与使用请参考它的说明文件 另外建议安装 ctags 与 cscope, 通过...

    基于amix.dk的Vimrc VIM插件包

    基于amix.dk/vim/vimrc.txt制作的插件包,包括以下插件。 1. vimwiki 2. snipMate 3. vimgtd 4. taglist 5. nerdcommenter 6. DoxygenToolkit 7. mark 8. omnicppcomplete 9. authorinfo 10. a 11. pyflakes 12. ...

    vim-ginkgo-runner:一个简单的银杏测试跑步者

    map <Leader>t :call RunCurrentGinkgoFile() map <Leader>s :call RunNearestGinkgo() map <Leader>l :call RunLastGinkgo() map <Leader>a :call RunAllGinkgo() 自定义命令 覆盖g:ginkgo_command变量以...

    vim.config.2014.03.07.zip

    综上所述,这个压缩包包含了一个完善的Vim配置环境,用户不仅可以根据个人需求调整Vim的行为,还能够利用预装的Command-T、NerdTree和vim-powerline插件提高工作效率。对于初学者,这是一份很好的学习资源,可以帮助...

    vim插件打包

    vim中~/.vim 插件打包 ./vimrc文件内容为 "允许鼠标的使用,防止linux终端下无法拷贝 if has('mouse') set mouse=a endif au GUIEnter * simalt ~x "字体的设置 set guifont=Bitstream_Vera_Sans_Mono:h9:cANSI...

    vim_runtime包

    Linux下vim集成环境,集成了常用插件.直接解压到宿主目录即可用. 以下是插件列表 acp a bufexplorer command-t c DoxygenToolkit fuf JavascriptLint jsbeautify minibufexpl mru NERD_commenter NERD_tree peepopen ...

    vim的python调试器.doc

    要在Vim中使用Python调试器,首先需要确保您的系统已安装Python,并且Vim支持Python插件。以下是在`.vimrc`文件中添加配置代码来启用Python调试功能的具体步骤: 1. **打开Vim配置文件**:在命令行输入 `vim ~/....

    dotvim-legacy:Hanfei Shen's dotvim files

    沉涵飞的dotvim文件安装 git clone https://github.com/qqshfox/dotvim.git ~/.vimcd ~/.vimmake install依赖关系维姆 7.3 支持 ruby​​ 的 Ruby 和 Vim 7.3 (+ruby)(可选):Command-T 和 Lusty 需要这些更新中 ...

    程序员的编辑器--VIM[定义].pdf

    VIM的配置和扩展性极强,用户可以根据个人习惯定制快捷键,安装插件,实现更多功能。例如,通过安装插件可以实现代码高亮、自动补全、语法检查等。VIM的命令帮助系统也非常完善,用户只需输入`:help`加命令名称即可...

    vim-recipes

    - 安装如fugitive.vim这样的插件以获得更好的Git集成。 #### Vim的其他用途 ##### 浏览目录 - 使用`:e <directory>`浏览目录。 - 使用`:ls`列出当前目录中的文件。 ##### 使用Vim作为文件管理器 - 使用`:cd ...

    Vim思维导图

    Vim拥有多模式工作方式,主要包含普通模式(Normal mode)、插入模式(Insert mode)、可视模式(Visual mode)、命令行模式(Command-line mode)等。下面,我们就按照给定文件中的内容,总结一些Vim的基本功能和...

    vim-config:我自己的vim配置

    接着,个人vim配置往往包括插件管理器的安装,如Vundle或Pathogen,它们简化了插件的安装和更新。这里假设使用Vundle,我们需要在.vimrc中添加`Plugin 'VundleVim/Vundle.vim'`来安装Vundle。然后,可以列出想要安装...

    vim 经典之作,值得学习

    - **丰富的插件生态**:大量的插件支持让vim的功能几乎可以无限扩展,无论是代码高亮、语法检查还是版本控制集成,都能找到相应的解决方案。 - **跨平台兼容性**:vim可以在多种操作系统上运行,包括Linux、macOS和...

Global site tag (gtag.js) - Google Analytics