aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/nerdtree_customizations.vim
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-28 10:01:50 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-28 10:01:50 -0300
commitbf08c80af54044e8a4fc4a120f12434d2bd799f2 (patch)
treea7ee48adbb88abe2ab6e955efefef6b433392b75 /vim.dot.link/plugin/nerdtree_customizations.vim
parent23e4d875310c6520782d1605b8c3909053d58442 (diff)
downloadvim-bf08c80af54044e8a4fc4a120f12434d2bd799f2.tar.gz
vim-bf08c80af54044e8a4fc4a120f12434d2bd799f2.tar.bz2
Fix: split logic into separate plugins
Diffstat (limited to 'vim.dot.link/plugin/nerdtree_customizations.vim')
-rw-r--r--vim.dot.link/plugin/nerdtree_customizations.vim43
1 files changed, 43 insertions, 0 deletions
diff --git a/vim.dot.link/plugin/nerdtree_customizations.vim b/vim.dot.link/plugin/nerdtree_customizations.vim
new file mode 100644
index 0000000..f2e42ec
--- /dev/null
+++ b/vim.dot.link/plugin/nerdtree_customizations.vim
@@ -0,0 +1,43 @@
+" 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>
+
+let NERDTreeMinimalUI=1
+
+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
+
+function TabNew(address)
+ execute ":tabnew"
+ execute ":NERDTree " a:address
+endfunction
+
+function TabNewBookmark(bookmark)
+ execute ":tabnew"
+ execute ":NERDTreeFromBookmark " a:bookmark
+endfunction
+
+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()