cabin

Source code for personal website
git clone git://git.dimitrijedobrota.com/cabin.git
Log | Files | Refs | README | LICENSE

VimPugins.md (5822B)


0 @title: Vim Plugins - Installation guide
1 @language: en
2 @date: 2021-08-19
3 @categories: linux, vim
5 # Vim Plugins - Installation guide
7 In preparation for 'Vim Showcase' series, were I'll be showcasing plugins and other vim tricks, I've decided to dedicate this short
8 article to the process of setting up vim for installing plugins, as a reference to those of you who haven't done it already.
10 Vim is a great tool with a lot of amazing features that come out of the box.
11 Sometimes, though, a little push is needed to take the experience to a whole new level.
13 This article expects the readers to be familiar with running basic commands in
14 the terminal as well as basic vim knowledge including running vim commands.
17 ## Introduction
19 - _What are vim plugins_?<br>
20 Vim plugins are, in essence, scripts that are used to add new features to the
21 editor or extend the already existing ones
22 - _What are plugins used for_?<br>
23 Plugins are used to bring anything from color schemes to providing full fledged IDE-like features to vim editor.
24 - _How are vim plugins written?_<br>
25 Vim plugins are written using Vim Script
26 - _What is Vim Script_?<br>
27 Vim Script is a language used by vim for startup files, syntax files, plugins and any other configuration of the editor<br>
28 For more info you can reference [vim help](https://vim.help/41-write-a-vim-script)
29 - _How to get vim plugins_?<br>
30 Staring from Vim 8 plugins are supported and should be placed in `~/.vim/pack/vendor/`.<br>
31 There is also a possibility of using a plugin manager to streamline the process of installing, using, updating and removing plugins
34 In this article I am going to explain how to use [Vundle](https://github.com/VundleVim/Vundle.vim), short for vim bundle, as the plugin manager
36 As taken from their help page:
38 Vundle allows you to...
40 - keep track of and configure your scripts right in the `.vimrc`
41 - install configured scripts (a.k.a. bundle)
42 - update configured scripts
43 - search by name all available Vim scripts
44 - clean unused scripts up
45 - run the above actions in a single keypress with interactive mode
47 Vundle automatically...
49 - manages the runtime path of your installed scripts
50 - regenerates help tags after installing and updating
53 ## Installing Vundle
55 In order to install Vundle `git` must be present on the system, which you can check by running:
57 git
58 bash: git: command not found
60 If you get `command not found` you will need to install it using your distribution package manager.
62 ***
64 With that out of the way, we are ready to install Vundle. All you have to do is run:
66 git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
69 After the Vundle has installed, there is a little configuration that needs to
70 be done, in order for vim to recognize Vundle and start loading the plugins
72 ## Configuring Vundle
74 Open your `vimrc` file, which will most likely be `~/.vimrc`, and paste the following boilerplate code at the beginning:
76 ```
77 set nocompatible " be iMproved, required
78 filetype off " required
80 set rtp+=~/.vim/bundle/Vundle.vim
81 call vundle#begin()
83 Plugin 'VundleVim/Vundle.vim' " leave as first item
85 " All of your Plugins must be added here
87 call vundle#end() " required
88 filetype plugin indent on " required"
89 ```
91 This code ensures that Vundle is started with vim, and to keep track of the installed plugins.
93 **Note**: As the comment in the boilerplate suggests, all of the Plugins must be added
94 after `call vundle#begin()` and before `call vundle#end()` in order for them to
95 be recognized by Vundle, and not cause error when starting vim.
98 With this out of the way, we are ready to install some plugins
101 ## Installing Plugins
104 To install a plugin from github, do the following:
106 1. Find the plugin you want to install and note the URL.<br> Example: `https://github.com/kana/vim-textobj-user`
107 2. Take the `author/name` portion of the URL.<br> In this case: `kana/vim-textobj-user`
108 3. Put `Plugin 'author/name'` in the designated area in `vimrc` file.<br> Example: `Plugin 'kana/vim-textobj-user'`
110 **Note**: To see all of the URLs supported, reference `:h vundle-plugins-uris`
112 After, we have put in the list of plugins we want, vim needs to be
113 reloaded.<br> We can do it by simply exiting and entering vim again or by running
114 `:source %` directly in vim.
116 Finally to instruct Vundle to download the necessary plugins run
117 `:PluginInstall`.<br> You will see a new window pop up on the side, with the
118 list of all the plugins, and each line will be highlighted one by one as the
119 plugin is being installed.
121 **Note**: This window can be closed like any other, using `:q` or `Ctrl + zz`.
123 After vim is restarted the plugin will be loaded and ready to use.
125 For any plugin specific configuration reference the specific usage guide.
128 ## Vundle Commands
130 For reference purposes, I will list all of the commands that are available after configuring Vundle.
132 - `:PluginInstall`: Will install all plugins configured in your `.vimrc`. Newly installed plugins will be automatically enabled.
133 - `:PluginUpdatate`: Install or update the configured plugins.
134 - `:PluginSearch`: Search [Vim Scripts](http://vim-scripts.org/vim/scripts.html) for matching plugins.
135 - `:PluginClean`: Requests confirmation for the removal of all plugins no longer configured - in your `.vimrc` but present in your bundle installation directory.
136 - `:PluginList`: Displays a list of installed bundles.
138 **Note**: For more information about any of these commands, reference `:h command`
141 ## Conclusion
143 With this one time setup out of the way, you are ready to explore the wonderful world of vim plugins.
145 Stay tuned for 'Vim Showcase' series to learn more about vim, and to discover some great vim plugins to boost your productivity.