Skip to content

Instantly share code, notes, and snippets.

@rezigned
Last active December 14, 2015 15:19
Show Gist options
  • Save rezigned/5107449 to your computer and use it in GitHub Desktop.
Save rezigned/5107449 to your computer and use it in GitHub Desktop.
VI Settings

NERDTree

NERDTree is a vim plugin that allows you to explore your filesystem/directories in the form of a tree.

Installation

NERDTree suggests that we should install it by using https://github.com/tpope/vim-pathogen. So, Let's install pathogen first.

mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \
    https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim

Add the following settings to .vimrc

execute pathogen#infect()
syntax on
filetype plugin indent on

Then install NERDTree

cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git

Additional settings

Automatically opens NERDTree when vim starts up. Add these settings to .vimrc

autocmd vimenter * NERDTree

Basic usage

[In NERDTree explorer]

o: To open sub-directories/files
s: Open new file in veritcal-slit window
i: Open new file in horizontal-split window
t: Open new file in new tab
gt: Navigate to next tab
gT: Navigate to previous tab

Converting tabs to spaces

:set tabstop=4
:set shiftwidth=4
:set expandtab
  • expandtab command will convert all tabs to spaces
  • tabstop specifies the number of spaces that will be inserted when tab key is pressed.
  • shiftwidth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment