Search code examples
vimnetrw

what is .netrwhist?


When I edit files in my ~/.vim, the .netrwhist file would mysteriously be changed, too.

It's content:

let g:netrw_dirhistmax  =10
let g:netrw_dirhist_cnt =6
...and so on...

What does this file do? Is it important?


Solution

  • netrw is a kind of vim plugin/script which supports reading and writing files across networks. .netrwhist is a history file which maintains all the directories that were modified. So whenever you modify the contents of ~/.vim it adds one entry in .netrwhist

    A sample .netrwhist is as shown

    let g:netrw_dirhistmax  =10
    let g:netrw_dirhist_cnt =6
    let g:netrw_dirhist_1='/Users/wolever/EnSi/repos/web/env/web/lib/python2.6/site-packages/django'
    let g:netrw_dirhist_2='/private/tmp/b/.hg/attic'
    let g:netrw_dirhist_3='/Users/wolever/code/sandbox/pydhcplib-0.6.2/pydhcplib'
    let g:netrw_dirhist_4='/Users/wolever/EnSi/repos/common/env/common/bin'
    let g:netrw_dirhist_5='/Users/wolever/EnSi/repos/common/explode'
    let g:netrw_dirhist_6='/Users/wolever/Sites/massuni-wiki/conf'
    

    netrw_dirhistmax indicates the maximum number of modified directories it stores in the history file. ie Max History Size. netrw_dirhist_cnt indicates the current history count of modified directories.

    If you want to disable netrw to generate history file, then see this.