Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: How to access the redo-register

As a secondary task to a Python auto-completion (https://github.com/davidhalter/jedi), I'm writing a VIM plugin with the ability to do renaming (refactoring).

The most comfortable way to do renaming is to use cw and autocommand InsertLeave :call do_renaming_func(). To do this I need to access the redo-register (see help redo-register) or something similar, which would record the written text.

If possible, I like to do this without macros, because I don't want to mess up anything.

like image 862
Dave Halter Avatar asked Jan 26 '26 15:01

Dave Halter


1 Answers

The . register (@.) contains all editing keys, unfortunately in raw form, so also <Del> and <BS>, which show up as <80>kD, and which insert completion does not interpret. Instead, to extract only the net text entered, use the range delimited by the marks '[ and '] (last one exclusive).

For an example on how to do this, have a look at my PrevInsertComplete plugin.

like image 167
Ingo Karkat Avatar answered Jan 28 '26 05:01

Ingo Karkat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!