aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/nerdtree_customizations.vim
blob: 95b50f3b70725eb7cf0f115ac8d5062943981daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
" nedtree_customizations.vim - NERDTree customizations {{{
"
" Initially adapted from
" http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc
"
" Author: Silvio Rhatto <rhatto@riseup.net>

" Use the minimal UI {{{
let NERDTreeMinimalUI=1
" }}}

" NERDTree autogroup {{{
augroup nerdtree
  autocmd!

  " Open NERDTree when vim starts
  "autocmd VimEnter * NERDTree
  "autocmd VimEnter * wincmd p

  autocmd FileType nerdtree set relativenumber
  autocmd FileType taglist  set relativenumber
augroup END
" }}}

" TabNew {{{
function TabNew(address)
  execute ":tabnew"
  execute ":NERDTree " a:address
endfunction
" }}}

" TabNewBookmark {{{
function TabNewBookmark(bookmark)
  execute ":tabnew"
  execute ":NERDTreeFromBookmark " a:bookmark
endfunction
" }}}

" OpenNERDTree {{{
function OpenNERDTree()
  execute ":NERDTree"
endfunction
" }}}

" Shortcuts {{{
cnoreabbrev t NERDTree
cnoreabbrev b NERDTreeFromBookmark
cnoreabbrev s OpenSession
cnoreabbrev sload OpenSession
cnoreabbrev ssave SaveSession
command -nargs=1 -complete=dir T :call TabNew(<f-args>)
command -nargs=1 -complete=customlist,nerdtree#completeBookmarks B :call TabNewBookmark(<f-args>)
command -nargs=0 OpenNERDTree :call OpenNERDTree()
" }}}