what is .netrwhist?

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.


In addition, in case you want vim to respect the XDG base directory specifications in order to prevent your home folder from being littered up by dotfiles like ~/.vim, you may want to split cached files and history files from your configuration (which usually resides in the runtime path). So for example, to store .netrwhist in ~/.cache/vim, you may want to try

let g:netrw_home=$XDG_CACHE_HOME.'/vim'

In addition, if one sets g:netrw_dirhistmax to zero, netrw will save no history or bookmarks:

:let g:netrw_dirhistmax = 0

Doing this will not cause any prior .netrwhist or .netrwbook files to be deleted, however.

Tags:

Vim

Netrw