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_nogxvariable.
- 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_dirhistmaxto 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 gp: Ask for new permission for the file under cursor.- Uses
g:netrw_chgperm. Default:chmod PERM FILENAME(Windows:cacls FILENAME /e /p PERM)
- Delete files matching a pattern:
-
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_homedirectory).
- 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"]]
-
Vim will go through all entries of
g:Netrw_UserMaps, and set up maps: -
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
wherea:islocal is 1 if it's a local-directory system call or 0 when
remote-directory system call.
Related Topics / Variables¶
- see cmdline-window