From TextMate to MacVim: Vim installation

本文分成两部分,前半部分介绍用macports安装terminal版本的vim,后半部分介绍gui版本的MacVim的安装,一般不推荐在macports里面安装vim的gui variants,想象一下编译的时间…… [MacPorts Vim Installation] MacPorts的Vim 3天前刚刚更新到7.3.3,为了安装最新的版本,我们需要首先更新同步一下macports的port file tree: [cc lang=”bash”] $ sudo port -v selfupdate [/cc] 安装之前先查看一下这个Vim包的variants: [cc lang=”bash”] $ port variants vim [/cc] [cc lang=”bash” height=”250px”] vim has the variants: athena: Build GUI version using Athena widgets conflicts with gtk1 gtk2 motif requires x11 big: Build big feature set conflicts with small tiny cscope: Enable source code browsing with cscope gtk1: Build GUI version using GTK 1.x widgets conflicts with athena gtk2 motif requires x11 gtk2: Build GUI version using GTK 2.x widgets conflicts with athena gtk1 motif requires x11 huge: Build huge feature set conflicts with big small tiny motif: Build GUI version with Motif widgets conflicts with athena gtk1 gtk2 requires x11 nls: National Language Support perl: Enable Perl scripting python: Compatibility variant, requires +python25 requires python25 python25: Enable Python scripting conflicts with python26 python27 python31 python26: Enable Python scripting conflicts with python25 python27 python31 python27: Enable Python scripting conflicts with python25 python26 python31 python31: Enable Python scripting conflicts with python25 python26 python27 ruby: Enable Ruby scripting small: Build small feature set conflicts with tiny tcl: Enable Tcl scripting tiny: Build tiny feature set universal: Build for multiple architectures x: Compatibility variant, requires +x11 * requires x11 x11: Build CLI version with X support xim: Build with support for X Input Method [/cc] 可见其variants还真不少,光gui的variant就有4个:athena, gtk1, gtk2, motif,考虑到过长的编译时间以及稍后我们便会安装更mac friendly的MacVim,所以这儿我们不装任何的gui variant。另外由于我本机已经安装过python 2.6的macports,同理为了减少编译工作量和编译时间我这儿选择了python26的variant: [cc lang=”bash”] $ sudo port -v install vim +huge +nls +perl +ruby +python26 [/cc] 接下来便是长时间的下载和编译时间,cpu会很忙,泡杯咖啡,稍后继续…… [MacVim Installation] ok,let’s go on. 上周macvim刚刚update到了7.3,如果你装的还是7.2的那么是时候更新了,7.3带来了persistent undo, relative number, color column, conceal text等等new features,以后有机会我们会慢慢介绍。 下载并解压: [cc lang=”bash”] $ wget http://github.com/downloads/b4winckler/macvim/MacVim-7\_3-53.tbz $ tar xjvf MacVim-7_3-53.tbz [/cc] 安装MacVim.app到Applications,当然在Finder里面拖拽可能更符合mac安装app的习惯,不过anyway…: [cc lang=”bash”] $ cd MacVim-7_3-53 $ sudo mv MacVim.app /Applications/ [/cc] 同TextMate的mate类似,MacVim也提供了一个命令行启动的脚本mvim,一并安装之并建立一些symbol link给mvimdiff, mview等utility: [cc lang=”bash”] $ sudo cp -f mvim /usr/local/bin/mvim [/cc] [cc lang=”bash”] $ sudo ln -s mvim /usr/local/bin/mvimdiff $ sudo ln -s mvim /usr/local/bin/mview $ sudo ln -s mvim /usr/local/bin/mex $ sudo ln -s mvim /usr/local/bin/rmvim [/cc] 以上安装已基本完成,下面是MacVim附带的一些配置,和vim本身的配置无多大关系,所以一并提供在此: 我希望最大化按钮work as I expected: [cc lang=”bash”] $ defaults write org.vim.MacVim MMZoomBoth 1 [/cc] 我有鼠标,虽然很山寨,但也有3个button,所以请把Ctrl键还给我,以后我们还要用Ctrl+LeftMouse来访问tag stack的: [cc lang=”bash”] $ defaults write org.vim.MacVim MMTranslateCtrlClick 0 [/cc] 还有一些MacVim的特有配置可以放到vimrc里去,所以我们以后聊到vimrc的时候再说不迟。

Buy me a coffee
  • Post author: Samson Wu
  • Post link: 2164.html
  • Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally.
0%