I was playing with netrw and was amazed by the possibility.

I'd like to mark some files with 'mf' and move it to a folder using 'mt'. However, when I press 't', vim seems to interprets it as "open a tab', because it open another instance of netrw in a splitted window. How can I do to mark it as target ?

My problem seems to be with the "t" shortcut in NETRW

t   Enter the file/directory under the cursor in a new tab|netrw-t|

Thanks for your help !

Vim version : 8.1

Plugins :

 2: /usr/share/vim/vim81/debian.vim
  3: /usr/share/vim/vim81/syntax/syntax.vim
  4: /usr/share/vim/vim81/syntax/synload.vim
  5: /usr/share/vim/vim81/syntax/syncolor.vim
  6: /usr/share/vim/vim81/filetype.vim
  7: ~/.vim/ftdetect/solidity.vim
  8: ~/.vim/ftdetect/typescript.vim
  9: ~/.vimrc
 10: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
 11: /usr/share/vim/vim81/plugin/gzip.vim
 12: /usr/share/vim/vim81/plugin/logiPat.vim
 13: /usr/share/vim/vim81/plugin/manpager.vim
 14: /usr/share/vim/vim81/plugin/matchparen.vim
 15: /usr/share/vim/vim81/plugin/netrwPlugin.vim
 16: /usr/share/vim/vim81/plugin/rrhelper.vim
 17: /usr/share/vim/vim81/plugin/spellfile.vim
 18: /usr/share/vim/vim81/plugin/tarPlugin.vim
 19: /usr/share/vim/vim81/plugin/tohtml.vim
 20: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 21: /usr/share/vim/vim81/plugin/zipPlugin.vim
 22: /usr/share/vim/vim81/autoload/netrw.vim
 23: ~/.vim/.netrwhist
 24: /usr/share/vim/vim81/scripts.vim
 25: /usr/share/vim/vim81/syntax/netrw.vim

Here my .vimrc : set splitright

" open file explorer at startup
autocmd VimEnter * Vexplore .

" Resize file explorer
autocmd VimEnter * vertical resize 50
autocmd VimEnter * wincmd w

" NETRW : set view type as TREE
let g:netrw_liststyle=3

" Disable header : I
let g:netrw_banner=0

" Open file in previous split
let g:netrw_browse_split=4

" hide vim swap files
let g:netrw_list_hide='.*\.swp$'

" To insert space characters whenever the tab key is pressed, set the 'expandtab' option: 
:set tabstop=4
:set shiftwidth=4
set expandtab

" fold indented text automatically at opening.
" to disable/toggle folding : zi
" za : toggle current indented block
setlocal foldmethod=indent


In netrw, :verbose map command return :

:verbose map t
n  t           *@:call <SNR>22_NetrwSplit(4)<CR>
        Modifié la dernière fois dans /usr/share/vim/vim81/autoload/netrw.vim

:verbose map mt
n  mt          *@:<C-U>call <SNR>22_NetrwMarkFileTgt(1)<CR>
        Modifié la dernière fois dans /usr/share/vim/vim81/autoload/netrw.vim

mf command is working great. I see difference when file is marked : Items marked become bold. I think this should be the same for 'mt'. However a tab is opened when I press 't' immediately after 'm'. Name of the folder doesn't become "bold" (marked).


:set showcmd

'm' is correctly displayed at the bottom of the screen. 'm' disappear just after pressing 't' key.

Below logs from debug mode (9) : (translate from french)

Error detected while processing function <SNR>22_NetrwMarkFileTgt[63]..<SNR>22_LocalBrowseRefresh[57]..<SNR>22_NetrwRefresh[16]..netrw#LocalBrowseCheck[23]..<SNR>22_NetrwBrowse[237]..<SNR>22_PerformListing[231]..<SNR>22_NetrwWideListing :
line   67 :
E31: No such mapping
Error detected while processing function <SNR>22_NetrwMarkFileTgt[63]..<SNR>22_LocalBrowseRefresh[57]..<SNR>22_NetrwRefresh[16]..netrw#LocalBrowseCheck[23]..<SNR>22_NetrwBrowse[237]..<SNR>22_PerformListing[231]..<SNR>22_NetrwWideListing :                            
line   70 :
E31: No such mapping
No such mapping: @$

Line 67 and 70 in function :


   if hasmapto("w","n")
    line 67 -> sil! nunmap <buffer> w
   if hasmapto("b","n")
    line 70 -> sil! nunmap <buffer> b

but I don't know if this is really the function that is the root cause of vim prefering to apply the other 't' shortcut.

if I do "nmap", I don't see "w" nor "b" mapping :

n  a           *@:<C-U>call <SNR>22_NetrwHide(1)<CR>
n  c           *@:<C-U>call <SNR>22_NetrwLcd(b:netrw_curdir)<CR>
n  d           *@:call <SNR>22_NetrwMakeDir("")<CR>
n  v           *@:call <SNR>22_NetrwSplit(5)<CR>
n  x           *@:<C-U>call netrw#BrowseX(<SNR>22_NetrwBrowseChgDir(1,<SNR>22_NetrwGetWord(),0),0)"<CR>
n  <F1>        *@:he netrw-quickhelp<CR>



I set up debug loglevel to 14. It seems to be a bug. When I press 't' just after 'm' ('mt' command to mark as target), a process/command SynSet seem to be launched in infinite loop (CPU fan begin to work harder). Log file contains same text in loop. Please find below link to pastebin that contain log file part that is repeated infinitely. (Sorry but log are in french...)


  • Do a :verbose map <buffer> in netrw and see what you get – D. Ben Knoble Mar 21 at 0:41
  • I suggest using :set showcmd so you can see the pending m and make sure it's there... The mt command simply marks the target directory, so the result might not be too noticeable unless you look at the top header... You need to use mm to move the selected files to the marked target directory (I guess you know about that... Just pointing it out.) – filbranden Mar 21 at 4:36
  • If you like Vim and like the idea of a file manager, take a look at ranger (github.com/ranger/ranger), it's very powerful and you can run it inside a Vim terminal (with :term.) – filbranden Mar 21 at 4:37
  • 1
    @filbranden I've had fun with vifm. Also, welcome fellow french-speaker @raoul59! – D. Ben Knoble Mar 21 at 16:14
  • 1
    @D.BenKnoble thanks! i'm french actually (in confinement, thanks covid19...). I updated description with some logs (debug mode). – raoul59 Mar 21 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.