Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste multiple yanked lines of words to another single line #253

Open
bemulima opened this issue Dec 18, 2023 · 2 comments
Open

Paste multiple yanked lines of words to another single line #253

bemulima opened this issue Dec 18, 2023 · 2 comments

Comments

@bemulima
Copy link

bemulima commented Dec 18, 2023

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
@mg979
Copy link
Owner

mg979 commented Dec 18, 2023

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.

@bemulima
Copy link
Author

bemulima commented Dec 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants