Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2013 22:46:56 -0400
From:      "Karl Vogel" <vogelke@pobox.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: minor vi/vim qstn
Message-ID:  <20130927024656.GA27195@amd118.wpafb.af.mil>
In-Reply-To: <20130926220506.d9c11563.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> <20130926195132.GA24184@ethic.thought.org> <20130926220506.d9c11563.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
>> On Thu, Sep 26, 2013 at 10:05:06PM +0200, Polytropon wrote:
P> Depending on _typical_ terminal heights (100 lines?), this [history
P> setting] seems to be a bit high.  But I assume zsh handles the "h"
P> alias similarly to the csh, where an alias is defined (system-wide in
P> /etc/csh.cshrc or per user in ~/.cshrc).

   The "fc" builtin can be helpful here.  I like to see my recent history
   without numbering, so I can highlight/rerun/store any useful subset of
   commands:

    # history without command numbers, look for optional pattern.
    h () {
        case "$#" in
            0)  fc -ln 1 | less +G ;;
            *)  fc -ln 1 | grep ${1+"$@"} ;;
        esac
    }

   If I dork up my history beyond belief, edit and reload the whole thing:

    histedit () {
        x="$HOME/.histedit"
        fc -W $x && vi $x && fc -R $x && rm $x
    }

>> In a previous message:
P> % history 20 | awk 'BEGIN {cmds=20} ... | grep -v "history"

   You can avoid some history pollution with these settings, at least in
   ZSH version 4.3.10:

    setopt histignoredups   # don't store duplicate lines in command history
    setopt histnostore      # don't store history commands in history

   Other settings I've found useful:

    setopt autocd           # go to a directory if first word on command line
                            # is not a command but is a directory
    setopt autoresume       # single-word commands may resume a suspended job
    setopt cdablevars       # allows cd'ing to a parameter
    setopt correct          # try to correct the spelling of commands
    setopt csh_junkie_loops # allow short form of loops: list; end
    setopt extendedglob     # allow # and ^ to be used for filename generation
    setopt extended_history # format: <start-time>:<elapsed-sec>:<command>
    setopt globdots         # don't require leading . in filename to be matched
    setopt ignoreeof        # don't logout using Control-D
    setopt longlistjobs     # list jobs in long format by default
    setopt markdirs         # append trailing / to dirnames
    setopt menucomplete     # cycle through completions when ambiguous
    setopt numeric_globsort # sort numeric filenames numerically
    setopt noclobber        # don't overwrite existing files
    setopt notify           # tell me when a job finishes
    setopt rcquotes         # '' = single quote in single-quoted strings
    unsetopt bgnice         # don't run background jobs at lower priority

-- 
Karl Vogel                      I don't speak for the USAF or my company
vogelke at pobox dot com                   http://www.pobox.com/~vogelke

Teenage girl creates sustainable, renewable algae biofuel under her bed
                                    --Extreme Tech headline, 19 March 2013



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130927024656.GA27195>