[slim-vim] Patch for Vim FFI, searching

Brad Beveridge brad.beveridge at gmail.com
Mon Jun 19 15:43:19 CDT 2006


On 19/06/06, Larry Clapp <larry at theclapp.org> wrote:
> On Mon, Jun 19, 2006 at 10:48:03AM -0700, Brad Beveridge wrote:
> > On 19/06/06, Dmitry Petukhov <dmgenp at gmail.com> wrote:
> > > 2006/6/19, Brad Beveridge <brad.beveridge at gmail.com>:
> > > >  Alternately we could define search as
> > > > (defun search (pattern &rest flags)....)
> > >
> > > but then (search "pattern" :back :accept-match-at-cursor) would
> > > seem like there is :black keyword parameter, with value =
> > > :accept-match-at-cursor
> >
> > Very good point, that would look very wrong.  Best not to go against
> > Lisp code conventions.
>
> Agree.  So:
>
>   (defun search (pattern &key flags stopline)
>     ...)
>
>   usage example:
>
>   (search "pattern" :flags '(:backward) :stopline (vim:line "w0"))
>
> Suggested flag names & aliases:
>
> 'b'     search backward instead of forward
>
>         :backward or :b
>
> 'c'     accept a match at the cursor position
>
>         :match-at-cursor or :c
>
> 'e'     move to the End of the match
>
>         :move-to-end or :e
>
> 'n'     do Not move the cursor
>
>         :do-not-move or :move, which would effect the "n" flag, but
>         obviously do opposite things.  Or :n.
>
> 'p'     return number of matching sub-pattern
>
>         :count-submatches or :p
>
> 's'     set the ' mark at the previous location of the cursor
>
>         :set-tic or :s
>
> 'w'     wrap around the end of the file
>
>         :wrap or :wl ("w-lower")
>
> 'W'     don't wrap around the end of the file
>
>         :no-wrap or :wu ("w-upper")
>
>         The wrap setting would default to (vim:var "&wrapscan").  They
>         have no single-character alias because it seems too easy to
>         confuse things with flags distinguished by case.  Yes, you
>         could say :|w| or :|W|, but generally I think it'd be a Bad
>         Idea.
>
> Thoughts?
>
> -- Larry
>
> _______________________________________________
> slim-vim mailing list
> slim-vim at lispniks.com
> http://www.lispniks.com/mailman/listinfo/slim-vim
>
I like it, ship it! :)


More information about the slim-vim mailing list