Another option is modifying the netrw.vim script found in /usr/share/vim/vim<your version here>/autoload/ as follows:
nnoremap <buffer> <silent> P : call NetrwGetPath()
let dirname = s:NetrwTreeDir(0)
let filename = s:NetrwGetWord() ...
Riffing off of this answer, I added these lines to my .vimrc to enable mouse support only when starting, entering, or leaving netrw buffer.
au FileType netrw :call NetrwMouseOn()
au FileType netrw au BufEnter <buffer> :call NetrwMouseOn()
netrw is a plugin, just one that is distributed with vim itself. For me, :Explore and friends are defined in /usr/local/share/vim/vim82/plugin/netrwPlugin.vim.
From the load-plugins section of :h initialization, step 4:
Load the plugin scripts.
This does the same as the command:
The result is that all
directories in the '...
Tried all kind of solutions from here and some other places, none worked as expected, respectively I didn't like the implementation much (e.g. the one using augroup netrw_buf_hidden_fix), so I ended up with this for closing netrw using Esc or q
autocmd FileType netrw nnoremap <buffer><silent> <Esc> :call <SID>CloseNetrw()<CR>