On Fr, 03 Jun 2016, 李哲 wrote:
> I usually use the command `dt"` and `dt[` to delete the content from the current position to the mark [ or ".
>
> Is there a way that use the commannd `dtt`(for example) to combine the two `dt[` and `dt"` command?
>
> for example , `$` mark the current position of the curor.
> 1. "aaaa$bbbb"[cccccddddd] ; command dtt delete bbbb
> 2. "aaaabbbb"[ccccc$ddddd] ; command dtt delete ddddd
> 3. [ccccc"aaaa$bbbb"ddddd] ; command dtt delete bbbb, find the " or ] which is closer to the current curor
I assume you want to find either the '[', ']' or the '"', so you can use
a search:
d/[[\]["]
which you could map to a custom key if you like:
nnoremap <leader>d d/[[\]["]<cr>
Note however, since a search is not limited to the current line, this
might delete until the next line. If you don't want this, you could
adjust the command to this:
nnoremap <expr> <leader>d 'd/[[\]["]\%<c-r>=line(".")<cr>l<cr>'
Best,
Christian
--
Der Schwache kann nicht verzeihen. Verzeihen ist eine Eigenschaft des Starken.
-- Mahatma Gandhi
--
--
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.
No comments:
Post a Comment