Skip to content

Commit

Permalink
edit: support "nsearch" options
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Apr 28, 2021
1 parent 79d671d commit 9125795
Show file tree
Hide file tree
Showing 9 changed files with 599 additions and 63 deletions.
41 changes: 39 additions & 2 deletions blerc
Expand Up @@ -10,9 +10,9 @@
## # Please put the following line in the beginning of .bashrc
## # Note: Please replace $HOME/.local/share/blesh with the path to your ble.sh
## [[ $- == *i* ]] && "$HOME/.local/share/blesh/ble.sh" --noattach
##
##
## # Your bashrc contents should come between the two lines.
##
##
## # Please put the following line in the end of .bashrc
## [[ ${BLE_VERSION-} ]] && ble-attach
## ```
Expand Down Expand Up @@ -610,6 +610,30 @@
# ble-color-setface varname_unset fg=124


##-----------------------------------------------------------------------------
## Key bindings


## The default mapping of <SP> is magic-space which performs history and
## sabbrev expansion before inserting a space. If you want to insert just a
## space without expansions as Bash's default, use the following setting:

#ble-bind -f 'SP' 'self-insert'


## If you want to search the already input string using <up> and <down> keys,
## use the following setting:

#ble-bind -f up 'history-search-backward'
#ble-bind -f down 'history-search-forward'

## If you want to immediately run the matched command by RET, you can specify
## the option "immediate-accept" to nsearch widgets:

#ble-bind -f up 'history-search-backward immediate-accept'
#ble-bind -f down 'history-search-forward immediate-accept'


##-----------------------------------------------------------------------------
## Settings for vim-mode

Expand All @@ -633,6 +657,19 @@ function blerc/vim-load-hook {
# bleopt keymap_vi_mode_show=1


## The default mapping of C-o is vi_imap/single-command-mode. If you want to
## execute the current command line and load the next history entry with
## <C-o>, use the following setting:

#ble-bind -m vi_imap -f 'C-o' 'accept-and-next'


## The default mapping of C-k is kill-forward-line. If you want to input
## digraphs with <C-k>{char1}{char2}, use the following setting:

#ble-bind -m vi_imap -f 'C-k' 'vi_imap/insert-digraph'


## The following settings specify the name of modes in the mode line.

# bleopt keymap_vi_mode_name_insert=INSERT
Expand Down
4 changes: 2 additions & 2 deletions lib/core-decode.emacs-rlfunc.txt
Expand Up @@ -55,8 +55,8 @@ glob-expand-word complete context=glob:insert-all
glob-list-expansions complete context=glob:show_menu
history-and-alias-expand-line history-and-alias-expand-line
history-expand-line history-expand-line
history-search-backward history-search-backward
history-search-forward history-search-forward
history-search-backward history-search-backward empty=history-move
history-search-forward history-search-forward empty=history-move
history-substring-search-backward history-substring-search-backward
history-substring-search-forward history-substring-search-forward
insert-comment insert-comment
Expand Down
4 changes: 2 additions & 2 deletions lib/core-decode.vi_imap-rlfunc.txt
Expand Up @@ -55,8 +55,8 @@ glob-expand-word complete context=glob:insert-all
glob-list-expansions complete context=glob:show_menu
history-and-alias-expand-line history-and-alias-expand-line
history-expand-line history-expand-line
history-search-backward history-search-backward
history-search-forward history-search-forward
history-search-backward history-search-backward empty=history-move
history-search-forward history-search-forward empty=history-move
history-substring-search-backward history-substring-search-backward
history-substring-search-forward history-substring-search-forward
insert-comment insert-comment
Expand Down
4 changes: 3 additions & 1 deletion memo/ChangeLog.md
Expand Up @@ -24,7 +24,9 @@
- syntax: properly support case patterns `#D1474` `#D1475` `#D1476` 64b55b7
- keymap/vi: add `ble/keymap:vi/script/get-mode` for user-defined mode strings `#D1488` f25a6e8 462918d
- prompt: support multiline `prompt_rps1` `#D1502` 4fa139a
- syntax: support tilde expansions in parameter expansions `#D1513` 0000000
- syntax: support tilde expansions in parameter expansions `#D1513` 0506df2
- decode: support `ble-bind -m KEYMAP --cursor DECSCUSR` (motivated by jmederosalvarado) `#D1514` `#D1515` `#D1516` 79d671d
- edit: support `nsearch` options (motivated by Alyetama, rashil2000, carv-silva) `#D1517` 0000000

## Changes

Expand Down
368 changes: 368 additions & 0 deletions note.txt

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions src/color.sh
Expand Up @@ -1315,14 +1315,16 @@ function ble/highlight/layer:region/update {
local g ret
local k=0 inext iprev=0
for inext in "${selection[@]}"; do
if ((k==0)); then
ble/array#push buff "\"\${$PREV_BUFF[@]::$inext}\""
elif ((k%2)); then
ble/array#push buff "\"$sgr\${_ble_highlight_layer_plain_buff[@]:$iprev:$((inext-iprev))}\""
else
ble/highlight/layer/update/getg "$iprev"
ble/color/g2sgr "$g"
ble/array#push buff "\"$ret\${$PREV_BUFF[@]:$iprev:$((inext-iprev))}\""
if ((inext>iprev)); then
if ((k==0)); then
ble/array#push buff "\"\${$PREV_BUFF[@]::$inext}\""
elif ((k%2)); then
ble/array#push buff "\"$sgr\${_ble_highlight_layer_plain_buff[@]:$iprev:$((inext-iprev))}\""
else
ble/highlight/layer/update/getg "$iprev"
ble/color/g2sgr "$g"
ble/array#push buff "\"$ret\${$PREV_BUFF[@]:$iprev:$((inext-iprev))}\""
fi
fi
((iprev=inext,k++))
done
Expand Down
1 change: 1 addition & 0 deletions src/decode.sh
Expand Up @@ -1732,6 +1732,7 @@ function ble/decode/keymap/push {
# set cursor-state
local cursor; ble/decode/keymap#get-cursor "$1"
[[ $cursor ]] && ble/term/cursor-state/set-internal $((cursor))
return 0
elif ble/decode/keymap#load "$1" && ble/decode/keymap#registered "$1"; then
ble/decode/keymap/push "$1" # 再実行
else
Expand Down

0 comments on commit 9125795

Please sign in to comment.