Configuration of some software

Linux

Your own locale

Maybe you don't like any predefined locale ; it was my case.

Here you can find a “en_FR@euro” locale that I have defined :

  • English messages (because french messages are often strangely translated, and there is less information on the internet)
  • “yyyy/mm/dd hh:mm:ss” date format, because it is logical, and alphanumerical sort is date sort !
  • “.” as decimal separator, because even French people do not write “,” with a keyboard …
  • “ ” (space) as thousands separator, because it is the French standard, and not so bad
  • French monetary (except decimal and thousands separators)
  • French for other features (telephone, address, measurement etc)

Rename the file to “en_FR@euro”, and copy it in /usr/share/i18n/locales (you will find there all other locales, and you can look at it to make your own locale).

Add “en_FR@euro ISO-8859-15” (or UTF8) to /etc/locale.gen, and run locale-gen.

Now you can use the en_FR@euro.ISO-8859-15 locale by exporting LC_ALL environment variable in your bashrc or zshrc or zshenv file, or even in /etc/env.d/02locale to set it for all users.

ZSH

Config files

As for all shells, there are several configuration files, loaded in the order :

.zshenv    --> always loaded, first
.zprofile  --> loaded if login shell
.zshrc     --> loaded if interactive shell
.zlogin    --> loaded when a user logins
.zlogout   --> loaded when a user logouts

Prompt

A nice prompt which prints only the two first and two last folder names of the current path (instead of the whole path or only the last folder) :

if [ "`id -u`" -eq 0 ]; then
# root prompt : blue
  export PS1="%{^[[33;39;1m%}%T%{^[[0m%} %{^[[33;34;1m%}%n%{^[[0m^[[33;34;1m%}@%{^[[33;39;1m%}%m %{^[[33;34;1m%}%(5~|%-2~..%2~|%~)%{^[[0m^[[33;34;1m%}%#%{^[[0m%} "
else
# user prompt : red
  export PS1="%{^[[33;39;1m%}%T%{^[[0m%} %{^[[33;31;1m%}%n%{^[[0m^[[33;31;1m%}@%{^[[33;39;1m%}%m %{^[[33;31;1m%}%(5~|%-2~..%2~|%~)%{^[[0m^[[33;31;1m%}%#%{^[[0m%} "
fi

It gives something like :

17:59 cyril@cyrilr /mnt/fat..5_Archi/annales%

Use the directory stack

Zsh permits to use the directory stack very easily, in zshrc :

alias d='popd'            # simple alias
setopt auto_pushd         # auto pushd with cd
setopt pushd_ignore_dups  # ignore double names of the same directory
setopt pushd_silent       # don't print the directory when popd or pushd

Then you can type d as many times you want to move back all cd you've done.

History size

It is always painful to lose what you have typed in your shell 20 lines above. You can tune it in zshrc :

export HISTORY=500
export HISTSIZE=500
export SAVEHIST=500

Key bindings

In order to use navigation keys, still in zshrc :

bindkey '^A'    beginning-of-line       # Home
bindkey '^E'    end-of-line             # End
bindkey '^D'    delete-char             # Del
bindkey '^[[3~' delete-char             # Del
bindkey '^[[2~' overwrite-mode          # Insert
bindkey '^[[5~' history-search-backward # PgUp
bindkey '^[[6~' history-search-forward  # PgDn

bindkey '\e[7~' beginning-of-line       # Home mrxvt
bindkey '\e[8~' end-of-line             # End mrxvt

bindkey '^[[1~' beginning-of-line       # Home rxvt
bindkey '^[[4~' end-of-line             # End rxvt

bindkey '^[[H'  beginning-of-line       # Home xterm
bindkey '^[[F'  end-of-line             # End xterm

Aliases

Still in zshrc :

### ls
alias ll='ls -l'
alias la='ls -a'
alias lla='ls -la'
 
### misc
alias c='clear'
alias less='less --quiet'
alias s='cd ..'
alias d='popd'
 
### df & du
alias df='df --human-readable'
 
# sorted du in one pass
alias du='du -a -x --max-depth=1 --human-readable > /mnt/ram/dunosort ;
 cat /mnt/ram/dunosort | grep -v -E "^[0123456789\.]+[KMG]\>" | sort -n > /mnt/ram/dusort ;
 cat /mnt/ram/dunosort | grep -E "^[0123456789\.]+[K]\>" | sort -n >> /mnt/ram/dusort ;
 cat /mnt/ram/dunosort | grep -E "^[0123456789\.]+[M]\>" | sort -n >> /mnt/ram/dusort ;
 cat /mnt/ram/dunosort | grep -E "^[0123456789\.]+[G]\>" | sort -n >> /mnt/ram/dusort ;
 cat /mnt/ram/dusort'
 
# sorted du in two pass
#alias du='du -a -x --max-depth=1 -b > /mnt/ram/duab.list; 
# du -a -x --max-depth=1 --human-readable > /mnt/ram/dua.list;  
# paste /mnt/ram/duab.list /mnt/ram/dua.list | sort -n | cut --fields=3,4'

MRXVT

History size

It is always painful to lose what you have typed in your shell 20 lines above. You can tune it in mrxvtrc :

mrxvt.saveLines:        10000

Appearence

mrxvt.showMenu:         False
mrxvt.background:       black
mrxvt.foreground:       white
mrxvt.scrollbarStyle:   plain
mrxvt.itabBackground:   grey
mrxvt.scrollColor:      white
mrxvt.troughColor:      grey
mrxvt.tabBackground:    white

Shortcuts

Mrxvt.macro.Shift+Left: GotoTab -1
Mrxvt.macro.Shift+Right:   GotoTab +1
Mrxvt.macro.Primary+Shift+Return:       Esc \ec
Mrxvt.macro.Ctrl+t:   NewTab
Mrxvt.macro.Ctrl+Shift+w:  Close 0

Other tunings

mrxvt.syncTabTitle:     False
mrxvt.syncTabIcon:      False
linux/configs.txt · Last modified: 2016/02/19 16:35 by cyril
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0