vim-sensible icon indicating copy to clipboard operation
vim-sensible copied to clipboard

C-L mapping breaks netrw refresh

Open mtglsk opened this issue 10 years ago • 6 comments

As in title.

mtglsk avatar Apr 12 '16 12:04 mtglsk

I can confirm this.

Adding an autocommand for filetype netrw which adds <Plug>NetrwRefresh to <c-l> as well would be a solution.

Something like

augroup sensible-netrw
  autocmd!
  autocmd FileType netrw nnoremap <buffer> <silent> <C-L> <Plug>NetrwRefresh:nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
augroup END

However, this does not work. Only following works

augroup netrw-sensible
  autocmd!
  autocmd FileType netrw nmap <buffer> <silent> <C-l> <Plug>NetrwRefresh
augroup END

How can I chain <Plug>NetrwRefresh with :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>?

kiryph avatar Aug 02 '18 17:08 kiryph

Except for invoking builtin <C-L> following works

augroup netrw-sensible
  autocmd!
  autocmd FileType netrw nmap <buffer> <silent> <C-l> <Plug>NetrwRefresh:nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR>
augroup END

kiryph avatar Aug 02 '18 17:08 kiryph

I really don't want to go down the auto-command rabbit hole if it can be avoided. What about augmenting the main map with something like if len(maparg("<Lt>Plug>NetrwRefresh", "n"))|exe "norm \<Lt>Plug>NetrwRefresh"|endif?

tpope avatar Aug 02 '18 20:08 tpope

What about augmenting the main map with something like if len(maparg("Plug>NetrwRefresh", "n"))|exe "norm <Lt>Plug>NetrwRefresh"|endif?

Yes, this sounds better than the auto-command.

kiryph avatar Aug 03 '18 07:08 kiryph

What is the current solution to this? Would anyone be willing to submit a PR?

last5bits avatar Jul 18 '19 20:07 last5bits

This was a bug in Netrw that has since been fixed. I mean, of course it was a bug in Netrw, my bad for not floating that hypothesis to begin with.

tpope avatar Dec 26 '22 05:12 tpope