Zsh Utilities
Introduction
This sould provides a saner set of default functions and/or aliases for zsh
shell. It includes
- many useful libraries and configurations
- "literate" customization embedded in Org-mode files
The latest version is at http://github.com/xgarrido/zsh-utilities
Installation
There are different way to install this plugin :
In your ~/.zshrc
Download the script or clone this repository:
git clone git://github.com/xgarrido/zsh-utilities.git
Source this script at the end of
~/.zshrc
:source /path/to/zsh-utilities/init.zsh
Source
~/.zshrc
to take changes into account:source ~/.zshrc
With oh-my-zsh
Download the script or clone this repository in oh-my-zsh plugins directory:
cd ~/.oh-my-zsh/custom/plugins git clone git://github.com/xgarrido/zsh-utilities.git
Activate the plugin in
~/.zshrc
(in last position)plugins=( [plugins...] zsh-utilities)
Source
~/.zshrc
to take changes into account:source ~/.zshrc
With antigen (recommended way)
Add the following line into your ~/.zshrc
file:
antigen-bundle xgarrido/zsh-utilities
Structure
This zsh-utilities.org
file is where everything begins. It is loaded
automatically on zsh
startup if you have well followed the installation
process. The sole purpose of this file is to load the shell code embedded in
it and goes on to load plugin files.
Implementation
Besides the fact that org-mode is used, this plugin does not use the org-babel tangling features and thus, does not assume that emacs is properly installed and set. All the tangling stuff is done through a simple Makefile and some sed tricks. In this way, it can be used without emacs. The only needed knowledge about org-mode is the code wrapping that must be done using proper code blocks calls (see org babel documentation). Nevertheless, it is recommended to have a look on org-mode features especially folding/unfolding abilities which make the read and the navigation pretty easy.
Core settings
The only "core" thing is to know where the files are.
zsh_utilities_dir=$(dirname $0)
Modules
Modules are defined in zsh-utilities-modules files. This file provides some configuration for external resources.
source ${zsh_utilities_dir}/zsh-utilities-modules.zsh
Load plugin files
The following files contain specific settings for several plugins. Keep this order since there are some dependencies.
Message handling and function facilities in zsh-utilities-pkgtools
source ${zsh_utilities_dir}/zsh-utilities-pkgtools.zsh
Machine configuration in zsh-utilities-configure
source ${zsh_utilities_dir}/zsh-utilities-configure.zsh
After "sourcing", we must run the private function
__configure_machine
to get defined environment variable related to local machine.__configure_machine
Some
zsh
default and custom settings in zsh-utilities-settingssource ${zsh_utilities_dir}/zsh-utilities-settings.zsh
Basic zsh functions in zsh-utilities-functions
source ${zsh_utilities_dir}/zsh-utilities-functions.zsh
Definition of some
shell
aliases in zsh-utilities-aliassource ${zsh_utilities_dir}/zsh-utilities-alias.zsh
Work (mainly SuperNEMO software) related functions in zsh-utilities-work
source ${zsh_utilities_dir}/zsh-utilities-work.zsh
Custom plugins
If you want to add your plugins to the list you can source
it here. This
section my change latter if a custom
directory is one day provided.