[implementations-list] [Vimpulse] Bug: something's worng when pasting whole lines:

Frank Fischer frank.fischer at mathematik.tu-chemnitz.de
Tue May 18 16:33:16 CEST 2010


Am Dienstag, 18. Mai 2010 schrieb Alessandro Piras:
> Another annoying glitch about copy/pasting visual-line selected
> lines: 

I had similar problems with vim-mode. The reason is the special case of 
newlines at the eof and in empty lines. In your first example, the last 
line in the buffer does not end in a newline charactor so viper does 
not recognize the text as "linewise" (I think). In the second example 
the cursor is placed on the newline-character of the empty line. This 
is special because this is the only situation where viper allows to 
place the cursor on the newline-character (usually it's on a regular 
charactor) and the paste-command should be aware of this case.

In vim-mode I solved the problem using the yank-handler feature of the 
newer Emacsen (GNU Emacs 22, 23??). This also allowes to deal with 
pasting of blocks without any need to modify the paste-function 
(everything is set up during yanking). In fact, yank-handler allows a 
very clean implementation of all three cases (char, line, block) 
without any hacks. The biggest problem is that this feature is not 
available in XEmacs or ealier versions of GNU Emacs, but it's not hard 
to implement it. If you want to go this way, have a look at 
vim-commands.el (for the yanking/pasting stuff) and vim-compat.el (for 
the yank-handler modifications for earlier Emacsen) of the current 
vim-mode.

Frank



More information about the implementations-list mailing list