vi learnin' part DCXL

Whilst wandering about the vi(1) codebase—that is, my mutated version which is a fork of the OpenBSD base vi—for reasons best not to ask—the O_PATH feature was discovered, which complicates opening of neither-fully-qualified-nor-relative filenames.

     path [""]
             Define additional directories to search for files being edited.

Huh. TIL. So, how to use this thing?

    $ rm baz
    $ mkdir bar
    $ echo foo > bar/baz
    $ vi
    :set path=bar
    :edit baz
    ZZ

That shows "foo" (just before the ZZ to quit vi), so if you have files all over the place (I mostly do not) and want a shorthand to avoid having to type out some other directory (shells back then (this is a historic vi we're talking about) lacked tab completion or fancy ** globs or other such file finders) then the O_PATH thing could be used. With tmux I might instead vi foo in one window, and cd elsewhere && vi baz in another tmux window, so there are other ways this problem could be solved, depending on what you use.

So more or less like the PATH environment variable, only for files in vi.

P.S. one of these years I should also figure out ctags, but mostly I don't delve codebergs large enough to require that, and I'm not doing my edits in any sort of a hurry, and I have other means to find strings in files and pass those files off to vi.

=> https://www.savagechickens.com/2019/06/not-lazy.html

Proxy Information
Original URL
gemini://thrig.me/blog/2025/01/15/vi-til.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
1087.73872 milliseconds
Gemini-to-HTML Time
0.296786 milliseconds

This content has been proxied by September (ba2dc).