Install NERDTree Tabs

Aug 27, 2016 Vim 中文版

As we know, Vim is a powerful text editor. However, there is still a lot of room for improvement. I’m going to introduce NERDTree Tabs that can make Vim like a modern IDE, and this post is about how to install and use it.



Prerequisite

To install plugins for Vim, I usually use Vundle, an easy-to-use plugin manager. And I will use it in this tutorial, so you can try to use it. What’s more, NERDTree Tabs is based on NERDTree. Thus, you should install NERDTree before below steps.

Install NERDTree Tabs

Let’s install NERDTree Tabs via Vundle. First, open your Vim configuration (/etc/vimrc or ~/.vimrc), then add the plugin name and related settings. For example:

" skip some content ... "

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'

" Add NERDTree Tabs plugin here "
Plugin 'jistr/vim-nerdtree-tabs'

call vundle#end()
filetype plugin indent on

" skip some content ... "

" Drop NERDTree Tabs settings at the end of the config file "
" Open file via NERDTree Tabs, hot key: \t "
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>

" Start NERDTree Tabs automatically "
let g:nerdtree_tabs_open_on_console_startup = 1

After modification to Vim config, let’s install by executing the command in Vim:

:PluginInstall

Or, drop the command in your terminal:

vim +PluginInstall +qall


Use NERDTree Tabs

Here are useful hot keys when you editing in Vim:

t   # Open file in a new tab
gt  # Switch to the next tab
gT  # Switch to the previous tab
:q  # Close current tab
Ctrl + ww  # Switch to different blocks




You might also like:




If you have any suggestions, questions or even find some typos, feel free to contact me. Thank you! :)

zeckli.devforgalaxy@gmail.com   © 2015-2019 zeckli, thanks to Jekyll and GitHub.