5

I want the following features of EasyClip vim plugin to incorporate in ideavim plugin:

  1. dd - Delete the line and do not change clipboard

  2. D - Delete from cursor to the end of the line and do not change clipboard

  3. dD - Delete the contents of line except the newline character (that is, make it blank) and do not change clipboard

  4. x - Delete the character under cursor and do not change clipboard

  5. s - Delete the character under cursor then enter insert mode and do not change clipboard

  6. S - Delete the line under cursor then enter insert mode and do not change clipboard

  7. c - Enter insert mode over top the given area and do not change clipboard

  8. cc - Enter insert mode over top the current line and do not change clipboard

  9. C - Enter insert mode from cursor to the end of the line and do not change clipboard

  10. s - Substitute over the given motion with specified register (or default register if unspecified).
  11. ss - Substitute over the current line with specified register (or default register if unspecified).
  12. gs - Same as s but preserves the current cursor position.

How can I do these this?

Vikrant Singh
  • 669
  • 1
  • 6
  • 18
  • Keep in mind that the vim registers are **not** the same thing as your OSs clipboard. If you meant the register, I believe that you just can't do it, unfortunately – Daniel Kravetz Malabud Oct 09 '16 at 14:30

2 Answers2

2

EasyClip just remap key sequences to the same function but with redirection to "black hole register" _.

Mappings are present there https://github.com/svermeulen/vim-easyclip/blob/21b6dcd7bb25697263156473d6eb9ec0420b97ee/autoload/EasyClip/BlackHole.vim#L22-L52 First item in column is a source key, second is a target and third is modes list. n means normal model and corresponds nnoremap command, x means visual mode and corresponds xnoremap. For example, ['S', '"_S', 'nx'] will be translated in two commands:

nnoremap S "_S
xnoremap S "_S

You can manually add these mappings to ~/.ideavimrc. Complete mappings list are:

nnoremap d "_d
xnoremap d "_d

nnoremap dd "_dd

nnoremap dD 0"_d$

nnoremap D "_D
xnoremap D "_D

nnoremap x "_x
xnoremap x "_x

nnoremap c "_c
xnoremap c "_c

nnoremap cc "_S
nnoremap C "_C
xnoremap C "_C
nnoremap s "_s
xnoremap s "_s
nnoremap S "_S
xnoremap S "_S

Also there are mappings for selection mode:

snoremap H <c-o>"_cH
snoremap I <c-o>"_cI
snoremap J <c-o>"_cJ
snoremap K <c-o>"_cK
snoremap L <c-o>"_cL
snoremap M <c-o>"_cM
snoremap N <c-o>"_cN
snoremap O <c-o>"_cO
snoremap P <c-o>"_cP
snoremap Q <c-o>"_cQ
snoremap R <c-o>"_cR
snoremap S <c-o>"_cS
snoremap T <c-o>"_cT
snoremap U <c-o>"_cU
snoremap V <c-o>"_cV
snoremap W <c-o>"_cW
snoremap X <c-o>"_cX
snoremap Y <c-o>"_cY
snoremap Z <c-o>"_cZ
snoremap [ <c-o>"_c[
snoremap \ <c-o>"_c\
snoremap ] <c-o>"_c]
snoremap ^ <c-o>"_c^
snoremap _ <c-o>"_c_
snoremap ` <c-o>"_c`
snoremap a <c-o>"_ca
snoremap b <c-o>"_cb
snoremap c <c-o>"_cc
snoremap d <c-o>"_cd
snoremap e <c-o>"_ce
snoremap f <c-o>"_cf
snoremap g <c-o>"_cg
snoremap h <c-o>"_ch
snoremap i <c-o>"_ci
snoremap j <c-o>"_cj
snoremap k <c-o>"_ck
snoremap l <c-o>"_cl
snoremap m <c-o>"_cm
snoremap n <c-o>"_cn
snoremap o <c-o>"_co
snoremap p <c-o>"_cp
snoremap q <c-o>"_cq
snoremap r <c-o>"_cr
snoremap s <c-o>"_cs
snoremap t <c-o>"_ct
snoremap u <c-o>"_cu
snoremap v <c-o>"_cv
snoremap w <c-o>"_cw
snoremap x <c-o>"_cx
snoremap y <c-o>"_cy
snoremap z <c-o>"_cz
snoremap { <c-o>"_c{
snoremap } <c-o>"_c}

snoremap <bs> <c-o>"_c
snoremap <space> <c-o>"_c<space>
snoremap \| <c-o>"_c| 

Unfortunately, mappings in visual mode don't work. I don't know why, maybe the issue is in IdeaVim plugin.

pochemuto
  • 21
  • 4
1

Just to add on to @pochemuto's answer: it seems that now the visual mode mappings do work. Here's the config I'm using - note I also added the m commands which were the reason I was using vim-easyclip in the first place.

nnoremap d "_d
xnoremap d "_d

nnoremap dd "_dd

nnoremap D "_D
xnoremap D "_D

nnoremap x "_x
xnoremap x "_x

nnoremap m d
nnoremap mm dd
xnoremap m d
zplizzi
  • 995
  • 1
  • 11
  • 16