Author Topic: "Expecting close parenthesis" in vim mode / search  (Read 3339 times)

rowbearto

  • Senior Community Member
  • Posts: 2336
  • Hero Points: 132
"Expecting close parenthesis" in vim mode / search
« on: March 19, 2018, 01:16:27 AM »
In VIM keyboard emulation mode, I want to search for a string "funcName(".

When I type "/" and then enter in the bottom "funcName(", it says "Expecting close parenthesis".

But this is a search string, so SE should not care that there is no close parenthesis. When doing this with "vi" on my console and not with SE, vi does not give such an error.

Is this a bug in SE?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "Expecting close parenthesis" in vim mode / search
« Reply #1 on: March 19, 2018, 02:44:04 PM »
All SlickEdit vim search commands use regular expressions. Real vim uses some sort of wildcard/regex syntax (don't know where it's documented) where the open parenthesis is NOT a special character ('.' is a wildcard character). SlickEdit does not attempt to match VIM's syntax at all. Also, it doesn't look like there is a way to turn of regular expression searching (I don't like that) for SlickEdit VIM emulation. It either has to be Perl or SlickEdit syntax regex searching.

The workaround is to precede special characters with a backslash (i.e. "\(")

rowbearto

  • Senior Community Member
  • Posts: 2336
  • Hero Points: 132
Re: "Expecting close parenthesis" in vim mode / search
« Reply #2 on: March 19, 2018, 02:51:55 PM »
hmmm, a colleague who is a regular VIM user (not an SE user) was debugging with me at my desk and I had SE open when he wanted to search for a function in his source file. Because of this issue he gave up using SE and had me open vi in another window. I'm trying to get more people on my team to use SE, but when hitting issues like this when they are so used to doing something a certain way and they have to adapt they are not so keen on switching.

So please consider a feature request to make it like VIM here, to make it easier for new users to come over, or at least a way to turn off regular expressions here.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "Expecting close parenthesis" in vim mode / search
« Reply #3 on: March 19, 2018, 03:58:48 PM »
SlickEdit VIM emulation defaults to Perl syntax. It's modern but not the same as VIM.

I'm surprised this has never come up before. There have been a ton of other VIM issues (customer requests) which we have taken care of.

Just curious, does your college know Perl syntax regular expressions?


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "Expecting close parenthesis" in vim mode / search
« Reply #4 on: April 07, 2018, 04:03:36 PM »
V23 will have Vim syntax regular expressions with support for the four different syntax modes (\v, \m (default), \M, and \V). Also, there will be an option to turn regular expression syntax off or choose another regular expression syntax (like Perl which is the current setting). The vim commands (like '/' and :substitute) will have override options to either turn off regex syntax or choose a specific regex syntax.

rowbearto

  • Senior Community Member
  • Posts: 2336
  • Hero Points: 132
Re: "Expecting close parenthesis" in vim mode / search
« Reply #5 on: April 07, 2018, 05:48:29 PM »
Thanks Clark!

Does this mean that the default for VIM emulation searching with / will use the VIM syntax? What does \v, \m, \M and \V mean? If you default to using the VIM syntax in a / search then it would be easier to get VIM users to switch to SE.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6934
  • Hero Points: 531
Re: "Expecting close parenthesis" in vim mode / search
« Reply #6 on: April 07, 2018, 06:06:37 PM »
Vim emulation will default to Vim regex syntax (always \m syntax which is Vim's default). It turns out that Vim has several minor variations to how escaping is handle which corresponds to \v, \m, \M, and \V. Typically these are used at the start of a Vim syntax regex. \v means "very magic" which is where there are many more special characters like in other regex syntax. \V means "very no magic" where the only special character is backslash and if you want regex meaning you must use a backslash (\* means 0 or occurrences). \M means "no magic" and seems pretty useless to me.

I do think first-time Vim emulation users will want this and it will make it easier to get Vim users to switch to SE. It is odd that it took so long for us to get this feedback. There is still a ton of a Vim users out there.