Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.editors Subject: Re: VI showmatch option Keywords: SHOWMATCH Message-ID: <3791@solo6.cs.vu.nl> Date: 24 Oct 89 02:43:22 GMT References: <1188@cnetlu.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 35 cornily@cnetlu.UUCP (Cornily) writes: \... '[' and ']' characters as expression delimiters. \I'd like to get the showmatch possibility for those characters. Now, it \seems to work only on '(' and ')' characters. Any solution ? `{' and `}' are handled too. The following is a work-around for `[' and `]': map! ] ^V^V]^[%a ^H^[%a (^V = ctrl-V, ^[ = escape, ^H = ctrl-H) Note: when typed from within vi (using :map!), every one of the abovementioned control characters has to be escaped with another ^V. Explanation: ^V^V] - the double ^V will become a single one in the map; when the `]' you typed is expanded, this ^V will prevent the `]' in the map from being expanded too (which would lead to a recursive macro) ^[ - end insert mode % - go to the match of `]' a ^H^[ - append a space, backspace to the point of insertion, end append mode, i.e. nothing is appended; this command sequence only serves to keep the cursor near the matching `[' for a moment - you might want to use a longer sequence % - go to the match of the `[', i.e. the `]' you typed a - re-enter append mode Bug: if there's no match, the first `%' will fail, which will end the macro expansion, i.e. the macro won't put you back into append mode. -- A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam: a hard link is the file system's GOTO. | maart@cs.vu.nl, mcsun!botter!maart