0

This won't work when mapped to a shortcut in my ideavimrc. I've narrowed it down to the pipe and the % symbols that are messing up the search and replace. This works when input manually:

:%s#\(\n\s\+\|\t\+\)\(/\)\(\*\+\)\n#\1\2\**********\r#g<CR>

The % simply doesn't get typed, and the pipe terminates the input. How do I fix this?

Preston Garno
  • 1,175
  • 10
  • 33
  • Hi, it is not clear what you are trying to attempt. Maybe you could give an example of what you are trying to replace? For which expected result? Or maybe narrow your expression to a minimal example? – woshilapin Mar 14 '17 at 00:23
  • @woshilapin it has nothing to do with what I'm trying to replace, but why my *ideavimrc* is terminating input on a pipe character and not inputting a % symbol. But I'll edit it to make it clearer – Preston Garno Mar 14 '17 at 00:27
  • Ah sorry for missunderstanding. Then maybe try to reduce your {:%s#...#...#} to the minimum breaking example. – woshilapin Mar 14 '17 at 00:29
  • @woshilapin I figured it out see my answer. By the way, I was just mapping a shortcut to format javadoc comments – Preston Garno Mar 14 '17 at 00:41

1 Answers1

1

To input a pipe when mapping a command containing "\|" (escaping to a conditional operator in your regex) you have to also escape these in your ideavimrc:

noremap <command> :\\\|

Shows when you type 'command' as:

\|

The percent symbol somehow started working when I fixed this. Might be a bug with ideaVim.

Preston Garno
  • 1,175
  • 10
  • 33