出于某种原因,我似乎无法获得vim-ruby来设置Gemfile的语法。其他功能,如ctrl-x + ctrl-o工作,所以我知道它已正确安装(通过vundle)。
我的.vimrc
如图所示:
" use syntax highlighting
syntax on
" make backspace do what it should
"set backspace=eol,start,indent
" set tab = 4 spaces
set expandtab
set sw=2
set sts=2
set ts=2
" set tab = 2 spaces if ruby file
"autocmd Filetype ruby setlocal ts=2 sts=2 sw=2
" fix splitting from opening in the wrong place
set splitright
set splitbelow
" fix auto-indent pasting
set paste
" use the mouse
set ttyfast
set mouse=a
set ttymouse=xterm2
"" Vundle
set nocompatible
"filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-rails'
Bundle 'scrooloose/nerdtree'
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
Bundle 'tpope/vim-markdown'
Bundle 'vim-ruby/vim-ruby'
filetype plugin indent on
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
"" End Vundle
" NerdTree
autocmd vimenter * if !argc() | NERDTree | endif
" gist-vim
let g:gist_detect_filetype = 1
let g:gist_post_private = 1
" vim-ruby
filetype on
filetype indent on
filetype plugin on
:scriptnames
显示:
1: /usr/share/vim/vimrc
2: /Users/bswinnerton/.vimrc
3: /usr/share/vim/vim73/syntax/syntax.vim
4: /usr/share/vim/vim73/syntax/synload.vim
5: /usr/share/vim/vim73/syntax/syncolor.vim
6: /usr/share/vim/vim73/filetype.vim
7: /Users/bswinnerton/.dotfiles/vim/bundle/vundle/autoload/vundle.vim
8: /Users/bswinnerton/.dotfiles/vim/bundle/vundle/autoload/vundle/config.vim
9: /usr/share/vim/vim73/ftplugin.vim
10: /usr/share/vim/vim73/indent.vim
11: /Users/bswinnerton/.dotfiles/vim/bundle/vim-rails/plugin/rails.vim
12: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/plugin/NERD_tree.vim
13: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/autoload/nerdtree.vim
14: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/path.vim
15: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/menu_controller.vim
16: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/menu_item.vim
17: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/key_map.vim
18: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/bookmark.vim
19: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/tree_file_node.vim
20: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/tree_dir_node.vim
21: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/opener.vim
22: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/lib/nerdtree/creator.vim
23: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/nerdtree_plugin/exec_menuitem.vim
24: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim
25: /Users/bswinnerton/.dotfiles/vim/bundle/gist-vim/plugin/gist.vim
26: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
27: /usr/share/vim/vim73/plugin/gzip.vim
28: /usr/share/vim/vim73/plugin/matchparen.vim
29: /usr/share/vim/vim73/plugin/netrwPlugin.vim
30: /usr/share/vim/vim73/plugin/rrhelper.vim
31: /usr/share/vim/vim73/plugin/spellfile.vim
32: /usr/share/vim/vim73/plugin/tarPlugin.vim
33: /usr/share/vim/vim73/plugin/tohtml.vim
34: /usr/share/vim/vim73/plugin/vimballPlugin.vim
35: /usr/share/vim/vim73/plugin/zipPlugin.vim
36: /Users/bswinnerton/.dotfiles/vim/bundle/nerdtree/syntax/nerdtree.vim
答案 0 :(得分:3)
不要评论filetype off
。
如果您系统上安装的Vim已经自行filetype on
,则需要这样做。这可以防止您通过操纵运行时路径的插件管理器添加自己的ftdetect脚本。
有关详细信息,请参阅答案Why vundle requires filetype off和filetype on or filetype off?。