/shell-config-template

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Template for bash and zsh

Prompt for root

PS1='${debian_chroot:+($debian_chroot)}\[\e[01;34m\]\u\[\e[00m\]@\[\e[01;31m\]\h\[\e[00m\]:\[\e[01;33m\]\w\[\e[00m\]\$ '

Colors aliases

You can use the .colors file to have a bunch of aliases for colors.
These aliases use the 24-bit or true color escape sequences.

This naming convention follow this rule:

  • \e[38;2;⟨r⟩;⟨g⟩;⟨b⟩m Select RGB foreground color
  • \e[48;2;⟨r⟩;⟨g⟩;⟨b⟩m Select RGB background color

And \e[0m after a sentence to reset all attributes.

Aliases

These aliases checks if Nala is installed, if not, it will juste use the standard package manager tool.

It is only implemented at the moment for debian-based ditributions with use of Apt.

Zsh

  • If you have it installed, you have to put custom-aliases.zsh into the $HOME/.oh-my-zsh/custom folder.
  • If not, you can copy/paste the code into .zshrc file or use a separate file.

Bash

  • You can rename the file into .custom-aliases, it is already charged in .bashrc file.

Nvm autouse

Zsh

For zsh, there is a section about nvm autouse:

  • It run nvm use automatically every time there's a .nvmrc file in the directory. Also, revert to default version when entering a directory without .nvmrc.

Languages

For languages there is LANGUAGE and LC_ALL environment variables to specify the language to be used widely on the system.

No need to have LANG set, the display language will be by default other locale related environment variables.

Priority of these variables:

  1. LANGUAGE

    • it can have one or more language values and is responsible for the order of the languages in which the messages will be displayed.
  2. LC_ALL

    • it is the strongest locale environment variable, except for LANGUAGE
  3. LC_xxx

  4. LANG

The C and C.UTF-8 value is for default language who are usually en_US and en_US.UTF-8

You can run locale to list what locales currently defined for the current user account.

If you have problem with a locale then generate the missing locale with locale-gen and reconfigure locales to take notice.

locale-gen is a program that reads the file /etc/locale.gen and invokes localedef for the chosen localisation profiles.

$ sudo locale-gen "en_US.UTF-8"
Generating locales...
  en_US.UTF-8... done
Generation complete.

$ sudo dpkg-reconfigure locales
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.