zsh-users
 help / color / mirror / code / Atom feed
* permanent commands in history?
@ 2000-12-17 20:49 Dominik Vogt
  2000-12-17 23:06 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Vogt @ 2000-12-17 20:49 UTC (permalink / raw)
  To: zsh-users

There are some command lines that I use frequently, e.g.

  xemacs &!
  make CFLAGS="-Wall -Werror -O2 -g"
  fvwminstall -f

etc.  Most of the time these are in my command line history and
accessing them is easy, e.g.

  <m><cursor-up><return>

However, once in a while these are removed from the history file
(1000 lines).  Is is possible to make certain command lines
permanent in the history file so that I never have to retype them?
Of course I could write aliases, but then I would have to type
more letters to invoke the functions.

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, dominik.vogt@gmx.de
Reply-To: dominik.vogt@gmx.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: permanent commands in history?
  2000-12-17 20:49 permanent commands in history? Dominik Vogt
@ 2000-12-17 23:06 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-12-17 23:06 UTC (permalink / raw)
  To: dominik.vogt, zsh-users

On Dec 17,  9:49pm, Dominik Vogt wrote:
} Subject: permanent commands in history?
}
} There are some command lines that I use frequently [...]
} Most of the time these are in my command line history and
} accessing them is easy [...]
} However, once in a while these are removed from the history file
} (1000 lines).  Is is possible to make certain command lines
} permanent in the history file so that I never have to retype them?

Not exactly, but you can make it appear that way.

Put the commands in a file somewhere, say, ~/.zhistalways or whatever.
Then in ~/.zshrc, use the command

	fc -R ~/.zhistalways

This assumes that ((HISTSIZE > SAVEHIST)), because otherwise the history
read from $HISTFILE will cause those commands to fall off again.

Or you could use

	< ~/.zhistalways >> $HISTFILE

instead, to assure that those commands are always the most recent ones.

Either way, I'd recommend setting either the HIST_EXPIRE_DUPS_FIRST or the
HIST_IGNORE_ALL_DUPS options (assuming you're using 3.1.9).

Or you can take a different approach, and avoid using the history at all,
and instead use the completion system (again assuming 3.1.9).  I have a
file named "_cmdselect" in my $fpath:

    #compdef -k menu-select ^X:
    local -a commands
    commands=(${(f)"$(cat)"}) <<\EOF
     (list of commonly-repeated commands goes here, one per line)
    EOF
    compadd -Q "$commands[@]"

When I run "compinit", it finds that file, autoloads it, and binds it to
the key sequence control-X colon.  When I want to use one of my frequent
commands, I type a prefix and then C-x : and the completion system does
the rest; if I didn't make the prefix unique, I get a menu from which to
choose.  (If you don't like the menuing behavior, change `menu-select' to
`complete-word' or `menu-complete' in the above.)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-12-17 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-17 20:49 permanent commands in history? Dominik Vogt
2000-12-17 23:06 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).