mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-28 20:29:43 +08:00
readme update add script for automatically open NERDTree and focus on file (#1192)
* update readme for auto startup NERDTree and focus on file * readme update add how to open NERDTree automatically and focus on file
This commit is contained in:
parent
14af89743a
commit
474d735b7d
|
@ -92,6 +92,11 @@ If you are interested in this behaviour then consider [vim-nerdtree-tabs](https:
|
||||||
|
|
||||||
Stick this in your vimrc: `autocmd vimenter * NERDTree`
|
Stick this in your vimrc: `autocmd vimenter * NERDTree`
|
||||||
|
|
||||||
|
---
|
||||||
|
#### How can I open a NERDTree automatically when vim starts up and autofocus on file?
|
||||||
|
|
||||||
|
Stick this in your vimrc: `autocmd vimenter * NERDTree | wincmd p`
|
||||||
|
|
||||||
---
|
---
|
||||||
#### How can I open a NERDTree automatically when vim starts up if no files were specified?
|
#### How can I open a NERDTree automatically when vim starts up if no files were specified?
|
||||||
|
|
||||||
|
@ -103,6 +108,15 @@ autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
||||||
|
|
||||||
Note: Now start vim with plain `vim`, not `vim .`
|
Note: Now start vim with plain `vim`, not `vim .`
|
||||||
|
|
||||||
|
---
|
||||||
|
#### How to autofocus on file and focus on NERDTREE when no files were specified?
|
||||||
|
|
||||||
|
Stick this in your vimrc:
|
||||||
|
```vim
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | else | NERDTree | wincmd p | endif
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
#### What if I'm also opening a saved session, for example `vim -S session_file.vim`? I don't want NERDTree to open in that scenario.
|
#### What if I'm also opening a saved session, for example `vim -S session_file.vim`? I don't want NERDTree to open in that scenario.
|
||||||
```vim
|
```vim
|
||||||
|
|
Loading…
Reference in New Issue
Block a user