[ Languages: English | 日本語 (Japanese) ]
[ README | Manual |
Q&A |
contrib |
Recipes ]
Bash Line Editor (ble.sh†1) is a command line editor written in pure Bash†2 which replaces the default GNU Readline.
The current devel version is 0.4.
This script supports Bash 3.0 or higher although we recommend using ble.sh with release versions of Bash 4.0 or higher.
The POSIX standard utilities are also required.
Currently, only UTF-8 encoding is supported for non-ASCII characters.
This script is provided under the BSD License (3-clause BSD license).
There are two ways to get ble.sh: to get the source using git and build
ble.sh, or to download the nightly build using curl or wget.
See Sec 1.1 and Sec 1.2 for the details of trial and installation.
See Sec 1.3 for the details of the setup of your ~/.bashrc.
[!NOTE] If you want to use fzf with
ble.sh, you need to check Sec 2.8 to avoid compatibility problems.
git and make ble.sh# TRIAL without installation
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C ble.sh
source ble.sh/out/ble.sh
# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3)
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=~/.local
echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc
The build process integrates multiple Bash script files into a single Bash script `ble.sh` with pre-processing.
It also places other module files in appropriate places and strips code comments for a shorter initialization time.
The build process does not involve any C/C++/Fortran compilations and generating binaries, so C/C++/Fortran compilers are not needed.
curl# TRIAL without installation
curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf -
source ble-nightly/ble.sh
# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3)
curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf -
bash ble-nightly/ble.sh --install ~/.local/share
echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc
After the installation, the directory `ble-nightly` can be removed.
wget# TRIAL without installation
wget -O - https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf -
source ble-nightly/ble.sh
# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3)
wget -O - https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf -
bash ble-nightly/ble.sh --install ~/.local/share
echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc
After the installation, the directory `ble-nightly` can be removed.
ble.sh# UPDATE (in a ble.sh session)
ble-update
# UPDATE (outside ble.sh sessions)
bash /path/to/ble.sh --update
ble.sh# BUILD & PACKAGE (for package maintainers)
git clone --recursive https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local
For a detailed control of the install locations of the main files, the license
files, and the documentation files, please also check the later sections
[Install](#install) and [Package](#package).
If you want to tell `ble.sh` the way to update the package for `ble-update`,
you can place `_package.bash` at `${prefix}/share/blesh/lib/_package.bash`.
Please check [`_package.bash`](#_packagebash) for the details.
# ${prefix}/share/blesh/lib/_package.bash
_ble_base_package_type=XXX
function ble/base/package:XXX/update {
update-the-package-in-a-proper-way
}
fish and zsh-syntax-highlighting.
Unlike the simple highlighting in zsh-syntax-highlighting, ble.sh performs syntactic analysis
to enable the correct highlighting of complex structures such as nested command substitutions, multiple here documents, etc.
Highlighting colors and styles are fully configurable.fish and zsh-autosuggestions (with Bash 4.0+).
The feature menu-filter
integrates automatic filtering of candidates into menu completion (with Bash 4.0+).
There are other functionalities such as
dabbrev and
sabbrev like
zsh abbreviations or zsh-abbr.readline's vi editing mode available with set -o vi.
Vim editing mode supports various vim modes such as char/line/block visual/select mode, replace mode,
command mode, operator pending mode as well as insert mode and normal mode.
Vim editing mode supports various operators, text objects, registers, keyboard macros, marks, etc.
It also provides vim-surround as an option.Note: ble.sh does not provide specific settings of the prompt, aliases, functions, etc.
ble.sh provides a more fundamental infrastructure so that users can set up their own prompt, aliases, functions, etc.
Of course ble.sh can be used in combination with other Bash configurations such as bash-it and oh-my-bash.
Demo (version 0.2)
My little experiment took place in one corner of my bashrc at the end of May 2013 after I enjoyed an article on zsh-syntax-highlighting.
I initially thought something could be achieved by writing a few hundred lines of code
but soon realized that everything needs to be re-implemented for the authentic support of syntax highlighting in Bash.
I decided to make it as an independent script ble.sh.
The name stemmed from that of Zsh's line editor, ZLE (Zsh Line Editor), but suffixed with .sh for the implication of being written in a shell script.
I'm occasionally asked about the pronunciation of ble.sh, but you can pronounce it as you like.
After the two-week experiment, I was satisfied with my conclusion that it is possible to implement a full-featured line editor in Bash that satisfies actual daily use.
The real efforts to improve the prototype implementation for real uses started in February 2015.
I relea
| 日期 | 榜单 | 排名 | 周期新增 | 总 STAR |
|---|