Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the root of the netrw tree in vim?

Tags:

vim

netrw

The title sums it up, really. I'd like to know how to set the current root of the tree when browsing files using netrw in vim.

Any ideas?

like image 642
jabalsad Avatar asked Feb 24 '14 19:02

jabalsad


Video Answer


2 Answers

You can also use "gn" mapping to change the current directory to the folder under your cursor.

CHANGING TREE TOP netrw-ntree :Ntree netrw-gn {{{2

One may specify a new tree top for tree listings using

    :Ntree [dirname]

Without a "dirname", the current line is used (and any leading depth information is elided). With a "dirname", the specified directory name is used.

The "gn" map will take the word below the cursor and use that for changing the top of the tree listing.

like image 140
cppcho Avatar answered Sep 28 '22 03:09

cppcho


Per the documentation for netrw, use the ex command

:Ntree [dirname]

Assuming you have netrw installed, one can obtain more information on this using help

:help Ntree

Often times, I will just change the current work directory using the ex command

:cd [dirname]

Next, I start the explorer (ex command again)

:Exp

***Addendum***********

To update your version of netrw, I would just follow the directions that the author, Charles Campbell, posted on www.vim.org.

like image 45
Patrick Bacon Avatar answered Sep 28 '22 03:09

Patrick Bacon