[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Особенности Zsh



Конфиг с исправленными проблемами:
1. Убран алиас, заменяющий ar.
2. Убран вызов ls по Alt+L.
3. Настроен RPROPMT.

#
# Artiom N. Zsh local config file (~/.zshrc).
#

# See also:
#    https://github.com/robbyrussell/oh-my-zsh/
#    http://pastie.org/1073336
#

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.

# Good themes: gentoo, agnoster, duellj.

ZSH_THEME="gentoo"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/

# compleat - Bash-completion.
# debian - aliases to apt-*, dpkg and aptitude. Useful: apt-history, kerndeb.
# emoji-clock - clock. :-)
# encode64 - aliases to base64: e64, d64.
# gem - Ruby gem installer autocompletion.
# git - Git aliases.
# git-extras - Extra Git autocompletion.
# history-substring-search - searh substring in the shell history.
# jump - Easily jump around the file system by manually adding marks.
# kate - alias to kate (and Kate is started silently from console).
# mosh - simply map SSH autocompletion to mosh. No overhead.
# python - pyclean, pyfind, pygrep.
# rand-quote - random quote from http://www.quotationspage.com
#    (function `quote`).
# themes - add functions `theme` and `lstheme` for loading and listing
#    oh-my-zsh themes.
# torrent - magnet link to torrent file converter
#    (function `magnet_to_torrent`).
# urltools - `urldecode` and `urlencode` functions.
# web-search - search from the terminal. Aliases: bing, google, yahoo,
#    ddg (for Duckduckgo), wiki, news, youtube, map, image, ducky.

plugins=(colored-man compleat debian emoji-clock encode64 gem \
         git git-extras git-flow git-remote-branch history-substring-search \
         jump kate mosh python rand-quote themes torrent urltools)

# Interesting plugins:
# cp - replace 'cp' to 'rsync'.
# dircycle - cycling through directory stack.
# dirpersist - persistent directory stack.
# extract - extract archives, but I use my own function.
# fbterm - framebuffer terminal. Buggy on NVIDIA.
# git-flow-avh
# gitfast - fast Git autocompletion.
# github.
# gnu-utils - use GNU utilities for replace built-in functions.
# go/golang - Google Go language compiler autocompletion.
# nyan - animated terminal nyan cat.
# pass - password manager.
# per-directory-history - history unique for each directory.
# perl - aliases for Perl.
# pj - simple project manager.
# postgres - aliases for starting/restarting Postgres SQL.
# rails. rails3, rails4 - aliases for Ruby On Rails.
# redis-cli - Redis database client completion.
# rsync - aliases for rsync (rsync-copy, rsync-move, rsync-update,
#    rsync-synchronize).
# ruby - aliases: rfind, rgem.
# safe-paste - safe paste text to the X-terminal.
# scala - autocompletion for Scala compiler.
# screen - plugin for GNU Screen.
# sprunge - command line Pastebin (function `sprunge`).
# ssh-agent - wrapper for the SSH autentification agent.
# sublime - set paths for Sublime text editor on MacOS X and add alias `stt`
#    on all systems.
# svn  - functions for Subversion (like svn_get_branch_name).
# systemd - add aliases with sudo for the system.d commands (start, stop,
#    restart, etc.).
# taskwarrior - console task manager.
# vi-mode - enable handy Vim mode in the terminal.
# vundle - bundle manager for Vim.
# yum - Aliases for Yum commands. For RH-based.

source $ZSH/oh-my-zsh.sh

# Autocompletion.
# Enabled in oh-my-zsh.
# autoload -Uz compinit && compinit

# Enabling user-names completion, disabled in oh-my-zsh.
zstyle -d ':completion:*' users

# Какой-то ненормальный в oh-my-zsh забиндил Alt+L на вызов ls. Убираю.
bindkey -r '\el'
bindkey '\el' down-case-word

# Setting in oh-my-zsh.
# Share history between shells.
#setopt share_history

# Ignore duplicity commands in history.
#setopt hist_ignore_all_dups

# Don't save in history commands, beginning with space.
#setopt hist_ignore_space

# Don't save command «history» or «fc» in history.
setopt hist_no_store

# Bash-like '='
setopt no_equals

# В «1 2 3» и «a b c d» соответственно
setopt braceccl

# Файлы с цифрами сортировать числовым методом, а не лексическим
setopt numeric_glob_sort

# Save execution time of the command in the history.
setopt extended_history

# Disable autocorrect.
unsetopt correct_all

# For Debian plugin.
unalias ar

# Customize to your needs...
export PATH=$PATH:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/bin

#if [ "$color_prompt" = yes ]; then
#   PS1=$'%{\e[01;32m%}%n@%m%{\e[00m%}:%{\e[01;34m%}%~%{\e[00m%}$ '
#   PS1=$'%{$fg_bold[green]%}%n@%m%{$reset_colors%}:%{$fg_bold[blue]%}%~%{$reset_color%}$ '
#else
#    PS1='%n@%m:%~$ '
#fi

# Right-hand prompt.
#RPROMPT='%{$fg[red]%} ⏎ $? %{$reset_color%} '$RPROMPT
get_rp()
{
   if [[ $1 == 0 ]]; then
      rp="%{$fg[green]%}"
   else
      rp="%{$fg[red]%}"
   fi

   rp=$rp"$(emoji-clock) %{$reset_color%}"

   echo -n "$rp"
}

RPROMPT='$(get_rp $?) '$RPROMPT

# Error-correction prompt.
#SPROMPT="	$fg[red]%R →$reset_color $fg[green]%r?$reset_color (Yes, No, Abort, Edit) "

# Vim key bindings (-e for Emacs). Enabled in plugin.
#bindkey -v

# Console calculator.
#autoload zcalc

case $TERM in
  xterm* | rxvt*)
    # precmd вызывается непосредственно перед выводом prompt
    precmd() {
      print -Pn "\e]0;zsh\a"
    }

    # preexec вызывается перед выполнением команды
    # $1 — имя команды (точнее, вся команда со всеми переданными параметрами)
    # sed используется для «отрезания» от команды параметров
    preexec() {
      print -Pn "\e]0;`echo $1 | sed -r 's/^([^[:space:]]+).*/\1/'`\a"
    }
  ;
esac


Reply to: