feat .vimrc: 增加判定當前視窗大小來決定要不要自動開啟nerdtree
This commit is contained in:
parent
7cac40a66e
commit
1b14b96085
@ -204,7 +204,8 @@ let g:airline#extensions#tabline#enabled = 1
|
||||
nnoremap <C-t> :NERDTreeToggle<CR>
|
||||
nmap <F9> :NERDTreeToggle<CR>
|
||||
|
||||
|
||||
function! s:MaybeStartNERDTree()
|
||||
if winheight(0) > 20 && winwidth(0) > 140
|
||||
" 啟動時自動開啟 NERDTree,且只在沒有指定檔案時開啟
|
||||
autocmd VimEnter * NERDTree | wincmd p
|
||||
"autocmd StdinReadPre * let s:std_in=1
|
||||
@ -240,3 +241,8 @@ autocmd BufEnter * if winnr() == winnr('h') && bufname('#') =~ 'NERD_tree_\d\+'
|
||||
|
||||
" Mirror the NERDTree before showing it. This makes it the same on all tabs.
|
||||
nnoremap <C-n> :NERDTreeMirror<CR>:NERDTreeFocus<CR>
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" 自動執行
|
||||
autocmd VimEnter * call s:MaybeStartNERDTree()
|
||||
|
Loading…
x
Reference in New Issue
Block a user