set operatorfunc=fakeclip#clipboard_delete not working as expected when mapped to keys without a modifer #9

Forethinker opened this Issue Mar 11, 2013 · 3 comments


None yet
3 participants

Instead of using "+ or "* modifiers to copy into the special registers, I wanted my normal commands (without modifiers) to use special registers.

My remapping works fine for yank, but not for delete. If I do 4dd, it only deletes one line and pastes one line into the register (consequently xclip) and if I do 4D vim once again deletes the line, but then replaces it with an empty line. My remapping also modified the aforementioned operations with modifiers. (e.g. "*4dd or "+4dd)

Other than that, my remapping works fine with other delete operations in visual mode or any operation that ends with single d in normal mode.

Below is what I pasted in .vimrc

silent! nmap  y  <Plug>(fakeclip-y)
silent! nmap  Y  <Plug>(fakeclip-Y)
silent! nmap  yy  <Plug>(fakeclip-Y)
silent! vmap  y  <Plug>(fakeclip-y)
silent! vmap  Y  <Plug>(fakeclip-Y)

silent! nmap  p  <Plug>(fakeclip-p)
silent! nmap  P  <Plug>(fakeclip-P)
silent! nmap  gp  <Plug>(fakeclip-gp)
silent! nmap  gP  <Plug>(fakeclip-gP)
silent! nmap  ]p  <Plug>(fakeclip-]p)
silent! nmap  ]P  <Plug>(fakeclip-]P)
silent! nmap  [p  <Plug>(fakeclip-[p)
silent! nmap  [P  <Plug>(fakeclip-[P)
silent! vmap  p  <Plug>(fakeclip-p)
silent! vmap  P  <Plug>(fakeclip-P)
silent! vmap  gp  <Plug>(fakeclip-gp)
silent! vmap  gP  <Plug>(fakeclip-gP)
silent! vmap  ]p  <Plug>(fakeclip-]p)
silent! vmap  ]P  <Plug>(fakeclip-]P)
silent! vmap  [p  <Plug>(fakeclip-[p)
silent! vmap  [P  <Plug>(fakeclip-[P)

silent! map!  <C-r>  <Plug>(fakeclip-insert)
silent! map!  <C-r><C-r>  <Plug>(fakeclip-insert-r)
silent! map!  <C-r><C-o>  <Plug>(fakeclip-insert-o)
silent! imap  <C-r><C-p>  <Plug>(fakeclip-insert-p)

###  " trouble makers below                                                                                
silent! nmap  d  <Plug>(fakeclip-d)
silent! vmap  d  <Plug>(fakeclip-d)
silent! nmap  dd  <Plug>(fakeclip-dd)
silent! nmap  D  <Plug>(fakeclip-D)
silent! vmap  D  <Plug>(fakeclip-D)

Would you happen to know why this is happening?
I am using vim 7.3, Crunchbang Waldorf (Debian variant)
Thanks for the awesome plug-in!


kana commented Mar 11, 2013

Thank you for the report. I've never thought such usage. It seems not to be obvious why it doesn't work properly. I'll look into the problem later.


kana commented Mar 16, 2013

I've discovered that fakeclip doesn't handle <count> correctly in some cases.

  • It ignores <count> if it is typed before an operator. For example, 3dw is treated as dw.
  • It recognizes <count> if it is typed after an operator. For example, d3w is treated as is.

<count> is ignored in the following cases:

  • <count>y{motion}
  • <count>d{motion}
  • <count>dd
  • <count>D

I'll fix the problem later.

I noticed the same problem. It also appears to be impossible to create maps that provide the equivalent of "set clipboard=unnamedplus". I'm going to explore the possibility of creating an auto-command that allows intercepting access to registers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment