日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

如何在 Linux 上使用 Vundle 管理 Vim 插件

發布時間:2024/9/15 linux 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 如何在 Linux 上使用 Vundle 管理 Vim 插件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

毋庸置疑,Vim 是一款強大的文本文件處理的通用工具,能夠管理系統配置文件和編寫代碼。通過插件,Vim 可以被拓展出不同層次的功能。通常,所有的插件和附屬的配置文件都會存放在 ~/.vim 目錄中。由于所有的插件文件都被存儲在同一個目錄下,所以當你安裝更多插件時,不同的插件文件之間相互混淆。因而,跟蹤和管理它們將是一個恐怖的任務。然而,這正是 Vundle 所能處理的。Vundle,分別是 Vim 和 Bundle 的縮寫,它是一款能夠管理 Vim 插件的極其實用的工具。

Vundle 為每一個你安裝的插件創建一個獨立的目錄樹,并在相應的插件目錄中存儲附加的配置文件。因此,相互之間沒有混淆的文件。簡言之,Vundle 允許你安裝新的插件、配置已有的插件、更新插件配置、搜索安裝的插件和清理不使用的插件。所有的操作都可以在一鍵交互模式下完成。在這個簡易的教程中,讓我告訴你如何安裝 Vundle,如何在 GNU/Linux 中使用它來管理 Vim 插件。
Vundle 安裝

如果你需要 Vundle,那我就當作你的系統中,已將安裝好了 Vim。如果沒有,請安裝 Vim 和 git(以下載 Vundle)。在大部分 GNU/Linux 發行版中的官方倉庫中都可以獲取到這兩個包。比如,在 Debian 系列系統中,你可以使用下面的命令安裝這兩個包。

sudo apt-get install vim git

下載 Vundle

復制 Vundle 的 GitHub 倉庫地址:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

配置 Vundle

創建 ~/.vimrc 文件,以通知 Vim 使用新的插件管理器。安裝、更新、配置和移除插件需要這個文件。

vim ~/.vimrc

在此文件頂部,加入如下若干行內容:

set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.org/vim/scripts.html " Plugin 'L9' " Git plugin not hosted on GitHub Plugin 'git://git.wincent.com/command-t.git' " git repos on your local machine (i.e. when working on your own plugin) Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " Install L9 and avoid a Naming conflict if you've already installed a " different version somewhere else. " Plugin 'ascenator/L9', {'name': 'newL9'} " 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 - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line

被標記為 “required” 的行是 Vundle 的所需配置。其余行僅是一些例子。如果你不想安裝那些特定的插件,可以移除它們。完成后,鍵入 :wq 保存退出。

最后,打開 Vim:

vim

然后鍵入下列命令安裝插件:

:PluginInstall

將會彈出一個新的分窗口,我們加在 .vimrc 文件中的所有插件都會自動安裝。

安裝完畢之后,鍵入下列命令,可以刪除高速緩存區緩存并關閉窗口:

:bdelete

你也可以在終端上使用下面命令安裝插件,而不用打開 Vim:

vim +PluginInstall +qall

使用 fish shell 的朋友,添加下面這行到你的 .vimrc 文件中。

set shell=/bin/bash

使用 Vundle 管理 Vim 插件
添加新的插件

首先,使用下面的命令搜索可以使用的插件:

:PluginSearch

要從 vimscripts 網站刷新本地的列表,請在命令之后添加 !。

:PluginSearch!

會彈出一個列出可用插件列表的新分窗口:

你還可以通過直接指定插件名的方式,縮小搜索范圍。

:PluginSearch vim

這樣將會列出包含關鍵詞 “vim” 的插件。

當然你也可以指定確切的插件名,比如:

:PluginSearch vim-dasm

移動焦點到正確的一行上,按下 i 鍵來安裝插件。現在,被選擇的插件將會被安裝。

類似的,在你的系統中安裝所有想要的插件。一旦安裝成功,使用下列命令刪除 Vundle 緩存:

:bdelete

現在,插件已經安裝完成。為了讓插件正確的自動加載,我們需要在 .vimrc 文件中添加安裝好的插件名。

這樣做:

:e ~/.vimrc

添加這一行:

[...] Plugin 'vim-dasm' [...]

用自己的插件名替換 vim-dasm。然后,敲擊 ESC,鍵入 :wq 保存退出。

請注意,所有插件都必須在 .vimrc 文件中追加如下內容。

[...] filetype plugin indent on

列出已安裝的插件

鍵入下面命令列出所有已安裝的插件:

:PluginList

更新插件

鍵入下列命令更新插件:

:PluginUpdate

鍵入下列命令重新安裝所有插件:

:PluginInstall!

卸載插件

首先,列出所有已安裝的插件:

:PluginList

之后將焦點置于正確的一行上,按下 SHITF+d 組合鍵。

然后編輯你的 .vimrc 文件:

:e ~/.vimrc

刪除插件入口。最后,鍵入 :wq 保存退出。

或者,你可以通過移除插件所在 .vimrc 文件行,并且執行下列命令,卸載插件:

:PluginClean

這個命令將會移除所有不在你的 .vimrc 文件中但是存在于 bundle 目錄中的插件。

你應該已經掌握了 Vundle 管理插件的基本方法了。在 Vim 中使用下列命令,查詢幫助文檔,獲取更多細節。

:h vundle

干杯!

轉載自:
https://linux.cn/article-9416-1.html

總結

以上是生活随笔為你收集整理的如何在 Linux 上使用 Vundle 管理 Vim 插件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。