Date: Thu, 26 Sep 2013 12:51:32 -0700 From: Gary Kline <kline@thought.org> To: Polytropon <freebsd@edvax.de> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: minor vi/vim qstn Message-ID: <20130926195132.GA24184@ethic.thought.org> In-Reply-To: <20130926152629.89e6dd72.freebsd@edvax.de> References: <20130925212741.GA19434@ethic.thought.org> <20130926002327.6502d1b9.freebsd@edvax.de> <20130926002104.GA12932@ethic.thought.org> <20130926030600.8850ddc5.freebsd@edvax.de> <20130926024708.GA3908@ethic.thought.org> <20130926152629.89e6dd72.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 27 years of service to the Unix community. On Thu, Sep 26, 2013 at 03:26:29PM +0200, Polytropon wrote: > On Wed, 25 Sep 2013 19:47:08 -0700, Gary Kline wrote: > > dunno how you know im using the zsh, but yup. > > This is because of my magical allknowinglyness. :-) > > You wrote: > > > > > pts/14 17:11 <tao> [5011] vi! > > > > zsh: command not found: vi! > ^^^ > This gave me the impression you're using the Z shell. > > The C shell says: > > % vi! > vi!: Command not found. > > And bash says: > > $ vi! > bash: vi!: command not found > > So the shell that says "zsh" should be the Z shell, or a different > shell that's just lying. :-) Oh, noooooooooooo! ive got to go hide my head in the sand for 25 years... { it's so emmbarrassing!!} > > > with the bang stuff > > if you do a > > > > % !-3 > > > > you go back three vi cmds. !-N, N cmds. > > Yes, this also works in C shell. You can use the "h" (or "history") > builtin command to get an impression of content of the last commands > submitted to the shell. > > At least in csh, > > % !-1 > > equals > > % !! > > and repeats the last command. > > You could use the following command to print the last 20 commands > with the relative number (-1, -2, -3 and so on) printed infront of > them: > > % history 20 | awk 'BEGIN {cmds=20} { printf("\t%2d\t%s\n", -(cmds-i), $0); i++ }' > > It's probably a good idea to define an alias for that, like "h20" > (history of last 20 commands). my zsh does a default to 10 or so history with just % h I was trying to remember how to set it to ,, say, 100. I use as many zsh-isms as saves keystrokes. thanks for that awk shortcut; ill use ir... :_) > You could also use the zsh's equivalent of the "precmd" alias: It > is a command that will be executed prior to displaying the shell > prompt, so after you're done with a command, the last commands > (maybe shortened to 10, just substitute the two appearances of > the "20" to "10") will be displayed before the prompt appears; > this will make it easier (and save keystrokes) to check the last > commands and maybe repeat one. > > Downside: The command "pollutes" the list of commands with itself, > so it should probably be grepped away. good grief, man. I just got up from a nap... can you re-word that? no, kidding. I get it. (for as many centuries as ive been using vi [nvi], there are *still* things I never had need to learn. so it turns out that a lot of theses "clever" sh scripts are over my head .... it takes mins -> hours to figure out. > > % history 20 | awk 'BEGIN {cmds=20} { printf("\t%2d\t%s\n", -(cmds-i), $0); i++ }' | grep -v "history" > > It might be good to define a better exclusion pattern than just > "history" because that might lead to false-positives. I'd suggest > to rename the variables in the awk script to something unique and > then grep for those instead... > I have grep -v aliased to grv. > > > thankfully there are shortcuts! > > And shell aliases. :-) > > > > > ps: zsh is sort of a ksh clone; I remember porting the zsh onto > > my 286 in 1989. got a lot of csh-isms :) > > The Z shell combines nice interactive features of the C shell > (to be correct: the tcsh) and the scripting features of sh and > bash. It's considered one of the most powerful shells. So it's > a wise move to use it, because it combines "the _good_ things of > both worlds" (and not the bad things, as the csh is a terrible > scripting shell, just as plain sh is an awful dialog shell). > > > > -- > Polytropon > Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ... > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix Twenty-seven years of service to the Unix community. http://www.thought.org/HOPE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130926195132.GA24184>