I'm working on a comment plugin, I want to check the line that curse on just before motion start, the code is like this:
nnoremap <silent> <leader>c :set operatorfunc=<SID>CommentLines<cr>g@
function! s:CommentLines(type, ...)
echo getline('.')
endfunction
Imagine the working buffer like this:
aaa
bbb _
ccc
When user type `<leader>cip` in the second line, the `getline('.')` would always return the first line `aaa`, but how can I get the line where the user start this motion ? which should be `bbb` in this case.
Thanks for any kind of help!
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thursday, December 17, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment