Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by
edited by

I am trying to highlight potentially dangerous or inconvenient file names.

  • highlight /^-/ cterm=underline
  • highlight /[\|&]/ cterm=underline

But how do I match those with a space at the beginning/end; "\r", "\n" or a tab (http://git.net/ml/version-control.monotone.devel/2003-11/msg00045.html), or with the ones mentioned in http://seclists.org/fulldisclosure/2003/Feb/att-341/Termulation.txt ?

1 Answer

+1 vote
by
selected by
 
Best answer

For spaces (includes tabs) that would be \s, some others can be matched with character classes (e.g. [[:cntrl:]]). Extraction of the first parameter of :highlight should be improved to allow space characters. I noticed this before, but couldn't think of a case where it would matter.

And also \x sequence might need to be added to allow specifying arbitrary characters via :execute, because regular expressions don't provide all ASCII table.

by
edited by
For spaces (includes tabs) that would be \s,

Works. Thanks.

by
[[:cntrl:]]

In Vim, [:cntrl:] can be used inside [] together with other characters.

by

In Vim, [:cntrl:] can be used inside [] together with other characters.

Yeah, seems to work the same way in libregex and thus in vifm.

by
Yeah, seems to work the same way in libregex and thus in vifm.

I think when I tried it, it considered it a list of at least "c, n, t, r, l".

by

/[f[:cntrl:]] works fine for example.

by

I probably became confused because I couldn't find a way to create a file with a \n. Bell (\07) and backspace work just fine.

...