There is no way to get the default value for an undefined variable, except for processing documentation or source code.
HISTSIZE and SAVEHIST are not settings; they are special variables. There is a way to list all the variables, but I do not know how to list those that are special and are used as settings.
To help you list parameters implemented as variables, there is a zsh/parameter module ( zmodload zsh/parameter to load it). It has an associative array of $parameters , where keys are variable names and values โโare variable type descriptions. Both HISTSIZE and SAVEHIST appear there as integer-special . HISTCHARS appears there as a scalar-special . Note that RANDOM appears here as HISTSIZE : integer-special , so you cannot use this to get special variables used as parameters. But you can always use the PARAMETERS USED BY THE SHELL man zshparam .
I do not know a single parameter that will allow you to define default values โโfor these parameters, except for parsing documentation or source code.
# setopt | grep hist nobanghist extendedhistory histfcntllock histignorealldups histignorespace histnostore histreduceblanks histsavenodups histverify incappendhistory
If you want to see settings other than the default settings:
If no arguments are specified, the names of all currently set parameters will be printed. The form is selected in such a way as to minimize the default differences for the current emulation (by default, the emulation is native zsh, shown as in zshoptions (1)). The parameters that are enabled by default for emulation are displayed with a prefix not only if they are turned off, while other parameters are displayed without a prefix, and only if they are turned on. In addition to the parameters changed by the user by default, any parameters automatically activated by the shell (for example, SHIN_STDIN or INTERACTIVE) will be displayed in the list. The format is additionally modified by the KSH_OPTION_PRINT option, however, the rationale for choosing parameters with a prefix with or without it remains unchanged in this case.
It also makes sense to use:
# unsetopt | grep hist noappendhistory cshjunkiehistory histallowclobber nohistbeep histexpiredupsfirst histfindnodups histignoredups histlexwords histnofunctions nohistsavebycopy histsubstpattern sharehistory
If no arguments are specified, the names of all disabled options will be printed.
Or just follow the tips and use
# setopt kshoptionprint
Note that the output of setopt and unsetopt same as the kshoptionprint parameter.