Vundle - 插件已安装但未加载

Vundle - 插件已安装但未加载

我已经在我的 ubuntu 机器上安装了 vundle,但是当我加载 vim 时,没有任何插件加载。我的 vimrc:

runtime! debian.vim
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
"set rtp+=~/.vim/bundle
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'reedes/vim-thematic'
Plugin 'bling/vim-airline'

" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList          - list configured plugins
" :PluginInstall(!)    - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!)      - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line









" """""""""""""""""""""""""""""""""""""ORIGINAL STUFF BELOW"""""""



" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below.  If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
" runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
"if has("syntax")
syntax on
set number
set ruler
"endif

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on
"endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd        " Show (partial) command in status line.
"set showmatch      " Show matching brackets.
"set ignorecase     " Do case insensitive matching
"set smartcase      " Do smart case matching
"set incsearch      " Incremental search
"set autowrite      " Automatically save before commands like :next and :make
"set hidden     " Hide buffers when they are abandoned
"set mouse=a        " Enable mouse usage (all modes)

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

:PluginList 输出...

" My Plugins                        
Plugin 'gmarik/Vundle.vim'                                           
Plugin 'reedes/vim-thematic'                                          
Plugin 'bling/vim-airline' 

我没有改变任何其他设置,这是我第一次尝试使用 Vim 插件。

答案1

  1. 永远不要做任何事情/etc/vim

    • 因为 Vim 遵循严格的加载顺序,因此,对默认文件和目录进行干扰会使 Vim 不稳定。您执行的一些操作可能有效,其他操作则可能无效……这完全取决于您和您的运气。

    • 因为后续升级将覆盖您的部分或全部更改,使它们变得毫无意义。

    • 因为这是惯例良好做法每一个操作系统——当然,在现实生活中也是如此——你的配置你的 $HOME

  2. 你必须~/.vim/自己创造~/.vimrc

    由于 Vim 运行良好,因此它不会任何事物$HOME安装时。它是你的负责创建定制所需的文件和目录:

    $ cd
    $ mkdir .vim
    $ touch .vimrc
    

    此时,您应该有一个空~/.vim目录和一个空~/.vimrc文件。您似乎已经有一个~/.vim/目录,因此您可以跳过该步骤。

  3. 恢复/etc/vim其原始状态。

    删除您添加到 的所有内容/etc/vim。如果不确定,卸载并重新安装 vim-gnome 或 vim-gtk 包应该会有所帮助。

  4. 中重新进行所有配置$HOME

    如果你坚持使用 Vundle,那么你的~/.vimrc外观应该是这样的:

    filetype off
    
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    
    Plugin 'gmarik/Vundle.vim'
    Plugin 'reedes/vim-thematic'
    Plugin 'bling/vim-airline'
    
    call vundle#end()
    
    filetype plugin indent on
    
  5. 实际安装您的插件。

    将您的内容写入~/.vimrc磁盘并退出 Vim:

    :wq
    

    并发出以下命令:

    $ vim +PluginInstall
    

作为 Vim 的新用户,您应该找到更有效的方式来利用您的时间和脑细胞,而不是使用同样无意义的插件管理器来尝试安装无意义的插件,特别是如果您对 UNIX 命令行不太了解。以下是一份非详尽的建议列表:

  • 熟悉命令行和 UNIX 方式,
  • 至少关注$ vimtutor几次,
  • 阅读前 30 行左右:help并记住它们,因为它们是你学到的最有用的 Vim 命令,
  • 至少读:help usr_01.txt一遍:help usr_08.txt

直到您对整个事情感到更加满意为止,我建议您远离插件(和不必要的插件管理器),以便您可以专注于 Vim 本身。

相关内容