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

`v$gz` will insert a newline

Open huyz opened this issue 3 years ago • 4 comments

If you do a visual block from the middle of the line to the end of the line with v$ and then invoke gz, a spurious newline gets inserted at the beginning of the replacement text.

huyz avatar Oct 27 '22 06:10 huyz

Sounds like you're running into a conflict with the default keymappings. You can disable them and configure another set as makes sense for you. I've kept the defaults as they are in the plugin, but personally I use

let g:titlecase_map_keys = 0
nmap <leader>gt <Plug>Titlecase
vmap <leader>gt <Plug>Titlecase
nmap <leader>gT <Plug>TitlecaseLine

Hope that helps. Closing now as I don't think there's anything to change in the plugin itself here.

christoomey avatar Oct 27 '22 12:10 christoomey

Sounds like you're saying you can't repro? You tried it, right? I'm pretty sure it's a bug.

huyz avatar Oct 27 '22 14:10 huyz

I tried your mappings. Same thing

huyz avatar Oct 27 '22 14:10 huyz

Ahh, got it. Yes, I'm able to reproduce now, sorry for misunderstanding.

It looks like including the newline character at the end of the line causes the issue. v$<leader>gt causes it, but v$h<leader>gt (addition of the h to move back off the newline / eol) behaves as expected.

Reopening now based on my new understanding.

christoomey avatar Oct 28 '22 12:10 christoomey