Continuing with the neovim IDE series, today I will introduce you the plugins that you should have when installing your neovim for any language.
Nerdtree
Nerdtree is a sidebar managing the project directory tree. Similar to the sidebar of vscode, nerdtree provides the function to create bookmarks, folders, files, copy, add, delete, edit … right in the context of nerdtree extremely convenient.
1 2 3 | // 01.pugins.nvim Plug 'scrooloose/nerdtree' |
After installation is complete, map keys to toggle nerdtree as you like:
1 2 3 4 5 6 7 8 9 | // 02.plugin-settings.nvim map <C-b> :NERDTreeToggle<CR> // nhấn tổ hợp phím Ctrl +b để show/hide Nerdtree map <C-i> :NERDTreeFind<CR> //từ màn hình code // nhấn tổ hợp phím Ctrl + i để tìm vị trí của file trong nerdtree // xem phim nhiều tuỳ chỉnh tại https://github.com/scrooloose/nerdtree |
When in the nerdtree context, click ? to see how to use nerdtree.
Theme
For me the syntax, color text, highlight … will be the things that inspire the code. After trying a lot of themes, now I’m stopping with gruvbox . You can search google with keyword “neovim themes” is the whole mountain, you can refer to the theme that many people evaluate and use here .
1 2 3 4 5 6 7 8 9 | // 01.plugins.nvim Plug 'morhetz/gruvbox' // 03.plugin-settings.nvim syntax enable set background=dark highlight Normal ctermbg=None colorscheme gruvbox // vì mình xài theme gruvbox set termguicolors |
Vim-airline
Vim-airline displays status / tabline, can integrate with other plugins to display message, status like git, nerdtree, linter.
Ctrlp.vim
If you use an editor such as vscode, sublime, or atom, you should be familiar with Ctrl + P keys to search files in the current project.
Ctrlp.vim has the same function, but with more functions, you can open the current file into a buffer | New tab while keeping the old buffer.
1 2 3 4 5 6 7 8 | // 01.plugins.nvim Plug 'kien/ctrlp.vim' // 03.plugin-settings.nvim let g:ctrlp_custom_ignore = { 'dir': 'v[/](node_modules|build|public|lib|dist)|(.(git|svn))$', 'file': 'tags|tags.lock|tags.temp', } |
Keys binding: Use:
Vim-surround
Vim-surround provides a function to manipulate around a subject (a piece of code, a word, an object …..)
On the git page of vim-surround, there is a detailed talk about how to use it, so I will not present it again, you can see it at vim-surround’s github.
1 2 3 | //01.plugins.nvim Plug 'tpope/vim-surround' |
Some Use-case:
Usecase:
1 2 3 4 5 6 | <span class="token keyword">const</span> <span class="token function-variable function">Component</span> <span class="token operator">=</span> <span class="token punctuation">(</span> <span class="token punctuation">{</span> label <span class="token punctuation">,</span> <span class="token operator">...</span> rest <span class="token punctuation">}</span> <span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span> <span class="token keyword">return</span> <span class="token operator"><</span> div <span class="token operator">></span> <span class="token keyword">default</span> text <span class="token operator"><</span> <span class="token operator">/</span> div <span class="token operator">></span> <span class="token punctuation">;</span> <span class="token punctuation">}</span> <span class="token punctuation">;</span> <span class="token comment">// mình kiểm tra nếu label =true thì sẽ dùng label,</span> <span class="token comment">// ngược lại show mặc định</span> |
Usecase:
1 2 3 4 5 6 | <span class="token operator"><</span> Provider store <span class="token operator">=</span> <span class="token punctuation">[</span> store <span class="token punctuation">]</span> <span class="token operator">></span> <span class="token operator"><</span> App <span class="token operator">/</span> <span class="token operator">></span> <span class="token operator"><</span> <span class="token operator">/</span> Provider <span class="token operator">></span> <span class="token comment">// mình muốn đổi [store] thành {store} </span> <span class="token comment">// sau đó wrap lại với BrowserRouter</span> |
Vim-easymotion
Move to any location in your code screen with vim-easymotion. Just input 1 | 2 characters as the prefix for that word, vim-easymotion will bind all the keys to jump to words matching that character.
1 2 3 4 5 6 | //01.plugins.nvim Plug 'easymotion/vim-easymotion' // 03.plugin-settings.nvim nmap <silent> gw <Plug>(easymotion-overwin-f2) // nhận vào 2 kí tự prefix let g:EasyMotion_smartcase = 1 |
End
I would like to end part 1 here (I will divide it into 2 parts). Here I only introduce plugins that are common to an IDE such as folder management, themes, navigator, search files …., plugins that do not belong to any language.
You register to Codefun to participate in discussions, write articles, share and learn useful knowledge together. In the process of finding out if you have any questions, please leave in the comment section I will answer as soon as possible.
Thank you for reading and …. see you again in part 2.