vim-visual-multi
vim-visual-multi copied to clipboard
Paste multiple yanked lines of words to another single line
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?
- My start code:
import test from './test';
export default {
test,
}
- 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';
- 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';
- Then replace
test
to new file names. On fourtht
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';
- Then
ctrl+n
for mark any selected line and yanky
- 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';
-
ctrl+n
andp
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';
- And on this step I want to replace contain of default so I select second
t
cursorctrl+down
andctrl+n
andy
andEsc
- for exit frommg979/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';
- After go to line (
3j
) wheretest
in default andviwp
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
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.
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.