Live data from Hacker News

Making ASCII Art in Vim

alexyang.dev

11–17 of 17 posts

Re: Making ASCII Art in Vim

#12
post #4

Another slew of utility lies in `:help searchoffset`, often like the following: https://til.codeinthehole.com/posts/about-vims-semicolon-sea... /x/e-3 /x/+1 /x/;/yz ...it allows near arbitrary cursor placement (eg: this blog articles "squiggle" situation) to be able to find the beginning of the squiggle, or the end of the squiggle (or temporarily using "X" and "Z" for start/end, and "clearing" it with `V...:s/[XY]/./…

For the last example given in that article:

    /test_.*_errors/;/errors
I find it much easier to use "\zs". That tells vim where you want the "start" of the match to be. Everything before the "\zs" is just treated like context:

    /test_.*_\zserrors
It is also useful for ":s/match/sub"

Re: Making ASCII Art in Vim

#14
post #4

Another slew of utility lies in `:help searchoffset`, often like the following: https://til.codeinthehole.com/posts/about-vims-semicolon-sea... /x/e-3 /x/+1 /x/;/yz ...it allows near arbitrary cursor placement (eg: this blog articles "squiggle" situation) to be able to find the beginning of the squiggle, or the end of the squiggle (or temporarily using "X" and "Z" for start/end, and "clearing" it with `V...:s/[XY]/./…

For the last example given in that article: /test_.*_errors/;/errors I find it much easier to use "\zs". That tells vim where you want the "start" of the match to be. Everything before the "\zs" is just treated like context: /test_.*_\zserrors It is also useful for ":s/match/sub"

Noice! :-D Never knew about that (even though it might be vim-specific), but yeah, so much easier than where I'll usually have to do some trial + error to get my cursor to land where I want it. (usually in a macro, or multi-`.` edit context).
Post reply on HN