Closed hardenedapple closed 7 years ago
I'll have to think about where I stand on this. I could also use
vim-repeat, but that introduces a dependency, albeit arguably the most
common one. I might have an unhealthy fondness for
On Sun, Dec 11, 2016, 13:51 Matthew Malcomson notifications@github.com wrote:
Hi there, I came across this problem and think I have a reasonable solution. Problem:
Given the file test.txt
First line of test.txt Some filler words Hello thereh third line Should remain Goes away Some lines Should go away Should remain
Put the cursor on the third line and press dii, it removes the indentation as expected.
First line of test.txt Should remain Goes away Some lines Should go away Should remain
Now move to the third line again, and press ., this removes the same lines in the buffer, not the current indentation object
First line of test.txt Should go away Should remain
In contrast, pressing dii in that position leaves the text
First line of test.txt Should remain Should remain
Solution
In the operator mapping, directly call dentures#select by using :call dentures#select, this fixes the above problem.
It appears to work for me, I hope I haven't missed anything
You can view, comment on, or merge this pull request online at:
https://github.com/qstrahl/vim-dentures/pull/11 Commit Summary
- Allow re-using text object with '.'
File Changes
- M autoload/dentures.vim https://github.com/qstrahl/vim-dentures/pull/11/files#diff-0 (6)
- M plugin/dentures.vim https://github.com/qstrahl/vim-dentures/pull/11/files#diff-1 (8)
Patch Links:
- https://github.com/qstrahl/vim-dentures/pull/11.patch
- https://github.com/qstrahl/vim-dentures/pull/11.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qstrahl/vim-dentures/pull/11, or mute the thread https://github.com/notifications/unsubscribe-auth/ACIbjU33tEUE1cWvnfRrnuCXhZAldqDUks5rHEY2gaJpZM4LJ_8T .
Sure,
I do think you'll have difficulty using vim-repeat
with <expr>
mappings though.
I believe you need the call to repeat#set()
to be after the last change, and the change in an <expr>
mapping happens after your function has returned.
Moreover, because you use :normal
you can't finish your expression with the call to repeat#set
as any |
will be interpreted as a key press in the :normal
command.
At least, my (very limited) attempt to use vim-repeat
didn't work as hoped -- I could easily have just misunderstood the instructions.
You may be able to do something with autocmd
s on the CursorMoved
event, similar to this issue .
Cheers for the plugin!
Seems legit. Thanks for the patch!
Hi there, I came across this problem and think I have a reasonable solution.
Problem:
Given the file
test.txt
Put the cursor on the third line and press
dii
, it removes the indentation as expected.Now move to the third line again, and press
.
, this removes the same lines in the buffer, not the current indentation objectIn contrast, pressing
dii
in that position leaves the textSolution
In the operator mapping, directly call
dentures#select
by using:call dentures#select
, this fixes the above problem.It appears to work for me, I hope I haven't missed anything