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

[substitute.range] Quickly prefix text #69

Closed
keevan opened this issue Jul 4, 2023 · 3 comments · Fixed by #83
Closed

[substitute.range] Quickly prefix text #69

keevan opened this issue Jul 4, 2023 · 3 comments · Fixed by #83
Labels
enhancement New feature or request

Comments

@keevan
Copy link

keevan commented Jul 4, 2023

Hi there! I've managed to add the behaviour I want for adding text to a current selection.

-- Mark word visually, then edit all occurences based on range / motion.
vim.keymap.set("x", "mA", function()
	require("substitute.range").visual({ prompt_current_text = true })
end, { noremap = true })

But there doesn't appear to be an easy way to start editing from the start of the current text. I find myself press the arrow keys to go to the start of the word, and it's worse the longer the current_text is, ctrl+left arrow seems to jump to the start of the command which isn't ideal either, and alt+left arrow doesn't work

I understand it's a bit of a hack to want to prefix things this way. Hopefully it's a small change.

@keevan keevan changed the title [subtitute.range] Quickly prefix text [substitute.range] Quickly prefix text Jul 4, 2023
@gbprod
Copy link
Owner

gbprod commented Jul 6, 2023

hmm, I think I can do something for that, I will keep you informed

@bew
Copy link

bew commented Aug 17, 2023

I'm thinking it would be nice to place the cmdline cursor at the same position of the cursor when the plugin is invoked.

(given | represents the cursor)
So if line is foo|barbaz
Cmdline would be: s/foobarbaz/foo|barbaz/g (for example)

Edge case when cursor is not in motion1, but then that behavior can simply be disabled

@gbprod
Copy link
Owner

gbprod commented Aug 21, 2023

Interesting, I probably add an option to select that.
I'll try to implement this soon but if you are in a hurry, the best is to open a PR ;)

@gbprod gbprod added the enhancement New feature or request label Oct 6, 2023
gbprod added a commit that referenced this issue Nov 16, 2023
gbprod added a commit that referenced this issue Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants