Netrw Keybindings¶
Table of Contents¶
- Netrw Keybindings
- Default Keybindings
- User Specified Maps/Keybindings in netrw
- Related Topics / Variables
Default Keybindings¶
View / Opening Files¶
i
: Cycle through the different listing styles.o
: Opens file under cursor in horizontal split.v
: Opens file under cursor in vertical split.t
: Opens file under cursor in a new tab.gx
: Open file with an external program- This can be disabled by setting the
g:netrw_nogx
variable.
- This can be disabled by setting the
Browsing¶
gn
: Change the "tree top" to the word below cursor (see:Ntree
)u
/U
: Jump to previous/next directory in browsing history.- Change
g:netrw_dirhistmax
to increase the amount of directories saved. (default 10)
- Change
-
: Go up a directory (../
)
Modifying Files¶
D
: Delete marked files/directories (and empty directories). If no files are marked, delete the file/directory under the cursor.- Delete files matching a pattern:
:MF pattern
, thenD
- Delete files matching a pattern:
gp
: Ask for new permission for the file under cursor.- Uses
g:netrw_chgperm
. Default:chmod PERM FILENAME
(Windows:cacls FILENAME /e /p PERM
)
- Uses
X
: When pressed when cursor is above an executable, it will prompt the user for arguments. Netrw will callsystem()
with that cmd and args.
Bookmarks¶
mb
: Bookmark the currently browsed directory.- Stored in
.netrwbook
(in theg:netrw_home
directory).
- Stored in
mB
: Remove the currently browsed directory from bookmarks.qb
: List bookmarks and history{cnt}gb
: Go to{cnt}
bookmark.- Also available:
:NetrwMB[!] [files/directories]
- No Argument (and in netrw buffer):
- Adds marked files to bookmarks.
- Else, adds file/directory under cursor.
- With arguments:
glob()
each arg and bookmark them. - With bang (
!
): Removes files/directories from bookmarks.
- No Argument (and in netrw buffer):
File Display / Information¶
qf
: Get file's size and last modification timestamp.S
: Specify priority via sorting sequence (g:netrw_sort_sequence
).gh
: Toggle between hiding the "dotfiles" and not.a
: Toggle through three hiding modes. Set the hiding list with<C-h>
<Ctrl-H>
: Brings up a requestor allowing user to change the file/directory hiding list ing:netrw_list_hide
.
User Specified Maps/Keybindings in netrw¶
:h netrw-usermaps¶
Custom user maps can be added.
Make a variable (g:Netrw_UserMaps
), to hold a List of lists (nested lists)
let g:Netrw_UserMaps = [["keymap-sequence","ExampleUserMapFunc"],
\ ["keymap-sequence","AnotherUserMapFunc"]]
g:Netrw_UserMaps
, and set up maps:
nno <buffer> <silent> KEYMAP-SEQUENCE
:call s:UserMaps(islocal,"ExampleUserMapFunc")
: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)
a:islocal
is 1 if it's a local-directory system call or 0 when
remote-directory system call.
Related Topics / Variables¶
- see cmdline-window