mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-27 05:34:35 +00:00
Add some nerd tree autocmds
Co-authored-by: jpie726 <53590846+jpie726@users.noreply.github.com>
This commit is contained in:
parent
36b3bd57ca
commit
fa7370a745
|
@ -5,8 +5,23 @@ let g:NERDTreeDirArrowCollapsible = '▼'
|
||||||
let NERDTreeShowLineNumbers=1
|
let NERDTreeShowLineNumbers=1
|
||||||
let NERDTreeShowHidden=1
|
let NERDTreeShowHidden=1
|
||||||
let NERDTreeMinimalUI = 1
|
let NERDTreeMinimalUI = 1
|
||||||
let g:NERDTreeWinSize=38
|
let g:NERDTreeWinSize=25
|
||||||
if empty($DISPLAY) " Disable devicons for nerdtree in TTY
|
if empty($DISPLAY) " Disable devicons for nerdtree in TTY
|
||||||
let g:webdevicons_enable_nerdtree = 0
|
let g:webdevicons_enable_nerdtree = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
"Start NerdTree. If a file is specified, move the cursor to its window.
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
|
||||||
|
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] |
|
||||||
|
\ endif
|
||||||
|
autocmd VimEnter * if argc() > 0 && !isdirectory(argv()[0]) || exists("s:std_in") |
|
||||||
|
\ execute 'NERDTree' fnamemodify(argv()[0], ':p:h') | wincmd p | endif
|
||||||
|
|
||||||
|
" Exit Vim if NerdTree is the only window left.
|
||||||
|
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
||||||
|
\ quit | endif
|
||||||
|
|
||||||
|
" If another buffer tries to replace NerdTree, put it in another window, and bring back NerdTree.
|
||||||
|
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
|
||||||
|
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
|
||||||
|
|
Loading…
Reference in a new issue