Home Explore Blog CI



neovim

45th chunk of `runtime/pack/dist/opt/netrw/doc/netrw.txt`
1fa580e57403d871d0bd6267bc8776469602252a7a4770210000000100000fa2
 current window is a netrw window, toggle its width
    (between |g:netrw_wiw| and its original width)

  * Else if there is a |:Lexplore| window in the current tab, toggle
    its width

  * Else bring up a |:Lexplore| window

If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping
for <c-tab>, then the <c-tab> will not be mapped.  One may map something other
than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). >

	nmap <unique> (whatever)	<Plug>NetrwShrink
<
Related topics:			|:Lexplore|
Associated setting variable:	|g:netrw_usetab|


USER SPECIFIED MAPS					*netrw-usermaps* {{{1

One may make customized user maps.  Specify a variable, |g:Netrw_UserMaps|,
to hold a |List| of lists of keymap strings and function names: >

	[["keymap-sequence","ExampleUserMapFunc"],...]
<
When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps|
exists, then the internal function netrw#UserMaps(islocal) is called.
This function goes through all the entries in the |g:Netrw_UserMaps| list:

	* sets up maps: >
		nno <buffer> <silent> KEYMAP-SEQUENCE
		:call s:UserMaps(islocal,"ExampleUserMapFunc")
<	* refreshes if result from that function call is the string
	  "refresh"
	* if the result string is not "", then that string will be
	  executed (:exe result)
	* if the result is a List, then the above two actions on results
	  will be taken for every string in the result List

The user function is passed one argument; it resembles >

	fun! ExampleUserMapFunc(islocal)
<
where a:islocal is 1 if its a local-directory system call or 0 when
remote-directory system call.

			        *netrw-call*  *netrw-expose*  *netrw-modify*
Use netrw#Expose("varname")          to access netrw-internal (script-local)
				     variables.
Use netrw#Modify("varname",newvalue) to change netrw-internal variables.
Use netrw#Call("funcname"[,args])    to call a netrw-internal function with
				     specified arguments.

Example: Get a copy of netrw's marked file list: >

	let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist")
<
Example: Modify the value of netrw's marked file list: >

	call netrw#Modify("netrwmarkfilelist",[])
<
Example: Clear netrw's marked file list via a mapping on gu >
    " ExampleUserMap: {{{2
    fun! ExampleUserMap(islocal)
      call netrw#Modify("netrwmarkfilelist",[])
      call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
      let retval= ["refresh"]
      return retval
    endfun
    let g:Netrw_UserMaps= [["gu","ExampleUserMap"]]
<

10. Problems and Fixes					*netrw-problems* {{{1

	(This section is likely to grow as I get feedback)
								*netrw-p1*
	P1. I use Windows, and my network browsing with ftp doesn't sort by {{{2
	    time or size!  -or-  The remote system is a Windows server; why
	    don't I get sorts by time or size?

		Windows' ftp has a minimal support for ls (ie. it doesn't
		accept sorting options).  It doesn't support the -F which
		gives an explanatory character (ABC/ for "ABC is a directory").
		Netrw then uses "dir" to get both its thin and long listings.
		If you think your ftp does support a full-up ls, put the
		following into your <.vimrc>: >

			let g:netrw_ftp_list_cmd    = "ls -lF"
			let g:netrw_ftp_timelist_cmd= "ls -tlF"
			let g:netrw_ftp_sizelist_cmd= "ls -slF"
<
		Alternatively, if you have cygwin on your Windows box, put
		into your <.vimrc>: >

			let g:netrw_cygwin= 1
<
		This problem also occurs when the remote system is Windows.
		In this situation, the various g:netrw_ftp_[time|size]list_cmds
		are as shown above, but the remote system will not correctly
		modify its listing behavior.


								*netrw-p2*
	P2. I tried rcp://user@host/ (or protocol other than ftp) and netrw {{{2
	    used ssh!  That wasn't what I asked for...

		Netrw has two methods for browsing remote directories: ssh
		and ftp.  Unless you specify ftp specifically, ssh is used.
		When it comes time to do download a file (not just a directory
		listing), netrw will use the

Title: Netrw: User Maps, Problems, and Fixes
Summary
This section of the netrw documentation covers user-specified maps, allowing customized key mappings. It explains how to define the g:Netrw_UserMaps variable to create custom mappings and use internal functions like netrw#Expose, netrw#Modify, and netrw#Call. It also addresses common problems, particularly related to Windows' ftp support for sorting and remote browsing methods, providing solutions like setting g:netrw_ftp_list_cmd or using Cygwin.