Re: vi: count occurrences of a substring

2021-09-04 Thread Marc Chantreux
> Otherwise, if I try to just type > :!sed s/abc/abc\/g % | grep -c abc > and press enter, I only get the same output I also get out of same here! I so much wish it worked! regards marc

(technology sucks anyway) Re: vi: count occurrences of a word

2021-09-04 Thread Marc Chantreux
hello, > That's a neat trick -- IFF you can be *sure* that character won't show > up in the text. I also feel it's a workaround this is ok as you can easily check if if the caracter won't show. this is a "good enough" principle: don't try to fix *all* the cases, just fix yours. > understand

Re: vi: count occurrences of a word

2021-09-04 Thread Marc Chantreux
hello, > :!sed s/abc/abc\n/g % | grep -c abc Note: in sed, "what i just matched" is noted & > Googled information suggests that the opposite of what's described in > the man page may be true: You CAN use a literal newline, but you > can't use \n. BSD sed is more litteral AFAIK so you need

Re: vi: count occurrences of a word

2021-09-04 Thread Marc Chantreux
hello, > > so you can write: > > > > :w|grep -c abc % > That doesn't really fit the bill: > 1. This error message is produced: 'The grep command is unknown' because i wasted it by missing the bang :w|!grep -c abc % is a single line way to write :w :!grep -c abc % > 2. grep

vi: count occurrences of a word

2021-09-03 Thread Marc Chantreux
> 'abc' in FILE, from within vi. * % means 'the current file' in vi commands so you can write * | is the command separator * grep has a -c flag to count occurrences so you can write: :w|grep -c abc % you can also write the content of the buffer to a pipe (my prefered solution here):

Re: vi golf: command on a motion?

2021-09-03 Thread Marc Chantreux
hello, > The bang command has an equivalent in vi. this is the same command indeed but the ergonomy is quite different: vi don't "generate" the begining of a command including the range so we can't just delete a char and edit. > The closest you > can get to executing the same replacement via a

vi golf: command on a motion?

2021-09-03 Thread Marc Chantreux
hello people, Does anyone know how to get this done even faster: ma } :'a,ms/foo/bar even if it's short, I really would like to have something which work the way I abuse the ! command in vim: !} actually write a range on command line like :.,.6! so I just have to replace

Re: support new

2020-10-01 Thread Marc Chantreux
hello Ottavio, > BTW, for the non-initiated, what is this? https://www.openbsd.org/groups.html see the "this template" link to go there: https://www.openbsd.org/grp-tmpl.txt cheers, marc

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-04 Thread Marc Chantreux
hello Ingo, > Heck, piping to sort, or wc + undo are two of the most common used > commands. no need to pipe and undo: just write to a pipe :%w !wc > Under vi, !}fmt is also a favorite > though vim does have better integrated commands... AFAIK, ! work exactly the same between vim and

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-03 Thread Marc Chantreux
hello Ingo, > > rare cases. so i finally think it's not worth ... col -b is an elegant > > solution. > Premature optimization is evil. this case isn't about optimizing, it's about slowing down 99.999% to add a case that already have an elegant and simple solution. but as i said: i don't

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-03 Thread Marc Chantreux
hello Ingo, > :map K yw:E /tmp/vi.keyword.$$p!!xargs man > > i get: > > Error detected while processing function > line 30: > E132: Function call depth is higher than 'maxfuncdepth' > Press ENTER or type command to continue it's a bug in the :E command, i reported it there:

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
> I have no idea what the "much more" refers to. all the things i can do with vim are very useful while reading a man page. * a file is mentionned ? use gf to jump in it * a command is provided? edit it so it fit your system and run it with !! * want to add something to your notes? ranges to

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
dear Ingo, > Absolutely. Using web searches for software documentation is an > awkward and error-prone crutch that should be avoided for many > reasons. For OpenBSD documentation, it is never needed. Actually, the quality of the manpages was one of the reasons i tried openbsd and one of the

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
hello, On Mon, Mar 02, 2020 at 12:06:42PM -0500, Raul Miller wrote: > Have you looked at: > man col > ? how can you come to the point to read the manpage of a command that doesn't seems to be related to your problem (i was searching something around the man input so i tried troff, mandoc, man,

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
hello, > Try the mandoc manual page, man is just a front-end to it. Both > man/mandoc support -T option and you can specify ascii/utf8 to get the > formatted page but it still adds all escape sequences. indeed, that's why i asked > The documentation > says to pipe the output to col -b to

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
> It's the designated tool for the job. That fmt also happens to > replace sequences character1-backspace-character2 with character2 > is more of a lucky coincidence. ok then ... good to know. so by extension: by design, there is no way to use the man command to render the text directly?

Re: man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
hello, > > * is there a way to ask man to deliver pure (non-formatted) text ? > Pipe its output through "col -b". what is the gain of using col over fmt ? > > * is there a way to introduce a | in vi macros? > Yes, by prefixing it with a ^V character. To enter ^V in vi's input > mode, press

man to render pure text? (or a pipe in vi macros ?)

2020-03-02 Thread Marc Chantreux
hello, coming from linux, i'm used to read manpages in a vi buffer so i can do much more than reading the content. i basically use :r !man ls or !!sh (when the line content is "man ls") under openbsd, it seems man doesn't if stdout is a tty. i digged the man manual a little bit

Re: FreeBSD daemon(8)-like command for OpenBSD

2020-01-28 Thread Marc Chantreux
hello, > PID=`pgrep gloob` > if [ -z "$PID" ]   >      then >     /usr/local/bin/gloob -f poor_security_a_bad_idea_to_run.conf >      fi is there a reason to not use the pgrep status ? pgrep -q gloob || /usr/local/bin/gloob regards, marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-03 Thread Marc Chantreux
> you can do by array Both of them are borring once you used the signatures but they are still experimental. Also: if you don't mind a new dependency: Function::Paramaters is so much convenient. regards marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-03 Thread Marc Chantreux
> Any modern mailreader can easily tag messages as thread, so it's trivial to > avoid a given thread, as long as people don't fuck around with the > In-Reply-To info. i have to admit this isn't an argument: if most of the people don't read it, we should have the ability to save bandwidth by

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-03 Thread Marc Chantreux
> Yes well, my point is if you want to make a piece of code > incomprehensible, I don't think there is a language that will stop you. indeed. but i now realize the counterpart is not true because everyone has something different in mind when it comes to readability. last example was yesterday:

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
> You have something like 3 lines of perl to play with ;) is there a todo list somewhere ? regards marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
On Thu, Jan 02, 2020 at 02:16:52PM -0500, Daniel Jakots wrote: > On Thu, 2 Jan 2020 19:49:28 +0100, Marc Chantreux > > some endless sterile debates > Like this thread, or worse? * long doesn't mean endless * sharing points of view is never sterile (yours is inspired by other ones,

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
On Thu, Jan 02, 2020 at 10:42:54AM -0600, danieljb...@icloud.com wrote: > I don't understand why people say that perl's flexibility is a negative. because sometimes, flexibility permit some endless sterile debates about the coding style. marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
> I will always lean towards idiot-proofing the code. :)) fair enough. regards marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
hello, > > my %user = qw( > > login mc > > shell /bin/zsh > > ); > > print $user{login}; > my %user = ( login => 'mc', shell => 'bin/zsh'); > is way more readable in that case, I think, > and it does showcase what a *smart* quoting system can do. well ... i prefer

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
> Not sure about anyone else, but comparing the Python vs Perl example you > gave above, I would still say Python is the nicer-looking language. i was just saying that there is no need for yield in perl. now i can show you tons of examples to demonstrate perl code is not only more "unixish" but

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-02 Thread Marc Chantreux
hello Stuart, > Heh, I've heard Perl described as executable line noise, and for sure, > it will let you write code like that. arf ... i just tried to explain were this "linenoise" bullshit came from just in the answer i gave to frank regards marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-01 Thread Marc Chantreux
> Did you ever look at the suite of modules from John Syracusa (DB::Rose and > the like) ? fairly clean and nice. I had this under my radar but no one around be wanted to test anything else but DBIxC so i never took time to read the code or use it. regards marc

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-01 Thread Marc Chantreux
hello, > > what do you mean by this? prototypes are here for decades and signatures > > are experimental and i guess it will be core in some releases. > Stuff like > $o->method { code } ooohh right! this is a thing i also missed with perl (fixed in raku). > > Template toolkit is still by far

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-01 Thread Marc Chantreux
hello, > The only thing that's really missing in perl is proper thread support. > Don't know if that's going to happen. just to be sure: are you aware of the MCE module? https://metacpan.org/pod/distribution/MCE/lib/MCE.pod regards marc

Re: Suggestion: Replace Perl with Lua in the OpenBSD Base System

2020-01-01 Thread Marc Chantreux
hello, > Actually all the cool and useful ideas that perl6 had DID trickle down > into perl5 a few years ago. even if you load a lot of modules from CPAN (which i tried to do with https://metacpan.org/pod/Sympatic), this is not even close to be true! for example, raku has * PEGs are objects *

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-01 Thread Marc Chantreux
hello, > The only thing that's really missing in perl is proper thread support. > Don't know if that's going to happen. seems ... complicated ... > I have a wish-list of things that are not that likely to happen, I would > like to be able to use prototypes on methods, for instance. what do you

Re: perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2020-01-01 Thread Marc Chantreux
hello, as intro: i would like to make clear that i'm not promoting perl (my go to langage for scripting is now raku by far) but as i was a member of the perl community more than 20 years, i have some opinions about it. > felt like a random hack, especially compared to ruby. The only thing I >

perl popularity inside openbsd community? (Re: Suggestion: Replace Perl ...)

2019-12-31 Thread Marc Chantreux
On Tue, Dec 31, 2019 at 06:57:02AM -0600, Daniel Boyd wrote: > As one of the few remaining people out there who considers perl to be > their favorite language—starting to wonder if it’s just me and Larry > Wall at this point—I’d like to say that perl should stay in base on > its merits, all the

Re: Relayd in docker

2019-11-07 Thread Marc Chantreux
> I am running docker(yeah i know ..) but anyhow the task is to get a > nice load balancer up in a docker container and i want to use relayd > ofcourse ! has anyone gotten relayd to work in docker or has anyone > created openbsd images for docker ? AFAIK, docker is just an ugly wrapper on top of

Re: Tools for writers

2019-11-06 Thread Marc Chantreux
> With the exception of perlpod(1)/pod2man(1), most programs that good to know as i'm really confortable with pod. > page formatting. scdoc(1) is not an exception; the output code > quality is poor indeed > * stray .P before and after .SH > ... this list is really interesting. maybe it should

Re: Tools for writers

2019-11-05 Thread Marc Chantreux
hello, > https://www.openbsd.org/papers/bsdcan18-mandoc.pdf which leds me to the conference video. it was really interesting. > Nothing is wrong with trying to make things simple for users, quite > to the contrary. But that is not an excuse for delivering solutions > that are technically

Re: Tools for writers

2019-11-05 Thread Marc Chantreux
> > > documentation language, mdoc(7), at all, neither for input nor for > > > output, already makes me raise an eyebrow or two > Vim has many useful HTML plugins (or write your own) yes ... but why should i bother with an uggly distracting format when i can have a format that is close visually

Re: Tools for writers

2019-11-05 Thread Marc Chantreux
hello, > > that said: i'll really give troff a try again when i will figure out how > > to create templates for the documents i need (as i said in a previous > > message: i have a layout problem) > > First mention of templates in this four dozen message thread. i replied to this thread but as

Re: Tools for writers

2019-11-05 Thread Marc Chantreux
hello, > > is one of the most useful tools I have ever used. If you are writing > > any sort of documentation then I *highly* recommend checking it out > I strongly oppose that point. There is no need at all to bother > with pandoc when you write documentation. (It may be useful for > other

Re: Tools for writers

2019-11-03 Thread Marc Chantreux
> My substitute for _pandoc_ is the _org-mode_ of emacs, which is for some > people also good for outlining etc. if i quit using vim some day, it will be for something lightweight so i'll never run emacs, i guess. regards marc

Re: Tools for writers

2019-11-03 Thread Marc Chantreux
hello, > Does _pandoc_ work on OpenBSD now? i realized i haven't try on BSD as my desktop remains a linux for the moment. sorry i lost the focus because of this very appealing thread. regards marc

*roff and page layout ? (Re: Tools for writers)

2019-11-03 Thread Marc Chantreux
> the "print/texlive" port is how ridiculously large it is. because it comes with the whole distribution. i never tested but https://tectonic-typesetting.github.io/ seems to fix it by downloading stuff on demand. however, another problem with tex is performance. troff is blazing fast. however...

Re: Tools for writers

2019-11-03 Thread Marc Chantreux
> documents, but for my use case, LibreOffice has treated me well. I primarily > use it for simple things like putting together invoices, writing articles, > rendering documents to PDF or postscript, and reading .docx files people > send me. > I'm sure there's a superior way to do all this,

Re: Tools for writers

2019-11-02 Thread Marc Chantreux
hello, > You can't go wrong with LibreOffice. I've written thousands of pages over > the years with it. It may be too "heavy" for some, but for me, if I'm doing > something too complex for vi or mousepad, I just fire up LibreOffice. to me there is no such thing that is too complex for the unix

about vim objects (Re: Requesting vi tips)

2019-10-18 Thread Marc Chantreux
hello, > I didn't know [how] ! took movement commands. Thanks. I'll have a play > with that one. almost related: in addition to the motions, vim has a notion of objects :h objects so you can easily filter a complete paragraph with !ap fmt -w72 in visual mode, you can select

Re: BACK TO BASICS (wikipedia's unix family tree)

2019-10-13 Thread Marc Chantreux
hello, > > The Unix landscape was fragmented long, long before Linux or the three > > modern BSDs even existed. according to https://upload.wikimedia.org/wikipedia/commons/7/77/Unix_history-simple.svg it started almost just after unix was born. regards. marc

Re: Desktop full text search

2019-09-18 Thread Marc Chantreux
hello, > use Gnome or KDE so I was wondering what do people use for this. Been > looking at the ports and I see Xapian and others. Any advice on a nice > setup? i have the same problem with both code and documentation. i installed dezi (https://metacpan.org/pod/distribution/Dezi/bin/dezi) and