Refactoring documentation to multiple files.

This commit is contained in:
Martin Dvorak 2015-01-07 22:36:50 +01:00
parent 791c652316
commit 8e5f08c0c5
3 changed files with 208 additions and 193 deletions

87
CONFIGURATION.md Normal file
View file

@ -0,0 +1,87 @@
CONFIGURATION EXPLANATION
=========================
`hh` works best with the optional configuration described in this section.
You can configure `hh` just by running:
```bash
hh --show-configuration >> ~/.bashrc
```
CONFIGURATION OPTIONS
---------------------
Bind `hh` to a BASH key e.g. to `Ctrl-r`:
```bash
bind '"\C-r": "\C-ahh \C-j"'
```
or `Ctrl-Alt-r`:
```bash
bind '"\e\C-r":"\C-ahh \C-j"'
```
or `Ctrl-F12`:
```bash
bind '"\e[24;5~":"\C-ahh \C-j"'
```
bind `hh` to `Ctrl-r` only if this is interactive shell:
```bash
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh \C-j"'; fi
```
To determine the character sequence emitted by a pressed key in terminal,
type `Ctrl-v` and then press the key. Check your current bindings using:
```bash
bind -S
```
Get `hh` in more colors:
```bash
export HH_CONFIG=hicolor
```
show normal history by default (instead of metrics-based view):
```bash
export HH_CONFIG=rawhistory
```
show favorites by default (instead of metrics-based view):
```bash
export HH_CONFIG=favorites
```
make search case sensitive (insensitive by default):
```bash
export HH_CONFIG=casesensitive
```
show warnings:
```bash
export HH_CONFIG=warning
```
show debug messages:
```bash
export HH_CONFIG=debug
```
more colors and case sensitive search:
```bash
export HH_CONFIG=hicolor,casesensitive
```
Increase the size of history:
```bash
export HISTFILESIZE=10000
export HISTSIZE=${HISTFILESIZE}
```
Variables defined above increase the number of history items and history file size
(default value is 500).
Ensure syncing (flushing and reloading) of `.bash_history` with in-memory
history:
```bash
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
```
Force appending of in-memory history to `.bash_history`
(instead of overwriting):
```bash
shopt -s histappend
```
Use leading space to hide commands from history:
```bash
export HISTCONTROL=ignorespace
```
Suitable for a sensitive information like passwords.

104
INSTALLATION.md Normal file
View file

@ -0,0 +1,104 @@
hh INSTALLATION
===============
Install `hh` [distribution](#DISTRIBUTION INSTALLATION), from [source code](#INSTALLATION FROM SOURCE CODE),
on [Ubuntu](#UBUNTU), [Debian/Mint](#DEBIAN/MINT), [Arch Linux](#ARCH LINUX)
or [Mac OS](#MAC OS).
UBUNTU
------
Install `hh` on Ubuntu:
```bash
sudo add-apt-repository ppa:ultradvorka/ppa
sudo apt-get update
sudo apt-get install hh
```
Optionally [configure](CONFIGURATION.MD) `hh` and check its [man page](README.md#DOCUMENTATION).
INSTALLATION FROM SOURCE CODE
-----------------------------
Clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
```
Create build files using:
```bash
cd ./dist && ./1-dist.sh && cd ..
```
Install `hh` using:
```bash
./configure && make && make install
```
Optionally [configure](CONFIGURATION.MD) `hh` and check its [man page](README.md#DOCUMENTATION).
DISTRIBUTION INSTALLATION
-------------------------
Download latest distribution from project Releases section:
https://github.com/dvorka/hstr/releases
Expand the archive and install `hh` using:
```bash
./configure && make && make install
```
Optionally [configure](CONFIGURATION.MD) `hh` and check its [man page](README.md#DOCUMENTATION).
DEBIAN/MINT
-----------
Install `hh` on Debian (Wheezy) or Mint (13) by registering the key:
```bash
wget www.clfh.de/frankh.asc
apt-key add frankh.asc
```
adding the repository:
```bash
deb http://www.clfh.de/debian wheezy main
deb-src http://www.clfh.de/debian wheezy main
```
and installing it:
```bash
apt-get update
apt-get install hh
```
Optionally configure `hh`:
```bash
hh --show-configuration >> ~/.bashrc
```
Optionally [configure](CONFIGURATION.MD) `hh` and check its [man page](README.md#DOCUMENTATION).
ARCH LINUX
----------
Download latest distribution from project Releases section:
https://github.com/dvorka/hstr/releases
Use PKGBUILD in the root of the distribution to build package using `makepkg`:
https://wiki.archlinux.org/index.php/PKGBUILD
Install `hh`.
Optionally [configure](CONFIGURATION.MD) `hh` and check its [man page](README.md#DOCUMENTATION).
MAC OS
------
Install MacPorts:
http://www.macports.org
Set the environment:
```bash
env CFLAGS="-I/opt/local/include -I/usr/include" LDFLAGS="-L/opt/local/lib -L/usr/lib" ./configure
```
Finish the installation
```bash
make && make install
```
Optionally [configure](CONFIGURATION.MD) `hh` and check its [man page](README.md#DOCUMENTATION).

210
README.md
View file

@ -22,206 +22,30 @@ passwords) and bookmark your favorite commands.
Enjoy [video](http://www.youtube.com/watch?v=sPF29NyXe2U) tutorial.
UBUNTU INSTALLATION
-------------------
Install `hh` on Ubuntu:
```bash
sudo add-apt-repository ppa:ultradvorka/ppa
sudo apt-get update
sudo apt-get install hh
```
Optionally configure `hh`:
INSTALLATION
------------
Install `hh` [distribution](INSTALLATION.md), from [source code](INSTALLATION.md),
on [Ubuntu](INSTALLATION.md), [Debian/Mint](INSTALLATION.md), [Arch Linux](INSTALLATION.md)
or [Mac OS](INSTALLATION.md).
CONFIGURATION
-------------
You can configure `hh` just by running:
```bash
hh --show-configuration >> ~/.bashrc
```
Check the documentation:
For detailed `hh` configuration description please refer to [Configuration](CONFIGURATION.md) document.
DOCUMENTATION
-------------
Check `hh` man page:
```bash
man hh
```
INSTALLATION FROM SOURCE CODE
-----------------------------
Clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
```
Create build files using:
```bash
cd ./dist && ./1-dist.sh && cd ..
```
Install `hh` using:
```bash
./configure && make && make install
```
Optionally configure `hh`:
```bash
hh --show-configuration >> ~/.bashrc
```
DISTRIBUTION INSTALLATION
-------------------------
Download latest distribution from project Releases section:
https://github.com/dvorka/hstr/releases
Expand the archive and install `hh` using:
```bash
./configure && make && make install
```
Optionally configure `hh`:
```bash
hh --show-configuration >> ~/.bashrc
```
DEBIAN/MINT INSTALLATION
-------------------
Install `hh` on Debian (Wheezy) or Mint (13) by registering the key:
```bash
wget www.clfh.de/frankh.asc
apt-key add frankh.asc
```
adding the repository:
```bash
deb http://www.clfh.de/debian wheezy main
deb-src http://www.clfh.de/debian wheezy main
```
and installing it:
```bash
apt-get update
apt-get install hh
```
Optionally configure `hh`:
```bash
hh --show-configuration >> ~/.bashrc
```
ARCH LINUX
----------
Download latest distribution from project Releases section:
https://github.com/dvorka/hstr/releases
Use PKGBUILD in the root of the distribution to build package using `makepkg`:
https://wiki.archlinux.org/index.php/PKGBUILD
Install `hh`
* optionally configure `hh`:
```bash
hh --show-configuration >> ~/.bashrc
```
MAC OS
------
Install MacPorts:
http://www.macports.org
Set the environment:
```bash
env CFLAGS="-I/opt/local/include -I/usr/include" LDFLAGS="-L/opt/local/lib -L/usr/lib" ./configure
```
Finish the installation
```bash
make && make install
```
Optionally configure `hh`:
```bash
hh --show-configuration >> ~/.bashrc
```
CONFIGURATION EXPLANATION
-------------------------
* `hh` works best with the optional configuration described in this section.
You can configure `hh` just by running:
```bash
hh --show-configuration >> ~/.bashrc
```
* bind `hh` to a BASH key e.g. to `Ctrl-r`:
```bash
bind '"\C-r": "\C-ahh \C-j"'
```
or `Ctrl-Alt-r`:
```bash
bind '"\e\C-r":"\C-ahh \C-j"'
```
or `Ctrl-F12`:
```bash
bind '"\e[24;5~":"\C-ahh \C-j"'
```
bind `hh` to `Ctrl-r` only if this is interactive shell:
```bash
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh \C-j"'; fi
```
To determine the character sequence emitted by a pressed key in terminal,
type `Ctrl-v` and then press the key. Check your current bindings using:
```bash
bind -S
```
* get `hh` in more colors:
```bash
export HH_CONFIG=hicolor
```
show normal history by default (instead of metrics-based view):
```bash
export HH_CONFIG=rawhistory
```
show favorites by default (instead of metrics-based view):
```bash
export HH_CONFIG=favorites
```
make search case sensitive (insensitive by default):
```bash
export HH_CONFIG=casesensitive
```
show warnings:
```bash
export HH_CONFIG=warning
```
show debug messages:
```bash
export HH_CONFIG=debug
```
more colors and case sensitive search:
```bash
export HH_CONFIG=hicolor,casesensitive
```
* increase the size of history:
```bash
export HISTFILESIZE=10000
export HISTSIZE=${HISTFILESIZE}
```
Variables defined above increase the number of history items and history file size
(default value is 500).
* ensure syncing (flushing and reloading) of `.bash_history` with in-memory
history:
```bash
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
```
* force appending of in-memory history to `.bash_history`
(instead of overwriting):
```bash
shopt -s histappend
```
* use leading space to hide commands from history:
```bash
export HISTCONTROL=ignorespace
```
Suitable for a sensitive information like passwords.
BUGS
----