Domanda

I'd like to copy current line in vim editor to some different places. Is there a way to do it with one command?

The following is impossible command illustrating what I mean.

:t 25, 28, 54

Of course I can do it with

:t 25
:t 29
:t 56

However I'd prefer make it with the only command.

È stato utile?

Soluzione

You can get it using pipe to concatenate commands:

:t 25 | t 28 | t 54

Altri suggerimenti

For something like that, you need a custom command, e.g. this:

:command! -nargs=+ T for lnum in reverse([<f-args>]) | exe 'copy' lnum | endfor

Invoke it via :T 25 28 54.

By processing the arguments from last to first, this avoids adapting the line numbers for the added lines.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top