1

出于某种原因,我似乎无法让 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
4

1 回答 1

3

不要注释掉filetype off

如果您的系统上安装的 Vimfiletype on本身已经安装了它,则它是必需的。这可以防止您通过操纵运行时路径的插件管理器添加自己的 ftdetect 脚本。

查看答案为什么 vundle 需要关闭文件类型和打开文件类型或关闭文件类型?了解更多信息。

于 2013-08-06T15:36:25.990 回答