Skip to content

Commit

Permalink
repo: add "make" and "docs" subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Sep 22, 2021
1 parent 22ace5f commit 75bd04c
Show file tree
Hide file tree
Showing 16 changed files with 495 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,6 +3,7 @@
/ble.sh
/dist
/wiki
/ext

# edit files
/COMMIT
Expand All @@ -21,4 +22,4 @@
/memo/D0857.pipe
/memo/D0857.stderr
/memo/*.exe
/memo/D1619.wcwidth
/make/*.exe
9 changes: 7 additions & 2 deletions GNUmakefile
Expand Up @@ -20,7 +20,7 @@ ifeq ($(GAWK),)
endif
endif

MWGPP:=$(GAWK) -f ext/mwg_pp.awk
MWGPP:=$(GAWK) -f make/mwg_pp.awk

#------------------------------------------------------------------------------
# ble.sh
Expand Down Expand Up @@ -99,11 +99,16 @@ $(OUTDIR)/lib/test-canvas.sh: lib/test-canvas.sh lib/test-canvas.GraphemeCluster
outdirs += $(OUTDIR)/doc
outfiles-doc += $(OUTDIR)/doc/README.md
outfiles-doc += $(OUTDIR)/doc/README-ja_JP.md
outfiles-doc += $(OUTDIR)/doc/CONTRIBUTING.md
outfiles-doc += $(OUTDIR)/doc/LICENSE.md
outfiles-doc += $(OUTDIR)/doc/CONTRIBUTING.md
outfiles-doc += $(OUTDIR)/doc/ChangeLog.md
outfiles-doc += $(OUTDIR)/doc/Release.md
$(OUTDIR)/doc/%: % | $(OUTDIR)/doc
cp -p $< $@

$(OUTDIR)/doc/%: docs/% | $(OUTDIR)/doc
cp -p $< $@

#------------------------------------------------------------------------------
# contrib

Expand Down
38 changes: 35 additions & 3 deletions README-ja_JP.md
Expand Up @@ -76,7 +76,7 @@ make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local
[**メニュー絞り込み**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-menu-filter)
(Bash 4.0 以上) として自然な形で組み込んでいます。
他に、[**動的略語展開**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-dabbrev)
や、`zsh-abbreviations` のような
や、[*zsh abbreviations*](https://unix.stackexchange.com/questions/6152/zsh-alias-expansion)[`zsh-abbr`](https://github.com/olets/zsh-abbr) のような
[**静的略語展開**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-sabbrev)
にも対応しています。
- **Vim編集モード**: `set -o vi` による編集モードを増強します。
Expand All @@ -99,6 +99,31 @@ make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local
>
> ![ble.sh demo gif](https://github.com/akinomyoga/ble.sh/wiki/images/trial1.gif)
## これまでとこれから

このプロジェクトは初めは `.bashrc` の片隅で行われた小さな実験からスタートしました。
2013年5月に `zsh-syntax-highlighting` のとある記事に触発されたのがきっかけでした。
初めは数百行のコードを書けば構文着色が簡単に実現できるのではないかと思って始めた実験ですが、
すぐに行エディタを根本から書き直さなければ実現できないのではないかということが分かり、
独立したファイルにコードを移動した後に `ble.sh` という名前を与えました。
この名前は Zsh の行エディタ (*ZLE* (*Zsh Line Editor*)) を真似て、
但しシェルで書かれているという事を意識して `.sh` という拡張子にしたように記憶しています。
`ble.sh` の読み方について屡々訊かれるのですが、最初に書いたように特に定まった読み方はありません。
最初の実験は2週間程コードを弄って原理的に行エディタを作れるという事を結論づけて終わりました。
本格的な実装が始まったのは2015年2月の事で12月には公開しました。
その時点で行エディタとしては普段遣いに堪える程度に完成していました。
Vimモードの実装は2017年9月に始まり2018年3月に一先ず完成としました。
続いて補完の拡張は2018年8月に始まり2019年2月には一通り完成しました。
現在は漫然とメンテナンスしている所でいつになるかは分かりませんが、以下に挙げるような機能も加えたいと何となく考えています。

- 2013-06 v0.0 -- 実験
- 2015-12 v0.1 -- 構文着色 [[v0.1.14](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.14)]
- 2018-03 v0.2 -- Vim モード [[v0.2.6](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.6)]
- 2019-02 v0.3 -- 拡張補完 [[v0.3.3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.3)]
- 20xx-xx v0.4 (plan) -- プログラム着色 [`master`]
- 20xx-xx v0.5 (plan) -- TUI設定画面
- 20xx-xx v0.6 (plan) -- エラー診断?

# 1 使い方

## 1.1 最新の git repository のソースから生成して試す (バージョン ble-0.4)<sup><a id="get-from-source" href="#get-from-source">†</a></sup>
Expand Down Expand Up @@ -151,8 +176,8 @@ Make 変数 `DESTDIR` または `PREFIX` が指定されている時、`ble.sh`
現在、安定版は開発版に比べてかなり古いので様々な機能が欠けている事にご注意下さい。

- 開発版 [v0.4.0-devel2](https://github.com/akinomyoga/ble.sh/releases/tag/v0.4.0-devel2) (2020-12)
- 安定版 [v0.3.3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.3) (2019-02 fork) +拡張補完
- 安定版 [v0.2.6](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.6) (2018-03 fork) +Vim モード
- 安定版 [v0.3.3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.3) (2019-02 fork) 拡張補完
- 安定版 [v0.2.6](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.6) (2018-03 fork) Vim モード
- 安定版 [v0.1.14](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.14) (2015-12 fork) 構文着色

## 1.2 `ble.sh` をダウンロードして試す (旧バージョン ble-0.3 201902版)<sup><a id="get-from-tarball" href="#get-from-tarball">†</a></sup>
Expand Down Expand Up @@ -493,6 +518,13 @@ Bash 4.0 以降では自動補完が有効になり、予測候補が表示さ
ble-sabbrev L='| less'
```

実際に実行したいコマンドに含まれる可能性の低い単語として、`\` で始まる単語を静的略語展開に登録することもお薦めです。

```bash
# blerc
ble-sabbrev '\L'='| less'
```

# 4 謝辞

GitHub の Issue/PR を通して多くの方からフィードバックを頂き、皆様に本当に感謝しております。
Expand Down
40 changes: 35 additions & 5 deletions README.md
Expand Up @@ -79,7 +79,8 @@ You may also install `ble.sh` through package-management systems (currently only
integrates automatic filtering of candidates into menu completion (with Bash 4.0+).
There are other functionalities such as
[**dabbrev**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-dabbrev) and
[**sabbrev**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-sabbrev) like `zsh-abbreviations`.
[**sabbrev**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-sabbrev) like
[*zsh abbreviations*](https://unix.stackexchange.com/questions/6152/zsh-alias-expansion) or [`zsh-abbr`](https://github.com/olets/zsh-abbr).
- **Vim editing mode**: Enhance `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.
Expand All @@ -100,6 +101,28 @@ Of course ble.sh can be used in combination with other Bash configurations such
>
> ![ble.sh demo gif](https://github.com/akinomyoga/ble.sh/wiki/images/trial1.gif)
## History and roadmap

My little experiment has took place in one corner of my `bashrc` in the end of May, 2013 after I enjoyed some article on `zsh-syntax-highlighting`.
I initially thought something can be achieved by writing a few hundred of codes
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 shell script.
I'm occasinally asked about the pronunciation of `ble.sh`, but you can actually 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 the actual daily uses.
The real efforts of improving the prototype implementation for the real uses was started in Feburuary, 2015.
I released the initial version in the next December. Until then, the basic part of the line editor was completed.
The implementation of vim mode has been started in September, 2017 and completed in the next March.
I started working on the enhancement of the completion in August, 2018 and released it in the next February.

- 2013-06 v0.0 -- prototype
- 2015-12 v0.1 -- Syntax highlighting [[v0.1.14](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.14)]
- 2018-03 v0.2 -- Vim mode [[v0.2.6](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.6)]
- 2019-02 v0.3 -- Enhanced completion [[v0.3.3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.3)]
- 20xx-xx v0.4 (plan) -- programmable highlighting [`master`]
- 20xx-xx v0.5 (plan) -- TUI configuration
- 20xx-xx v0.6 (plan) -- error diagnostics?

# 1 Usage

## 1.1 Try `ble.sh` generated from source (version ble-0.4 devel)<sup><a id="get-from-source" href="#get-from-source">†</a></sup>
Expand Down Expand Up @@ -152,11 +175,10 @@ For download, trial and install, see the description at each release page.
The stable versions are significantly old compared to the devel version, so many features are unavailable.

- Devel [v0.4.0-devel2](https://github.com/akinomyoga/ble.sh/releases/tag/v0.4.0-devel2) (2020-12)
- Stable [v0.3.3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.3) (2019-02 fork) +Enhanced completions
- Stable [v0.2.6](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.6) (2018-03 fork) +Vim mode
- Stable [v0.3.3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.3) (2019-02 fork) Enhanced completions
- Stable [v0.2.6](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.6) (2018-03 fork) Vim mode
- Stable [v0.1.14](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.14) (2015-12 fork) Syntax highlighting


## 1.3 Set up `.bashrc`<sup><a id="set-up-bashrc" href="#set-up-bashrc">†</a></sup>

If you want to load `ble.sh` by default in interactive sessions of `bash`, usually one can just source `ble.sh` in `~/.bashrc`,
Expand Down Expand Up @@ -461,13 +483,21 @@ If you want to accept the suggestion and immediately run the command, you can us

By registering words to `sabbrev`, the words can be expanded to predefined strings.
When the cursor is just after a registered word, typing <kbd>SP</kbd> causes `sabbrev` expansion.
For example, with the following settings, when you type <kbd>SP</kbd> after the command line `command L`, the command line will be expanded to `command | less`.
For example, with the following settings, when you type <kbd>SP</kbd> after the string `command L`, the command line will be expanded to `command | less`.

```bash
# blerc
ble-sabbrev L='| less'
```

The sabbrev names that starts from `\` are also recommended since it is unlikely to conflict with the real words that is a part of the executed command.

```bash
# blerc
ble-sabbrev '\L'='| less'
```


# 4 Contributors

I received many feedbacks from many people in GitHub Issues/PRs.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 2 additions & 5 deletions memo/GNUmakefile → make/GNUmakefile
Expand Up @@ -3,9 +3,6 @@
all:
.PHONY: all


all: D1619.wcwidth.exe
D1619.wcwidth.exe: D1619.wcwidth.cpp
all: canvas.c2w.wcwidth.exe
canvas.c2w.wcwidth.exe: canvas.c2w.wcwidth.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $<


File renamed without changes.
File renamed without changes.
181 changes: 181 additions & 0 deletions make/debug.leakvar.exclude-list.txt
@@ -0,0 +1,181 @@
--------------------------------------------------------------------------------
# bash
^_=
^BASH=
^BASHOPTS=
^BASHPID=
^BASH_ALIASES=
^BASH_ARGC=
^BASH_ARGV=
^BASH_ARGV0=
^BASH_CMDS=
^BASH_COMMAND=
^BASH_COMPAT=
^BASH_ENV=
^BASH_EXECUTION_STRING=
^BASH_LINENO=
^BASH_LOADABLES_PATH=
^BASH_REMATCH=
^BASH_SOURCE=
^BASH_SUBSHELL=
^BASH_VERSINFO=
^BASH_VERSION=
^BASH_XTRACEFD=
^CDPATH=
^CHILD_MAX=
^COLUMNS=
^COMP_CWORD=
^COMP_KEY=
^COMP_LINE=
^COMP_POINT=
^COMP_TYPE=
^COMP_WORDBREAKS=
^COMP_WORDS=
^COPROC=
^DIRSTACK=
^EMACS=
^ENV=
^EPOCHREALTIME=
^EPOCHSECONDS=
^EUID=
^EXECIGNORE=
^FCEDIT=
^FIGNORE=
^FUNCNAME=
^FUNCNEST=
^GLOBIGNORE=
^GROUPS=
^HISTCMD=
^HISTCONTROL=
^HISTFILE=
^HISTFILESIZE=
^HISTIGNORE=
^HISTSIZE=
^HISTTIMEFORMAT=
^HOME=
^HOSTFILE=
^HOSTNAME=
^HOSTTYPE=
^IFS=
^IGNOREEOF=
^INPUTRC=
^INSIDE_EMACS=
^LANG=
^LC_ALL=
^LC_COLLATE=
^LC_CTYPE=
^LC_MESSAGES=
^LC_NUMERIC=
^LC_TIME=
^LINENO=
^LINES=
^MACHTYPE=
^MAIL=
^MAILCHECK=
^MAILPATH=
^OLDPWD=
^OPTARG=
^OPTERR=
^OPTIND=
^OSTYPE=
^PATH=
^PIPESTATUS=
^POSIXLY_CORRECT=
^PPID=
^PROMPT_COMMAND=
^PROMPT_DIRTRIM=
^PS[0-4]=
^PWD=
^RANDOM=
^READLINE_LINE=
^READLINE_POINT=
^SECONDS=
^SHELL=
^SHELLOPTS=
^SHLVL=
^TIMEFORMAT=
^TMOUT=
^TMPDIR=
^UID=
^auto_resume=
^histchars=
--------------------------------------------------------------------------------
^REPLY=
^COMPREPLY=
^MAPFILE=
--------------------------------------------------------------------------------
# others
^BASHRCSOURCED=
^CVS_RSH=
^DBUS_SESSION_BUS_ADDRESS=
^DISPLAY=
^GCC_COLORS=
^GOPATH=
^KDEDIRS=
^LESSOPEN=
^LOGNAME=
^LS_COLORS=
^READLINE_LINE=
^READLINE_POINT=
^SOURCE_HIGHLIGHT_DATADIR=
^S_COLORS=
^TERM=
^TERMCAP=
^TEXMFHOME=
^TIME_STYLE=
^USER=
^WINDOW=
^XDG_RUNTIME_DIR=
^XDG_SESSION_CLASS=
^XDG_SESSION_ID=
^XDG_SESSION_TYPE=
--------------------------------------------------------------------------------
# /usr/share/lmod
^LMOD_CMD=
^LMOD_DIR=
^LMOD_PKG=
^LMOD_ROOT=
^LMOD_SETTARG_FULL_SUPPORT=
^LMOD_VERSION=
^LMOD_sys=
^MODULEPATH=
^MODULEPATH_ROOT=
^MODULESHOME=
--------------------------------------------------------------------------------
# dev
^CPLUS_INCLUDE_PATH=
^C_INCLUDE_PATH=
^LD_LIBRARY_PATH=
^LIBRARY_PATH=
^PKG_CONFIG_PATH=
^MANPATH=
--------------------------------------------------------------------------------
# ssh, screen
^SSH_CLIENT=
^SSH_CONNECTION=
^SSH_TTY=
^STY=
--------------------------------------------------------------------------------
# bash-completion
^_xspecs=
^_backup_glob=
^BASH_COMPLETION_[[:alnum:]_]+=
# external completions
^__(git|dnf|gitcomp)_[[:alnum:]_]+=
^_scp_path_esc=
--------------------------------------------------------------------------------
# dotfiles
^_dotfiles_[[:alnum:]_]+=
--------------------------------------------------------------------------------
# mshex
^MSHEX_LIB_PATH_SH=
^MSHEX_LIB_PATH_SH_localVariables=
^MWGDIR=
^MWG_LOGINTERM=
^_mshex_[[:alnum:]_]+=
^mshex_bash=
^mshex_tmpdir=
^mwg_cdhist_config_BubbleHist=
--------------------------------------------------------------------------------
# ble.sh internal variables
^_?(BLE|ble)[[:alnum:]_]+=
File renamed without changes.

0 comments on commit 75bd04c

Please sign in to comment.