Skip to content

Commit 105ee3c

Browse files
authored
add info about vim plugins
1 parent 6195aac commit 105ee3c

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

linux-1/vim.md

+61-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,41 @@ nnoremap <leader>x :x<CR> " Save and exit with ,x
197197
```
198198
This means pressing **`,` followed by `w`** will save the file instead of typing `:w<CR>` manually.
199199

200-
### **Plugins & Enhancements**
200+
### **Plugins**
201+
202+
Vim plugins are add-ons that extend Vim’s functionality, providing features that aren’t available by default. They can enhance workflow, improve navigation, add syntax highlighting, and integrate with external tools. By leveraging plugins, Vim transforms into a highly customizable editor tailored to individual needs.
203+
204+
#### **Why Use Vim Plugins?**
205+
206+
- **Boost Efficiency:** Automate repetitive tasks and improve editing speed.
207+
- **Enhance Navigation:** Plugins like FZF provide powerful search capabilities.
208+
- **Improve UI & Aesthetics:** Status bar enhancements (e.g., Vim-Airline) make Vim more user-friendly.
209+
- **Extend Language Support:** Syntax highlighting and auto-completion for various programming languages.
210+
- **File Management:** Plugins like NERDTree simplify working with directories.
211+
212+
#### **Installing Plugins**
213+
214+
Installing and managing Vim plugins can be done using **plugin managers** or **native package management**.
215+
216+
#### **Using a Plugin Manager (Recommended)**
217+
218+
Popular plugin managers include:
219+
- **vim-plug** – Simple and efficient.
220+
- **Vundle** – Handles dependencies well.
221+
- **Pathogen** – Organizes plugins neatly.
222+
223+
#### **Installing vim-plug**
224+
225+
Run this command to install vim-plug:
226+
227+
```sh
228+
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
229+
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
230+
```
231+
232+
#### **Adding Plugins**
233+
234+
Edit your `.vimrc` file:
201235

202236
```vim
203237
call plug#begin('~/.vim/plugged')
@@ -207,12 +241,38 @@ Plug 'tpope/vim-surround' " Surround text with quotes/brackets
207241
Plug 'junegunn/fzf.vim' " Fuzzy finder
208242
call plug#end()
209243
```
244+
210245
- **Plugin Management:** `plug#begin` and `plug#end` set up plugins using Vim-Plug.
211246
- **NERDTree:** Provides a file explorer.
212247
- **Vim-Airline:** Enhances the status bar with useful information.
213248
- **Vim-Surround:** Allows easy manipulation of surrounding characters.
214249
- **FZF:** Adds powerful fuzzy search capabilities.
215250

251+
Then, install plugins with:
252+
253+
```vim
254+
:PlugInstall
255+
```
256+
257+
#### **Managing Plugins**
258+
259+
- **Update plugins:** `:PlugUpdate`
260+
- **Remove unused plugins:** `:PlugClean`
261+
- **Check plugin status:** `:PlugStatus`
262+
263+
### **Native Plugin Management (Vim 8+)**
264+
265+
Vim 8 introduced **native package management**:
266+
267+
1. Create a plugin directory: `mkdir -p ~/.vim/pack/plugins/start`
268+
2. Clone a plugin:
269+
```sh
270+
git clone https://github.com/preservim/nerdtree ~/.vim/pack/plugins/start/nerdtree
271+
```
272+
3. Restart Vim—plugin loads automatically.
273+
274+
Using a plugin manager is **easier** and **more scalable**, but native management works well for minimal setups.
275+
216276
### **Custom Status Line**
217277

218278
```vim

0 commit comments

Comments
 (0)