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

Attempting to substitute a forward slash, question mark, or single quote results in exception

Open ts826848 opened this issue 5 years ago • 0 comments

Attempting to replace all forward slashes with backslashes using S;/;\\;g results in an exception:

Error detected while processing function <SNR>15_subvert_dispatcher[2]..<SNR>15_parse_subvert[9]..<SNR>15_parse_substitute[9]..<SNR>15_throw:
line    2:
E605: Exception not caught: Abolish: E471: Argument required
Press ENTER or type command to continue

I believe this is because of the first if in s:parse_substitute:

https://github.com/tpope/vim-abolish/blob/7e4da6e78002344d499af9b6d8d5d6fcd7c92125/plugin/abolish.vim#L443-L447

At this point, a:args is ['/', '\\', 'g']. This passes the if statement, at which point separator is set to / and args is changed to [' \\ g']. This brings the length of args down to 1, which causes the function to error out at line 452.

Attempting to replace question marks or single quotes would likely also run into issues.

Unfortunately, I'm a bit stuck here; at this point, the substitution string has already been split into its component parts, so I'm struggling to see what munging the pattern-to-be-substituted is supposed to accomplish. Granted, I'm new to this codebase and vimscript in general, so it's very likely I'm missing something obvious. Maybe something for searching or grepping?

ts826848 avatar Feb 27 '20 01:02 ts826848