https://www.ostechnix.com/manage-vim-plugins-using-vundle-linux
Vim, undoubtedly, is one of the powerful
and versatile tool to manipulate text files, manage the system
configuration files and writing code. The functionality of Vim can be
extended to different levels using plugins. Usually, all plugins and
additional configuration files will be stored in ~/.vim
directory. Since all plugin files are stored in a single directory, the
files from different plugins are mixed up together as you install more
plugins. Hence, it is going to be a daunting task to track and manage
all of them. This is where Vundle comes in help. Vundle, acronym of Vim Bundle, is an extremely useful plug-in to manage Vim plugins.
Vundle creates a separate directory tree for each plugin you install
and stores the additional configuration files in the respective plugin
directory. Therefore, there is no mix up files with one another. In a
nutshell, Vundle allows you to install new plugins, configure existing
plugins, update configured plugins, search for installed plugins and
clean up unused plugins. All actions can be done in a single keypress
with interactive mode. In this brief tutorial, let me show you how to
install Vundle and how to manage Vim plugins using Vundle in GNU/Linux.
Clone Vundle GitHub repository:
To tell vim to use the new plugin manager, we need to create ~/.vimrc file. This file is required to install, update, configure and remove plugins.
The lines which are marked as “required” are Vundle’s requirement.
The rest of the lines are just examples. You can remove those lines if
you don’t want to install that specified plugins. Once you finished,
type :wq to save and close file.
Finally, open vim:
A new split window will open and all the plugins which we added in the .vimrc file will be installed automatically.
When the installation is completed, you can delete the buffer cache and close the split window by typing the following command:
First, search for the available plugins using command:
You can also narrow down your search by using directly specifying the name of the plugin like below.
You can, of course, specify the exact plugin name like below.
Similarly, install all plugins you wanted to have in your system. Once installed, delete the Vundle buffer cache using command:
To do so, type:
Please note that all of your Plugins must be added before the following line in your .vimrc file.
To list installed plugins, type the following from the vim editor:
Update plugins
To update the all installed plugins, type:
First, list out all installed plugins:
Then, edit your .vimrc file:
Alternatively, you can uninstall a plugin by removing its line from .vimrc file and run:
At this point, you should have learned the basic usage about managing plugins using Vundle. For details, refer the help section by typing the following in your vim editor.
Also Read:
And, that’s all for now. I will be soon here with another useful guide. Until then, stay tuned with OSTechNix!
Cheers!
Resource:
Installing Vundle
If you need Vundle, I assume you have already installed vim on your system. If not, install vim and git (to download vundle). Both packages are available in the official repositories of most GNU/Linux distributions.For instance, you can use the following command to install these packages on Debian based systems.sudo apt-get install vim gitDownload Vundle
Clone Vundle GitHub repository:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vimConfigure Vundle
To tell vim to use the new plugin manager, we need to create ~/.vimrc file. This file is required to install, update, configure and remove plugins.
vim ~/.vimrcPut the following lines on the top of this file:
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
Finally, open vim:
vimAnd type the following to install the plugins.
:PluginInstall
A new split window will open and all the plugins which we added in the .vimrc file will be installed automatically.
When the installation is completed, you can delete the buffer cache and close the split window by typing the following command:
:bdeleteYou can also install the plugins without opening vim using the following command from the Terminal:
vim +PluginInstall +qallFor those using the fish shell, add the following line to your .vimrc file.
set shell=/bin/bash
Manage Vim Plugins Using Vundle
Add New PluginsFirst, search for the available plugins using command:
:PluginSearchTo refresh the local list from the from the vimscripts site, add “!” at the end.
:PluginSearch!A new split window will open list all available plugins.
You can also narrow down your search by using directly specifying the name of the plugin like below.
:PluginSearch vimThis will list the plugin(s) that contains the words “vim”
You can, of course, specify the exact plugin name like below.
:PluginSearch vim-dasmTo install a plugin, move the cursor to the correct line and hit “i”. Now, the selected plugin will be installed.
Similarly, install all plugins you wanted to have in your system. Once installed, delete the Vundle buffer cache using command:
:bdeleteNow the plugin is installed. To make it autoload correctly, we need to add the installed plugin name to .vimrc file.
To do so, type:
:e ~/.vimrcAdd the following line.
[...] Plugin 'vim-dasm' [...]Replace vim-dasm with your plugin name. Then, hit ESC key and type :wq to save the changes and close the file.
Please note that all of your Plugins must be added before the following line in your .vimrc file.
[...] filetype plugin indent onList installed Plugins
To list installed plugins, type the following from the vim editor:
:PluginList
Update plugins
To update the all installed plugins, type:
:PluginUpdateTo reinstall all plugins, type:
:PluginInstall!Uninstall plugins
First, list out all installed plugins:
:PluginListThen place the cursor to the correct line, and press “SHITF+d”.
Then, edit your .vimrc file:
:e ~/.vimrcAnd delete the Plugin entry. Finally, type :wq to save the changes and exit from vim editor.
Alternatively, you can uninstall a plugin by removing its line from .vimrc file and run:
:PluginCleanThis command will remove all plugins which are no longer present in your .vimrc but still present the bundle directory.
At this point, you should have learned the basic usage about managing plugins using Vundle. For details, refer the help section by typing the following in your vim editor.
:h vundle
Also Read:
And, that’s all for now. I will be soon here with another useful guide. Until then, stay tuned with OSTechNix!
Cheers!
Resource:
No comments:
Post a Comment