Skip to content

Commit

Permalink
keymap/vi: fix conflicting binding to C-RET in vi_imap
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 9, 2024
1 parent aa92b42 commit 0b18f3c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- term: fix control sequences for hiding cursor (reported by n87) `#D2130` f9b9aea8
- highlight: fix inconsistent tab width in plain layer (reported by dgudim) `#D2132` f9072c40
- decode: consume incomplete keyseq in macros `#D2137` 27e6309e
- keymap/vi: fix conflicting binding to <kbd>C-RET</kbd> in `vi_imap` `#D2146` xxxxxxxx

## Compatibility

Expand Down
13 changes: 10 additions & 3 deletions lib/keymap.vi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8143,12 +8143,10 @@ function ble-decode/keymap:vi_imap/define {
ble-bind -f 'SP' 'magic-space'
ble-bind -f '/' 'magic-slash'

# ble-bind -f 'C-c' 'discard-line'
ble-bind -f 'C-j' 'accept-line'
ble-bind -f 'C-RET' 'accept-line'
ble-bind -f 'C-m' 'accept-single-line-or-newline'
ble-bind -f 'RET' 'accept-single-line-or-newline'
# ble-bind -f 'C-o' 'accept-and-next'
ble-bind -f 'C-x C-e' 'edit-and-execute-command'
ble-bind -f 'C-g' 'bell'
ble-bind -f 'C-x C-g' 'bell'
Expand All @@ -8173,7 +8171,6 @@ function ble-decode/keymap:vi_imap/define {
# insert
ble-bind -f 'C-q' 'vi_imap/quoted-insert'
ble-bind -f 'C-v' 'vi_imap/quoted-insert'
ble-bind -f 'C-RET' 'newline'
ble-bind -f paste_begin 'vi_imap/bracketed-paste'

# charwise operations
Expand Down Expand Up @@ -8203,12 +8200,22 @@ function ble-decode/keymap:vi_imap/define {
ble-bind -f __before_widget__ vi_imap/__before_widget__
ble-bind -f __line_limit__ __line_limit__

# Note: in the typical shells, [C-c] is used to discard the current line,
# which is implemented as 'discard-line'. The choice of ble.sh is to make it
# consistent with vi, i.e. drop to the normal mode by [C-c]
ble-bind -f 'ESC' 'vi_imap/normal-mode'
ble-bind -f 'C-[' 'vi_imap/normal-mode'
ble-bind -f 'C-c' 'vi_imap/normal-mode-without-insert-leave'

# Note: in the emacs editing mode, [C-o] has been 'accept-and-next', which
# might be more useful in the command line.
ble-bind -f 'C-o' 'vi_imap/single-command-mode'

# Note: these bindings also conflict with the typical binding in
# shells. [C-l] can be replaced by ESC or C-c, so we drop it. [C-k]
# conflicts with kill-forward-line. The digraph inputting is only needed
# when the terminal does not support it, so I think we don't need to support
# it by default.
# ble-bind -f 'C-l' vi_imap/normal-mode
# ble-bind -f 'C-k' vi_imap/insert-digraph
}
Expand Down
10 changes: 10 additions & 0 deletions note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7077,6 +7077,16 @@ bash_tips

2024-02-08

* keymap/vi: vi_imap C-RET が書き換わっている (reported by 10b14224cc) [#D2146]
https://github.com/akinomyoga/ble.sh/issues/405

返信した通り C-RET は最初は history-expand-line になっていたが、vi-mode の
実装時に newline に変えて、暫くしてから一括で色々の keymap で共通して
accept-line になる様に変えた。然し、後の並び替えで誤って newline に戻ってし
まったのではないかと思われる。accept-line に修正した。他にも後で事故りそう
な物がコメントになっていたが、それを消してコメントで conflict について記述
する事にした。

* rlfunc: vi_nmap shell-expand-line に対応する [#D2145]

fzf の様に闇雲に設定する枠組みが合っても不思議ではない。但し、fzf に関して
Expand Down

0 comments on commit 0b18f3c

Please sign in to comment.