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, 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.
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'
From the netrw reference manual:
*.netrwhist*
See |g:netrw_dirhistmax| for how to control the quantity of history stack
slots. The file ".netrwhist" holds history when netrw (and vim) is not
active. By default, it's stored on the first directory on the user's
|'runtimepath'|.
In my case, the first path in runtimepath
is ~/.vim
(check with :echo &runtimepath
). I'm good with that, so I don't need to change g:netrw_home
.
*g:netrw_dirhistmax* =10: controls maximum quantity of past
history. May be zero to supppress
history.
So, yeah, let g:netrw_dirhistmax=0
will stop writing to the history file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With