diff --git a/_posts/2014-01-14-about-zshrc.html b/_posts/2014-01-14-about-zshrc.html index 9472f9f..a210306 100644 --- a/_posts/2014-01-14-about-zshrc.html +++ b/_posts/2014-01-14-about-zshrc.html @@ -10,7 +10,7 @@ commentIssueId: 5

Prepare

First install recommended minima:

pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
-

pkgfile is a very useful utility. Alo this command will install shell, additional completion and syntax highlighting.

+

pkgfile is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.

Shell configuration

All options are avaible here.

@@ -69,7 +69,7 @@ autoload zcalc
# append history
 setopt APPEND_HISTORY

Do not save dups to history file:

-
# ignore dups in history
+
# ignore spaces in history
 setopt HIST_IGNORE_ALL_DUPS

...and additional spaces:

# ignore dups in history
@@ -82,7 +82,7 @@ setopt HIST_REDUCE_BLANKS
source /usr/share/doc/pkgfile/command-not-found.zsh

Syntax highlighting

-
# highlighting +
# highlighting
 source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
 # brackets
@@ -125,12 +125,12 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
 # pattern example
 #ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
 # root example
-#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
+#ZSH_HIGHLIGHT_STYLES[root]='bg=red'

In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (rm -rf * in the example). Also root and cursor highlighting may be turned on. Colors syntax is understandable, fg is font color, bg is background color.

$PROMPT and $RPROMPT

The general idea is the use single .zshrc for root and normal user:

-
# PROMPT && RPROMPT +
# PROMPT && RPROMPT
 if [[ $EUID == 0 ]]; then
 # [root@host dir]#
   PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
@@ -147,9 +147,9 @@ else
 %{$fg_no_bold[green]%}%m %{$reset_color%}\
 %{$fg_bold[yellow]%}%1/%{$reset_color%}\
 %{$fg_bold[white]%}]$ %{$reset_color%}"
-fi
+fi -

fg is font color, bg is background color. \_bold and \_no_bold regulate the tint. Commands should be in %{ ... %} so they do not appear. Avaible colors are:

+

fg is font color, bg is background color. _bold and _no_bold regulate the tint. Commands should be in %{ ... %} so they do not appear. Avaible colors are:

black
 red
 green
@@ -160,7 +160,7 @@ cyan
 white

Avaible variables are:

-
%n - the username +
%n  - the username
 %m  - the computer's hostname (truncated to the first period)
 %M  - the computer's hostname
 %l  - the current tty
@@ -171,10 +171,10 @@ white
%D - system date(YY-MM-DD) %d - the current working directory %~ - the same as %d but if in $HOME, this will be replaced by ~ -%1/ - the same as %d but only last directory
+%1/ - the same as %d but only last directory

RPROMPT (acpi package is necessary):

-
precmd () { +
precmd () {
   # battery charge
   function batcharge {
     bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
@@ -195,7 +195,7 @@ white
$(batcharge)\ "%{$fg_bold[white]%}[%{$reset_color%}"\ $returncode\ -"%{$fg_bold[white]%}]%{$reset_color%}"
+"%{$fg_bold[white]%}]%{$reset_color%}"

My RPROMPT shows current time, battery change and last returned code. precmd() is necessary for automatic updating. The construct $(if.true.false) is conditional statement in zsh.

Aliases

@@ -208,7 +208,7 @@ $returncode\ }

Here is the first group of aliases:

-
## alias +
## alias
 # colored grep
 alias grep='grep --colour=auto'
 # change top to htop
@@ -224,7 +224,7 @@ alias du='show_which du && du -k --total --human-readable'
 alias less='vimpager'
 alias zless='vimpager'
 # more interactive rm
-alias rm='show_which rm && rm -I'
+alias rm='show_which rm && rm -I'

Here are ls aliases (see man ls):

alias ls='show_which ls && ls --color=auto'
@@ -246,7 +246,7 @@ autoload -U pick-web-browser
 alias -s {html,htm}=opera

Here are "sudo" aliases:

-
# sudo alias +
# sudo alias
 if [[ $EUID == 0 ]]; then
   alias fat32mnt='show_which fat32mnt && mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
   alias synctime='show_which synctime && { ntpd -qg; hwclock -w; date; }'
@@ -264,7 +264,7 @@ else
   alias rmmod='show_which rmmod && sudo rmmod'
   alias staging-i686-build='show_which staging-i686-build && sudo staging-i686-build'
   alias staging-x86_64-build='show_which staging-x86_64-build && sudo staging-x86_64-build'
-fi
+fi

Here are global aliases. If they are enable the command cat foo g bar will be equivalent the command cat foo | grep bar:

# global alias
@@ -277,7 +277,7 @@ alias -g dn="&> /dev/null &"

Functions

Here is a special function for xrandr:

-
# function to contorl xrandr +
# function to contorl xrandr
 # EXAMPLE: projctl 1024x768
 projctl () {
   if [ $1 ] ; then
@@ -296,10 +296,10 @@ projctl () {
     echo "Using default resolution"
     xrandr --output VGA1 --mode 1366x768 --output LVDS1 --mode 1366x768
   fi
-}
+}

Unfortunately I can not remember tar flags thus I use special functions:

-
# function to extract archives +
# function to extract archives
 # EXAMPLE: unpack file
 unpack () {
   if [[ -f $1 ]]; then
@@ -347,10 +347,10 @@ pack () {
   else
     echo "'$1' is not a valid file"
   fi
-}
+}

Here is a special function for su:

-
su () { +
su () {
   checksu=0
   for flags in $*; do
     if [[ $flags == "-" ]]; then
@@ -363,19 +363,19 @@ pack () {
   else
     /usr/bin/su $*
   fi
-}
+}

Functions with automatic rehash after installing/removing packages are:

-
pacman () { - /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\\|R\\|U" && rehash +
pacman () {
+  /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash
 }
 yaourt () {
-  /usr/bin/yaourt $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
+  /usr/bin/yaourt $* && echo "$*" | grep -q "S\|R\|U" && rehash
 }
 # for testing repo
 yatest () {
-  /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
-}
+ /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash +}

But autocomplete for yaourt -Ss will require root privileges.

Variables

diff --git a/index.html b/index.html index d3048f5..c9538ca 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,7 @@ title: arcanis' homepage

Welcome

-

Welcome to my homepage, `echo $USERNAME`. About me you may read on the link. I'm sorry I don't know html/php/ruby/etc (but I know GoogleFOO! At least, I think so), therefore this page may not look very pretty. But I tried (or may be not). In the blog I will write some papers about programming, living in Archlinux system and may be package maintaining. Also I will create pages for some of my projects.

+

Welcome to my homepage, `echo $USERNAME`. About me you may read on the link. I'm sorry I don't know html/php/ruby/etc (but I know GoogleFOO! At least, I think so), therefore this page may not look very pretty. But I tried (or may be not). In the blog I will write some papers about science, programming, living in Archlinux system and may be package maintaining. Also I will create pages for some of my projects.

Contact me

If you have a question or something else you may contact me. If you want to suggest a pull request or to create a bug report for these pages (or may be for some other projects) feel free to visit my Github profile and do it.

diff --git a/ru/_posts/2014-01-14-about-zshrc.html b/ru/_posts/2014-01-14-about-zshrc.html index e9719e9..b3adbcf 100644 --- a/ru/_posts/2014-01-14-about-zshrc.html +++ b/ru/_posts/2014-01-14-about-zshrc.html @@ -2,27 +2,27 @@ category: ru layout: paper last: 14 January 2014 -tags: zshrc, configuration, linux -title: About zshrc +tags: zshrc, настройка, linux +title: О zshrc short: about-zshrc -description: РУССКИЙ. It is first paper in my blog (I think I need something here for tests =)). There are many similar articles, and I'll not be an exception. I just want to show my .zshrc and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (original). +description: Это моя статья в моем блоге (я думаю, мне нужно что-нибудь для тестов =)). Существует множество похожих статей и, я думаю, не буду отличаться от большинства. Я просто хочу показать мой .zshrc и объяснить, что в нем есть и зачем оно нужно. Также, любые комментарии или дополнения приветствуются. Оригинал статьи. commentIssueId: 5 --- -

Prepare

-

First install recommended minima:

+

Подготовка

+

Сначала установите необходимый минимум:

pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
-

pkgfile is a very useful utility. Alo this command will install shell, additional completion and syntax highlighting.

+

pkgfile очень полезная утилита. Данная команда также установит шелл, дополнения к нему и подсветку синтаксиса.

-

Shell configuration

-

All options are avaible here.

+

Настройка шелла

+

Все доступные опции приведены здесь.

-

Set history file and number of commands in cache of the current session and in the history file:

+

Указываем файл с историей, число команд хранящихся в кэше текущего сеанса и число команд, хранящихся в файле:

# history
 HISTFILE=~/.zsh_history
 HISTSIZE=500000
 SAVEHIST=500000
-

I can not remember all Ctrl+ combinations so I bind keys to its default usages:

+

Я не могу запомнить все комбинации Ctrl+, поэтому я назначаю клавиши на их стандартное использование:

# bindkeys
 bindkey '^[[A'  up-line-or-search        # up arrow for back-history-search
 bindkey '^[[B'  down-line-or-search      # down arrow for fwd-history-search
@@ -32,58 +32,58 @@ bindkey '\e[3~' delete-char              # del
 bindkey '\e[4~' end-of-line              # end
 bindkey '\e[5~' up-line-or-history       # page-up
 bindkey '\e[6~' down-line-or-history     # page-down
-

But in this case Up/Down arrows are used to navigate through the history based on already entered part of a command. And PgUp/PgDown will ignore already entered part of a command.

+

Но здесь важно, что стрелки вверх/вниз служат для навигации по истории с учетом уже введенной части команды. А PgUp/PgDown проигнорирую уже введенную часть команды.

-

Command autocomplete:

+

Автодополнение команд:

# autocomplete
 autoload -U compinit
 compinit
 zstyle ':completion:*' insert-tab false
 zstyle ':completion:*' max-errors 2
-

Full command autocomplete will be enabled. insert-tab false will enable autocomplete for non-entered commands. max-errors sets maximum number of errors that could be corrected.

+

Подключается полное автодополнение команд. insert-tab false включит автодополнение для невведенной команды (не знаю, зачем). max-errors устанавливает максимальное число опечаток, которые могут быть исправлены.

-

Prompt:

+

Приглашение:

# promptinit
 autoload -U promptinit
 promptinit
-

Enable colors:

+

Включим цвета:

# colors
 autoload -U colors
 colors
-

Here are some other options.

-

Change directory without cd:

+

Различные опции.

+

Смена директории без ввода cd:

# autocd
 setopt autocd
-

Correcting of typos (and question template):

+

Корректировка опечаток (и шаблон вопроса):

# correct
 setopt CORRECT_ALL
 SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
-

Disable f#$%ing beep:

+

Отключаем е#$%ую пищалку:

# disable beeps
 unsetopt beep
-

Enable calculator:

+

Включаем калькулятор:

# calc
 autoload zcalc
-

Append history (do not recreate the history file):

+

Дополнение истории (а не перезапись файла):

# append history
 setopt APPEND_HISTORY
-

Do not save dups to history file:

+

Не сохранять дубликаты в историю:

# ignore dups in history
 setopt HIST_IGNORE_ALL_DUPS
-

...and additional spaces:

-
# ignore dups in history
+

...и дополнительные пробелы:

+
# ignore spaces in history
 setopt HIST_IGNORE_SPACE
-

...and blank lines too:

+

...и пустые линии тоже:

# reduce blanks in history
 setopt HIST_REDUCE_BLANKS
-

Enable pkgfile:

+

Включаем pkgfile:

# pkgfile
 source /usr/share/doc/pkgfile/command-not-found.zsh
-

Syntax highlighting

-
# highlighting +

Подсветка синтаксиса

+
# highlighting
 source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
 # brackets
@@ -95,43 +95,43 @@ ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold'
 #ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue'
 # main
 # default
-ZSH_HIGHLIGHT_STYLES[default]='none'
+ZSH_HIGHLIGHT_STYLES[default]='none'                                 # стандартный цвет
 # unknown
-ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'
+ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'                         # неизвестная команда
 # command
-ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold'
-ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold'
-ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold'
-ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold'
-ZSH_HIGHLIGHT_STYLES[command]='fg=green'
-ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold'
-ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow'
-ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green'
-ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold'
-ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold'
+ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta,bold'                # зарезервированное слово
+ZSH_HIGHLIGHT_STYLES[alias]='fg=yellow,bold'                         # алиас
+ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold'                        # built-in функция (например, echo)
+ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold'                       # функция, определенная в шелле
+ZSH_HIGHLIGHT_STYLES[command]='fg=green'                             # обычная команда
+ZSH_HIGHLIGHT_STYLES[precommand]='fg=blue,bold'                      # пре-команда (например, sudo в sudo cp ...)
+ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow'                   # разделитель команд, && || ;
+ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green'                      # команда, найденная в путях (hashed)
+ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold'            # флаги типа -*
+ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold'            # флаги типа --*
 # path
-ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold'
-ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan'
+ZSH_HIGHLIGHT_STYLES[path]='fg=cyan,bold'                            # станлартный путь
+ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=cyan'                          # префикс пути
+ZSH_HIGHLIGHT_STYLES[path_approx]='fg=cyan'                          # примерный путь
 # shell
-ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue'
-ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta'
-ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan'
-ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue'
+ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan'                             # шаблон (например, /dev/sda*)
+ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=blue'                    # подстановка из истории (команда, начинающаяся с !)
+ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta'                            # присвоение
+ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan'        # конструкции типа "$VARIABLE"
+ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan'          # конструкции типа \"
+ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=blue'                 # конструкции типа `command`
 # quotes
-ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline'
-ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
-# pattern example
+ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow,underline'   # конструкции типа 'text'
+ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'             # конструкции типа "text"
+# pattern
 #ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
-# root example
-#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
-

In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (rm -rf * in the example). Also root and cursor highlighting may be turned on. Colors syntax is understandable, fg is font color, bg is background color.

+# root +#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
+

В первой строке включаем подсветку. Затем включаем основную подсветку, а также подсветку скобок и шаблонов. Шаблоны указываются ниже (rm -rf * в примере). Также может быть включена подсветка команд от root и курсора cursor. Синтаксис настроек понятен, fg цвет шрифта, bg цвет фона.

-

$PROMPT and $RPROMPT

-

The general idea is the use single .zshrc for root and normal user:

-
# PROMPT && RPROMPT +

$PROMPT и $RPROMPT

+

Я хочу использовать один файл .zshrc для рута и обычного пользователя:

+
# PROMPT && RPROMPT
 if [[ $EUID == 0 ]]; then
 # [root@host dir]#
   PROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
@@ -148,9 +148,9 @@ else
 %{$fg_no_bold[green]%}%m %{$reset_color%}\
 %{$fg_bold[yellow]%}%1/%{$reset_color%}\
 %{$fg_bold[white]%}]$ %{$reset_color%}"
-fi
+fi -

fg is font color, bg is background color. \_bold and \_no_bold regulate the tint. Commands should be in %{ ... %} so they do not appear. Avaible colors are:

+

fg цвет шрифта, bg цвет фона. _bold и _no_bold регулируют оттенок. Команды должны быть обрамлены в %{ ... %}, чтобы не показывались. Доступные цвета:

black
 red
 green
@@ -160,22 +160,22 @@ magenta
 cyan
 white
-

Avaible variables are:

-
%n - the username -%m - the computer's hostname (truncated to the first period) -%M - the computer's hostname -%l - the current tty -%? - the return code of the last-run application. -%# - the prompt based on user privileges (# for root and % for the rest) -%T - system time(HH:MM) -%* - system time(HH:MM:SS) -%D - system date(YY-MM-DD) -%d - the current working directory -%~ - the same as %d but if in $HOME, this will be replaced by ~ -%1/ - the same as %d but only last directory
+

Доступные переменные:

+
%n  - имя пользователя
+%m  - хостнейм (выставляется только в начале сессии)
+%M  - хостнейм
+%l  - текущая tty
+%?  - код возврата предыдущего приложения
+%#  - # для рута и % для обычных пользователей
+%T  - время (HH:MM)
+%*  - время (HH:MM:SS)
+%D  - дата (YY-MM-DD)
+%d  - текущая директория
+%~  - то же, домашняя директория будет заменена на ~
+%1/ - то же, но только последняя директория
-

RPROMPT (acpi package is necessary):

-
precmd () { +

RPROMPT (необходим пакет acpi):

+
precmd () {
   # battery charge
   function batcharge {
     bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
@@ -196,38 +196,38 @@ white
$(batcharge)\ "%{$fg_bold[white]%}[%{$reset_color%}"\ $returncode\ -"%{$fg_bold[white]%}]%{$reset_color%}"
-

My RPROMPT shows current time, battery change and last returned code. precmd() is necessary for automatic updating. The construct $(if.true.false) is conditional statement in zsh.

+"%{$fg_bold[white]%}]%{$reset_color%}" +

Мой RPROMPT показывает текущее время, заряд батареи и код возврата последнего приложения. precmd() необходимо для автоматического обновления. Конструкция $(if.true.false) является условным оператором в zsh.

-

Aliases

-

Copy only those aliases that you need. If any alias uses application that is not installed it will leads to fail of loading of configuration file.

+

Аллиасы

+

Копируйте только те аллиасы, которые Вам необходимы. Если какой-либо аллиас использует приложение, которое не установлено, это приведет к сбою загрузки конфигурационного файла.

-

Small useful (or maybe not) function:

+

Полезная (или не очень) функция:

show_which() {
   OUTPUT=$(which $1 | cut -d " " -f7-)
   echo "Running '$OUTPUT'" 1>&2
 }
-

Here is the first group of aliases:

-
## alias -# colored grep +

Первая группа аллиасов:

+
## alias
+# цветной grep
 alias grep='grep --colour=auto'
-# change top to htop
+# замена top на htop
 alias top='show_which top && htop'
-# chromium with different proxy servers (i2p and tor included)
+# chromium с различными прокси серверами (i2p и tor в наличии)
 alias chrommsu='show_which chrommsu && chromium --proxy-server=cache.msu:3128'
 alias chromtor='show_which chromtor && chromium --proxy-server="socks://localhost:9050" --incognito'
 alias chromi2p='show_which chromi2p && chromium --proxy-server="http=127.0.0.1:4444;https=127.0.0.1:4445" --incognito'
-# human-readable df and du
+# человеческие df и du
 alias df='show_which df && df -k --print-type --human-readable'
 alias du='show_which du && du -k --total --human-readable'
-# change less and zless to vimpager
+# замена less и zless на vimpager
 alias less='vimpager'
 alias zless='vimpager'
-# more interactive rm
-alias rm='show_which rm && rm -I'
+# более интерактивный rm +alias rm='show_which rm && rm -I' -

Here are ls aliases (see man ls):

+

ls аллиасы (смотри man ls):

alias ls='show_which ls && ls --color=auto'
 alias ll='show_which ll && ls --group-directories-first -l --human-readable'
 alias lr='show_which lr && ls --recursive'
@@ -237,7 +237,7 @@ alias lz='show_which lz && ll -S --reverse'
 alias lt='show_which lt && ll -t --reverse'
 alias lm='show_which lm && la | more'
-

Here are aliases to quick file view from console (just type a file name!):

+

Аллиасы для быстрого просмотра файлов из консоли (просто набери имя файла!):

# alias -s
 alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv
 alias -s {mp3,flac}=qmmp
@@ -246,8 +246,8 @@ alias -s {pdf}=okular
 autoload -U pick-web-browser
 alias -s {html,htm}=opera
-

Here are "sudo" aliases:

-
# sudo alias +

"sudo" аллиасы:

+
# sudo alias
 if [[ $EUID == 0 ]]; then
   alias fat32mnt='show_which fat32mnt && mount -t vfat -o codepage=866,iocharset=utf8,umask=000'
   alias synctime='show_which synctime && { ntpd -qg; hwclock -w; date; }'
@@ -265,9 +265,9 @@ else
   alias rmmod='show_which rmmod && sudo rmmod'
   alias staging-i686-build='show_which staging-i686-build && sudo staging-i686-build'
   alias staging-x86_64-build='show_which staging-x86_64-build && sudo staging-x86_64-build'
-fi
+fi -

Here are global aliases. If they are enable the command cat foo g bar will be equivalent the command cat foo | grep bar:

+

Некоторые глобальные аллиасы. Если они включены, команда cat foo g bar будет эквивалентна cat foo | grep bar:

# global alias
 alias -g g="| grep"
 alias -g l="| less"
@@ -275,10 +275,10 @@ alias -g t="| tail"
 alias -g h="| head"
 alias -g dn="&> /dev/null &"
-

Functions

-

Here is a special function for xrandr:

+

Функции

+

Специальная функция для xrandr:

-
# function to contorl xrandr +
# function to contorl xrandr
 # EXAMPLE: projctl 1024x768
 projctl () {
   if [ $1 ] ; then
@@ -297,10 +297,10 @@ projctl () {
     echo "Using default resolution"
     xrandr --output VGA1 --mode 1366x768 --output LVDS1 --mode 1366x768
   fi
-}
+} -

Unfortunately I can not remember tar flags thus I use special functions:

-
# function to extract archives +

К сожалению, я не могу запомнить флаги tar, поэтому я использую специальные функции:

+
# function to extract archives
 # EXAMPLE: unpack file
 unpack () {
   if [[ -f $1 ]]; then
@@ -348,10 +348,10 @@ pack () {
   else
     echo "'$1' is not a valid file"
   fi
-}
+} -

Here is a special function for su:

-
su () { +

Специальная функция для su:

+
su () {
   checksu=0
   for flags in $*; do
     if [[ $flags == "-" ]]; then
@@ -364,25 +364,25 @@ pack () {
   else
     /usr/bin/su $*
   fi
-}
+} -

Functions with automatic rehash after installing/removing packages are:

-
pacman () { - /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\\|R\\|U" && rehash +

Функция для автоматических обновлений путей после установки пакето:

+
pacman () {
+  /usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash
 }
 yaourt () {
-  /usr/bin/yaourt $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
+  /usr/bin/yaourt $* && echo "$*" | grep -q "S\|R\|U" && rehash
 }
 # for testing repo
 yatest () {
-  /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\\|R\\|U" && rehash
-}
-

But autocomplete for yaourt -Ss will require root privileges.

+ /usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash +} +

Но автодополнение для yaourt -Ss будет требовать привилегий рута.

-

Variables

-

It is recommended to set own variables in ~/.zshenv. But I have everything stored in the single file.

+

Переменные

+

Рекомендуется хранить свои переменные в ~/.zshenv. Но я все храню в одном файле.

-

Here are path, mask of new files, editor and pager:

+

Пути, маска создаваемых файлов, редактор и пейджер:

# path
 export PATH="$PATH:$HOME/.local/bin"
 # umask
@@ -391,7 +391,7 @@ umask 022
 export EDITOR="vim"
 export PAGER="vimpager"
-

Here is hashes. If they are enable the command ~global will be equivalent the command /mnt/global:

+

Хэши. Если они включены, команда ~global будет эквивалентна команде /mnt/global:

# hash
 hash -d global=/mnt/global
 hash -d windows=/mnt/windows
@@ -399,8 +399,8 @@ hash -d iso=/mnt/iso
 hash -d u1=/mnt/usbdev1
 hash -d u2=/mnt/usbdev2
-

Screenshot

+

Скриншот

-

File

-

Here is my .zshrc.

+

Файл

+

Мой .zshrc.