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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc10.html b/_posts/2014-01-14-about-zshrc10.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc10.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc11.html b/_posts/2014-01-14-about-zshrc11.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc11.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc12.html b/_posts/2014-01-14-about-zshrc12.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc12.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc13.html b/_posts/2014-01-14-about-zshrc13.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc13.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc14.html b/_posts/2014-01-14-about-zshrc14.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc14.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc15.html b/_posts/2014-01-14-about-zshrc15.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc15.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc16.html b/_posts/2014-01-14-about-zshrc16.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc16.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc17.html b/_posts/2014-01-14-about-zshrc17.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc17.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc18.html b/_posts/2014-01-14-about-zshrc18.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc18.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc19.html b/_posts/2014-01-14-about-zshrc19.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc19.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc2.html b/_posts/2014-01-14-about-zshrc2.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc2.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc20.html b/_posts/2014-01-14-about-zshrc20.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc20.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc21.html b/_posts/2014-01-14-about-zshrc21.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc21.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc3.html b/_posts/2014-01-14-about-zshrc3.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc3.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc4.html b/_posts/2014-01-14-about-zshrc4.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc4.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc5.html b/_posts/2014-01-14-about-zshrc5.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc5.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc6.html b/_posts/2014-01-14-about-zshrc6.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc6.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc7.html b/_posts/2014-01-14-about-zshrc7.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc7.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc8.html b/_posts/2014-01-14-about-zshrc8.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc8.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.
diff --git a/_posts/2014-01-14-about-zshrc9.html b/_posts/2014-01-14-about-zshrc9.html
new file mode 100644
index 0000000..0a70270
--- /dev/null
+++ b/_posts/2014-01-14-about-zshrc9.html
@@ -0,0 +1,405 @@
+---
+layout: paper
+date: 14 January 2014
+last: 14 January 2014
+tags: zshrc, configuration, linux
+title: 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).
+commentIssueId: 5
+---
+
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:
+
# 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
+bindkey '\e[1~' beginning-of-line # home
+bindkey '\e[2~' overwrite-mode # insert
+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/PgDownwill ignore already entered part of a command.
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.
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:
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
+yellow
+blue
+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
+
+
RPROMPT (acpi package is necessary):
+
precmd () {
+ # battery charge
+ function batcharge {
+ bat_perc=`acpi | awk {'print $4;'} | sed -e "s/\s//" -e "s/%.*//"`
+ if [[ $bat_perc < 15 ]]; then
+ col="%{$fg_bold[red]%}"
+ elif [[ $bat_perc < 50 ]]; then
+ col="%{$fg_bold[yellow]%}"
+ else
+ col="%{$fg_bold[green]%}"
+ fi
+ echo "%{$fg_bold[white]%}["$col$bat_perc"%{$fg_bold[white]%}%%]%{$reset_color%}"
+ }
+ # last command
+ returncode="%(?.%{$fg[green]%}.%{$fg[red]%})%?%{$resetcolor%}"
+ RPROMPT="%{$fg_bold[white]%}[%{$reset_color%}\
+%{$fg_bold[cyan]%}%T%{$reset_color%}\
+%{$fg_bold[white]%}] %{$reset_color%}"\
+$(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.
+
+
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.