+++ title = "shellconfig" draft = false tags = [ "unix", "shellconfig" ] date = "2013-03-12" +++ # Shell Configuration ## ZShell ```bash ############################################ #### Jefklak's ZSH Config file #### #### Last Edited: 18/10/2005 #### #### Thank you Gentoo Forum! #### ############################################ #### FreeBSD Specific stuff here #### # export CLICOLOR=yes for the BSD ls thing (flag -G) # LSCOLORS=fxgxcxdxbxegedabagacad; export LSCOLORS #### Envoirnment Variables #### export HOSTTYPE="$(uname -m)" export COLORTERM=yes export LINKS_XTERM=screen # Fixes Savage mouse problems. export SDL_VIDEO_X11_DGAMOUSE=0 #### Aliases #### alias vi="vim" alias ..="cd .. && ls" alias del="nocorrect rm -rf" alias mv="nocorrect mv -f" alias cp="cp -rf" alias cls='clear' alias l="ls -la" alias showstuff="figlet unix rocks | cowsay -n -d;uname -a" #### set the console title #### case $TERM in xterm*) PR_TITLEBAR######$'%{
e]0;%(!.-*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y
a%}' ;; *rxvt*) PR_TITLEBAR######$'%{
e]0;%(!.-*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y
a%}' ;; *) PR_TITLEBAR='' ;; esac #### the prompt style #### # check for colors autoload colors zsh/terminfo if [ "$terminfo[colors]" -ge 8 ]({{< relref " "$terminfo[colors]" -ge 8 .md" >}}); then colors; fi for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE do eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' (( count = $count + 1 )) done PR_NO_COLOUR="%{$terminfo[sgr0]%}" PROMPT='${(e)PR_TITLEBAR}
$PR_BLUE($PR_YELLOW%D{%H:%M}$PR_BLUE)$PR_CYAN-
$PR_BLUE(%{%}%n@%m%{%}$PR_BLUE)$PR_CYAN-
$PR_BLUE($PR_YELLOW$(ls | wc -l | bc) files$PR_BLUE) %(30l. .)${PR_CYAN}[$PR_MAGENTA %}%.%{%} ${PR_CYAN}]${PR_WHITE} >> ' RPROMPT=$'%{
e[0;15m
e[0;15m%}' #### General Config setup #### # SCREENDIR will screw screen up unset SCREENDIR # Make sure no cores can be dumped while zsh is in charge. limit coredumpsize 0 # History things >> history -10 recalls the latest 10 history commands # !! re-uses the last command. ![command number] re-uses that command. HISTFILE=$HOME/.zshist SAVEHIST=500 HISTSIZE=800 TMPPREFIX=/tmp #### Autocompletion rules #### # general setup autoload -U compinit compinit compctl -g '*(-/)' + -g '.*(-/)' -v cd pushd rmdir compctl -k hosts -x 'p[2,-1]' -l '' -- rsh ssh # "man" auto-completion compctl -f -x 'S[1][2][3][4][5][6][7][8][9]' -k '(1 2 3 4 5 6 7 8 9)'
1. 'R[[1-9nlo]|[1-9](|[a-z]),^*]' -K 'match-man'
2. 's[-M],c[-1,-M]' -g '*(-/)'
3. 's[-P],c[-1,-P]' -c
4. 's[-S],s[-1,-S]' -k '( )'
5. 's[-]' -k '(a d f h k t M P)'
6. 'p[1,-1]' -c + -K 'match-man'
-- man # other completitions compctl -b bindkey compctl -v export compctl -o setopt compctl -v unset compctl -o unsetopt compctl -v vared compctl -c which compctl -c sudo #### Key bindings, useful. #### # get the code by pressing C-v and then a code bindkey "
e[3~" delete-char bindkey "
e[7~" beginning-of-line bindkey "
e[8~" end-of-line bindkey "
e[5~" history-search-backward bindkey "
e[6~" history-search-forward bindkey "[3~" delete-char # Del bindkey "[2~" overwrite-mode # Insert bindkey "^[[Z" reverse-menu-complete # shift+tab # Setting HOME and END keys to browse the last used commands case $TERM in (xterm*|aterm|rxvt) bindkey '
e[H' beginning-of-line bindkey '
e[F' end-of-line ;; esac # ======================================= # following lines were set automatically! # ======================================= # Select Prompt zstyle ':completion:*' menu select=1 # Expansion options zstyle ':completion:*' completer _complete _prefix zstyle ':completion::prefix-1:*' completer _complete zstyle ':completion:incremental:*' completer _complete _correct zstyle ':completion:predict:*' completer _complete # Completion caching zstyle ':completion::complete:*' use-cache 1 zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST # Expand partial paths zstyle ':completion:*' expand 'yes' zstyle ':completion:*' squeeze-slashes 'yes' # Include non-hidden directories in globbed file completions # for certain commands zstyle ':completion::complete:*' '
' # Use menuselection for pid completion zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:kill:*' force-list always # tag-order 'globbed-files directories' all-files zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)' # Don't complete backup files as executables zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*
~' # Separate matches into groups zstyle ':completion:*:matches' group 'yes' # With commands like rm, it's annoying if you keep getting offered the same # file multiple times. This fixes it. Also good for cp, et cetera.. zstyle ':completion:*:rm:*' ignore-line yes zstyle ':completion:*:cp:*' ignore-line yes # Describe each match group. zstyle ':completion:*:descriptions' format "%B---- %d%b" # Messages/warnings format zstyle ':completion:*:messages' format '%B%U---- %d%u%b' zstyle ':completion:*:warnings' format '%B%U---- no match for: %d%u%b' # Describe options in full zstyle ':completion:*:options' description 'yes' zstyle ':completion:*:options' auto-description '%d' # Simulate spider's old abbrev-expand 3.0.5 patch zstyle ':completion:*:history-words' stop verbose zstyle ':completion:*:history-words' remove-all-dups yes zstyle ':completion:*:history-words' list false # Follow GNU LS_COLORS zmodload -i zsh/complist #eval "`dircolors ~/.dir_colors`" export ZLSCOLORS="${LS_COLORS}" zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*:*:kill:*' list-colors '######%*01;31' # zsh Options. setopt
NO_all_export
always_last_prompt
nohashdirs
always_to_end
append_history
auto_cd
auto_list
auto_menu
auto_name_dirs
auto_param_keys
auto_param_slash
auto_pushd
auto_remove_slash
NO_auto_resume
bad_pattern
bang_hist
NO_beep
brace_ccl
correct_all
NO_bsd_echo
cdable_vars
NO_chase_links
clobber
complete_aliases
complete_in_word
correct
NO_correct_all
csh_junkie_history
NO_csh_junkie_loops
NO_csh_junkie_quotes
NO_csh_null_glob
equals
extended_glob
extended_history
function_argzero
glob
NO_glob_assign
glob_complete
NO_glob_dots
glob_subst
NO_hash_cmds
NO_hash_dirs
hash_list_all
hist_allow_clobber
hist_beep
hist_ignore_dups
hist_ignore_space
NO_hist_no_store
hist_verify
NO_hup
NO_ignore_braces
NO_ignore_eof
interactive_comments
inc_append_history
NO_list_ambiguous
NO_list_beep
list_types
long_list_jobs
magic_equal_subst
NO_mail_warning
NO_mark_dirs
menu_complete
multios
nomatch
notify
NO_null_glob
numeric_glob_sort
NO_overstrike
path_dirs
posix_builtins
NO_print_exit_value
NO_prompt_cr
prompt_subst
pushd_ignore_dups
NO_pushd_minus
pushd_silent
pushd_to_home
rc_expand_param
NO_rc_quotes
NO_rm_star_silent
NO_sh_file_expansion
sh_option_letters
short_loops
NO_sh_word_split
NO_single_line_zle
NO_sun_keyboard_hack
unset
NO_verbose
zle ```