[implementations-list] vimpulse interaction with cua increasing number feature
Vegard Øye
vegard_oye at hotmail.com
Mon Mar 29 22:31:54 CEST 2010
Hi Fabian!
Are you using the Subversion version of Vimpulse? You'll need to point
your SVN client to the address below if you want the latest bugfixes
before release.
http://my-svn.assembla.com/svn/vimpulse
>> I have a new problem with my traditional handling in dired mode.
>> In dired mode, I am not able to split the window horizontally or
>> vertically anymore using :sp or :vs !?
Fixed in SVN revision 159.
> [M-n] fills each line of the rectangle with increasing numbers using
> a supplied format string (prompt)
>
> Does anyone have a hint, how I could get this cua-feature to work
> with the new vimpulse? Maybe, there is already a vimpulse function,
> which can do the same!?
The Cua function will only work on Cua rectangles. However, since
Vimpulse's block selections are rectangle compatible, an equivalent
rectangle command can be written as follows:
(require 'rect)
(defun my-sequence-rectangle (first incr format)
"Insert increasing numbers at beginning of each line."
(interactive
(list (if current-prefix-arg
(prefix-numeric-value current-prefix-arg)
(string-to-number
(read-string "Start value: (0) " nil nil "0")))
(string-to-number
(read-string "Increment: (1) " nil nil "1"))
(read-string "Format: (%d) ")))
(when (= (length format) 0)
(setq format "%d"))
(apply-on-rectangle
(lambda (start-col end-col count-var)
(move-to-column start-col)
(insert (format format (eval count-var)))
(set count-var (+ (eval count-var) incr)))
(region-beginning) (region-end) 'first)
(vimpulse-visual-mode -1))
(vimpulse-vmap (kbd "M-n") 'my-sequence-rectangle)
If you compare it with `cua-sequence-rectangle', you'll see they are
quite similar; the Cua function uses `cua--rectangle-operation' for
applying a lambda function on each line, whereas this function uses
`apply-on-rectangle' from rect.el.
Hope this helps!
Vegard
_________________________________________________________________
Få nye Windows Live™ Messenger.
http://download.live.com/messenger
More information about the implementations-list
mailing list