vim-visual-multi icon indicating copy to clipboard operation
vim-visual-multi copied to clipboard

Paste multiple yanked lines of words to another single line

Open bemulima opened this issue 1 year ago • 2 comments

I don't find feature that paste multiple yanked lines of words to another single place. In my mind it will be very help for fast coding.

My goal is make from:

import test from './test';

export default {
  test,
}

to:

import test from './test';
import test_one from './test_one';
import test_two from './test_two';
import test_three from './test_three';
import test_four from './test_four';

export default {
 test, 
 test_one, 
 test_two, 
 test_three, 
 test_four, 
};

How I'm trying do it?

  1. My start code:
import test from './test';

export default {
  test,
}
  1. I adding a few imports so I do just yy4p:
import test from './test';
import test from './test';
import test from './test';
import test from './test';
import test from './test';

  1. Changing the names of imported files manually
import test from './test';
import test from './test_one';
import test from './test_two';
import test from './test_three';
import test from './test_four';

  1. Then replace test to new file names. On fourth t ctrl+down. Where [t] - selected cursors
import test from './[t]est';
import test from './[t]est_one';
import test from './[t]est_two';
import test from './[t]est_three';
import test from './[t]est_four';

  1. Then ctrl+n for mark any selected line and yank y
  2. Then move selected cursors to second t
import [t]est from './test';
import [t]est from './test_one';
import [t]est from './test_two';
import [t]est from './test_three';
import [t]est from './test_four';
  1. ctrl+n and p in result:
import test from './test';
import test_one from './test_one';
import test_two from './test_two';
import test_three from './test_three';
import test_four from './test_four';

  1. And on this step I want to replace contain of default so I select second t cursor ctrl+down and ctrl+n and y and Esc - for exit from mg979/vim-visual-multi
import [t]est from './test';
import [t]est_one from './test_one';
import [t]est_two from './test_two';
import [t]est_three from './test_three';
import [t]est_four from './test_four';

  1. After go to line (3j) where test in default and viwp so in result I see another yanked value
export default {
  another_yanked_value,
}

  • Operating System: Ubuntu 22.04
  • Vim Version: NVIM v0.9.4
  • commit SHA/branch: latest

bemulima avatar Dec 18 '23 10:12 bemulima

Which is the step that doesn't work for you? For me it works, except that at step 9 it pastes a block selection (probably not what you want), but you can just make it linewise with some mapping that changes the current register type, or add some empty lines before pasting.

:help vm-registers explains how to use registers.

mg979 avatar Dec 18 '23 16:12 mg979

Thanks so much for answer! Create empty lines before pasting - it's good idea if you are know how many lines you need. But I would like at 9 step just paste yanked values from plugin. I lost yanked values of plugin at 8 step after Esc.

I'll keep looking at the documentation (vm-registers). Thank.

bemulima avatar Dec 19 '23 05:12 bemulima