vim-subversive icon indicating copy to clipboard operation
vim-subversive copied to clipboard

Problem with substituting over range

Open niomate opened this issue 3 years ago • 2 comments

Hi, I have a small problem with the substitution. Whenever I want to substitute say all e's in a single word, it substitutes all e's in the line instead.

asciicast

Input was <leader>sliw

The problem also occurs with minimal config with only subversive installed.

Neovim version output:

NVIM v0.6.1
Build type: Release
LuaJIT 2.0.5
Compiled by builduser

Features: +acl +iconv +tui

Keymap config (lua):

vim.api.nvim_set_keymap("n", "ss", "<Plug>(SubversiveSubstituteLine)", {})
vim.api.nvim_set_keymap("n", "S", "<Plug>(SubversiveSubstituteToEndOfLine)", {})

vim.api.nvim_set_keymap("n", "<leader>s", "<Plug>(SubversiveSubstituteRange)", {})
vim.api.nvim_set_keymap("x", "<leader>s", "<Plug>(SubversiveSubstituteRange)", {})
vim.api.nvim_set_keymap("n", "<leader>ss", "<Plug>(SubversiveSubstituteWordRange)", {})

niomate avatar Feb 02 '22 20:02 niomate

This is a valid issue, but I'm not sure how we'd go about implementing it. Under the hood, subversive generates an ex-mode command to perform the substitution, and as far as I know ex-mode ranges can only be specified as lines. You can see the ex-mode command that is generated for any substitution by enabling the subversivePromptWithActualCommand setting

svermeulen avatar Feb 02 '22 23:02 svermeulen

Oh I thought this was just my installation acting up. I could have sworn that this was working for me before switching to lua for my configuration.

niomate avatar Feb 03 '22 09:02 niomate