>> 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
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to