Sunday, June 30, 2013

how do i remap dd so that it becomes context-dependent?

Hello all,

I'm using "set wrap". I'd like to come up with a remap of dd that would does the follwing:
If the current line is wrapped, it then performs g0dg$
Else, it performs the conventional dd.

The problem is this. if i just use:
vnoremap dd g0dg$
nnoremap dd g0dg$
whenever i have non wrapped lines, such as:
a
b
c
And I "dd" line two, it will end up with sth like:
a
(blank line)
c
Instead of this expecting result:
a
c

Thanks in advance



--
--
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/groups/opt_out.

No comments: