zgodno.nemoj se ljutiti, ukral tvoj .zshpromptdevil je napisao/la:posto vec godinama ne koristm bash - moj .zshrc
http://pastie.org/1654484
prompt:
http://pastie.org/1654490
i kako to izgleda
http://ompldr.org/vN3FweA
bashrc
Moderator/ica: Moderatori/ce
-
Lutherus
Re: bashrc
Re: bashrc
Koja je razlika izmedu bash-a i z shella ili kak se vec zove
)
Re: bashrc
Zadnja izmjena: simke, dana/u 01 svi 2011, 22:36, ukupno mijenjano 5 puta.
I'm a Paladin with 18 charisma and 97 hit points. I can use my helm of disintegration and do one D4 damage as my half-elf mage wields his plus-five holy avenger.
-
Lutherus
Re: bashrc
Kod: Označi sve
if [[ "$TERM" = "rxvt-256color" ]]; then
(~/bin/color-default &)
fi
#=-=-=-=-=-=-=
# load stuffs
#=-=-=-=-=-=-=
autoload -U colors
autoload -U compinit
autoload -U vcs_info
zmodload zsh/complist
zmodload zsh/terminfo
# setopt
setopt autocd extendedglob
setopt prompt_subst
setopt inc_append_history
# start stuffs
colors
compinit
vcs_info
#=-=-=-=-
# zstyle
#=-=-=-=-
# vcs_info
zstyle ':vcs_info:*' enable git hg svn
zstyle ':vcs_info:*' check-for-changes true
# completion
# ignore completion to commands we don't have
zstyle ':completion:*:functions' ignored-patterns '_*'
# format autocompletion style
zstyle ':completion:*:descriptions' format "%{$fg[green]%}%d%{$reset_color%}"
zstyle ':completion:*:corrections' format "%{$fg[yellow]%}%d%{$reset_color%}"
zstyle ':completion:*:messages' format "%{$fg[red]%}%d%{$reset_color%}"
zstyle ':completion:*:warnings' format "%{$fg[red]%}%d%{$reset_color%}"
# zstyle show completion menu if 2 or more items to select
zstyle ':completion:*' menu select=2
# zstyle kill menu
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
export HISTSIZE=1000
export SAVEHIST=1000
export HISTFILE=~/.config/zsh.d/history
bindkey -v
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Import seperate config files
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
. ~/.config/zsh.d/prompt
. ~/.config/zsh.d/aliases
. ~/.config/zsh.d/functions
. ~/.config/zsh.d/fixkeys
. ~/.config/zsh.d/envars
envars http://pastebin.com/MyrbVuxC
functions http://pastebin.com/Skk3c1iU
prompt http://pastebin.com/tUm054Y3
- retsam
- Postovi: 2254
- Pridružen/a: 11 svi 2009, 16:26
- Spol: M
- OS: Arch Linux x86-64 subtle
- Lokacija: /dev/pts/0
Re: bashrc
Kod: Označi sve
# Exports
export EDITOR="vim"
export TZ="/usr/share/zoneinfo/Europe/Zagreb"
export PYTHONSTARTUP="$HOME/.pythonrc"
# Aliases
alias mv='nocorrect mv'
alias cp='nocorrect cp'
test -x /usr/bin/most && alias man='man -P most'
alias mkdir='nocorrect mkdir'
alias j=jobs
alias pu=pushd
alias po=popd
alias d='dirs -v'
alias h=history
alias help=run-help
alias grep='egrep --color=auto'
alias igrep='grep -i'
test -x /usr/share/vim/vim72/macros/less.sh && alias less='/usr/share/vim/vim72/macros/less.sh'
alias ll='ls -l'
alias la='ls -al'
alias ls='ls --color=always'
alias netcat='nc'
alias ..='cd ..'
alias install='packer -S'
alias remove='sudo pacman -R'
alias remnodep='sudo pacman -Rd'
alias search='packer -Ss'
alias upgrade='packer -Syu'
alias psg='ps aux | grep'
alias remove-spaces='find . -depth | rename "s/\ /_/g"'
alias whatismyip="wget -qO - http://checkip.dyndns.org | sed 's/[a-zA-Z<>/ :]//g'"
# Aliases for Vim
alias ctags-c++='ctags -R --c++-kinds=+p --fields=+iaS --extra=+q'
# History settings
HISTSIZE=1000 # Set command search history
HISTFILE=~/.zsh_history
SAVEHIST=100
# Override keymap selection
bindkey -e
## Fix key bindings
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "^H" backward-delete-word
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# Private sources
if [ -f "$HOME/.zshrc-private" ]; then
source ~/.zshrc-private
fi
# Other sources
if [ -f "/etc/zsh_command_not_found" ]; then
source /etc/zsh_command_not_found
fi
PATH="$HOME/bin:$PATH"
# Prompt
autoload colors zsh/terminfo
colors
autoload -U promptinit
promptinit
setopt promptsubst
local returncode="%{$fg[red]%}-%?-%{$reset_color%}"
PROMPT="[%{$terminfo[bold]$fg[cyan]%}%n%{${reset_color}%}\
@%{$fg[cyan]%}%m%{${reset_color}%}\
%{$fg[yellow]%}%(4c.%1c.%~)%{${reset_color}%}\
%{$fg[green]%}"'$(LC_MESSAGES=C ls -lah --color=never | grep total | tr -d total\ )'"%{${reset_color}%}\
%(?,, ${returncode})%{${reset_color}%}\
]%{$fg[white]%}%B%#%b%{${reset_color}%} "
RPROMPT="%{$fg[white]%}%T%{${reset_color}%}" # prompt for right side of screen
# Emulate tcsh's backward-delete-word
local WORDCHARS="${WORDCHARS:s#/#}"
# Autoload scripts in .zsh.d
setopt extended_glob
for zshrc_snipplet in ~/.zsh.d/S[0-9][0-9]*[^~] ; do
source $zshrc_snipplet
done
# Completion Styles
# list of completers to use
#zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
# allow one error for every three characters typed in approximate completer
zstyle -e ':completion:*:approximate:*' max-errors \
'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
# insert all expansions for expand completer
#zstyle ':completion:*:expand:*' tag-order all-expansions
# formatting and messages
#zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
#zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
#zstyle ':completion:*' group-name ''
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# offer indexes before parameters in subscripts
#zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
# command for process lists, the local web server details and host completion
#zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args'
#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
zstyle '*' hosts $hosts
# Filename suffixes to ignore during completion (except after rm command)
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
'*?.old' '*?.pro'
# the same for old style completion
#fignore=(.o .c~ .old .pro)
# ignore completion functions (until the _ignored completer)
zstyle ':completion:*:functions' ignored-patterns '_*'
archey3
Ken Thompson je napisao/la:One of my most productive days was throwing away 1000 lines of code.
Pikacode - Arch configs
Pikacode - dwm config
Re: bashrc
pitanje.
u kojem su odnosu bash i zsh!
tj, jeli zsh nasto iz bash-a, il? ono, mislim, dali sve sto vjrjedi za bash vrjedi i za zsh, al obrnuto ne.
u kojem su odnosu bash i zsh!
tj, jeli zsh nasto iz bash-a, il? ono, mislim, dali sve sto vjrjedi za bash vrjedi i za zsh, al obrnuto ne.
I'm a Paladin with 18 charisma and 97 hit points. I can use my helm of disintegration and do one D4 damage as my half-elf mage wields his plus-five holy avenger.
Re: bashrc
Djeluje zanimljivo, mogao bih probati taj zsh
Es gibt keinen Gott, kein Universum, keine menschliche Rasse, kein irdisches Leben, keinen Himmel, keine Hölle. Es ist alles ein Traum - ein grotesker und dummer Traum. Nichts existiert außer dir. Und du bist nur ein Gedanke - ein vagabundierender Gedanke, ein nutzloser Gedanke, ein heimatloser Gedanke, der verloren in der leeren Ewigkeit wandelt!
-
Lutherus
Re: bashrc
zsh ima svoje prednosti nad bash-om.osnovne naredbe su iste više manje u svim shellovim (jedino u korn shellu dobiješ glavobolju).
evo nekih stvari o zsh (bedem samo kopiral)
evo nekih stvari o zsh (bedem samo kopiral)
Kod: Označi sve
Acts extremely similar to bash. You can use zsh exactly the way you use bash and not learn a single thing, and even then it’s an improvement! Compatibility with familiar shells is very important. Switching from bash to zsh is not going to be like switching from GEdit to vim. You’ll be instantly at home in that all your bash shortcuts/commands will work as expected, but you’ll also have access to zsh’s goodies. If you’re a shell scripting addict, you’ll be pleased to know that zsh’s scripting syntax is mostly backwards-compatible with bash, too.
Typo correction. How many times have you typed something like aptg-et or other mangled commands? Well, if I do that in zsh, I get a message asking: “zsh: correct 'aptg-et' to 'apt-get' [nyae]? “. Magical, isn’t it? This autocorrect also applies to any parameters or paths or filenames you type.
Phenomenally intelligent tab completion. Wait… I hear what you’re saying already. “Duh you idiot, bash does this too! You just need to uncomment/install bash-completion.” No, that’s not what I mean. Can your bash:
Present suggestions in a menu that you can browse by arrow keys?
Complete the kill command by showing a menu of all your processes?
Complete the aptitude or ls commands by showing a menu of relevant parameters and a short description of what they do?
In addition to exact matches, show also near matches in a separate section?
Pop up completion options even for complex commands virtually instanteously, without bash’s dreaded “UH OH I should’ve typed a few more letters first!” delay?
If you could say yes to any of these questions, then please let me know! Because after 3 years of using bash, my bash sure doesn’t!
Share history across sessions. Multiple simultaneously running zsh sessions can share history with each other, rather than clobbering each other up. One of the most frustrating things to a bash user is typing in a long command, then searching for it again the next day via Ctrl+r, only to find it nowhere in the history.
Built in pager. I’m a lazy person. And I think you are, too. zsh comes with a pager directly in the shell. This means you can type things like <README and it is equivalent to less README or cat README | less
More powerful globbing. Globbing is the fancy term for “wildcards on steroids” — your matching expressions like “*.c” or “*Office*S03E[0-2][0-9]*.avi” and so on. As the zsh introduction shows, zsh gives you way more powerful globbing expressions. You’ll rarely find yourself forced to whip out the find command or a GUI search tool.
More bearable scripting language. If you’re not a shell scripter, you probably will have no idea what I’m talking, but all you shell scripters out there: Say goodbye to all those bash gotchas. How many times have you been bitten by a statement like [ $FOO = $BAR ] erroring out because FOO or BAR were empty, and then having to resort to silly tricks like [ x$FOO = x$BAR ] . Well, zsh has rescued you with its double-bracked comparisons. [[ $FOO = $BAR ]] will always work, and [[ $FOO && $BAR ]] comes a lot more naturally than [ $FOO -a $BAR ]. I can’t even begin to scratch the surface of zsh’s programming capabilities, but I encourage you to give it a shot!
A lot more. Remember, I’m a beginner too. I have just hit the tip of the iceberg myself. Consult zsh’s wonderful documentation (which I will link to later) for everything you want to know about zsh.
