mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-05-14 04:51:08 +08:00
Make completion keymaps opt-in (#53)
This commit is contained in:
parent
8f89939a57
commit
043e8e4a58
3 changed files with 9 additions and 3 deletions
|
|
@ -84,6 +84,7 @@ let g:chopsticks_profile = 'full' " engineer + heavier Markdown feedback
|
||||||
let g:chopsticks_enable_jk_escape = 1 " optional: insert-mode jk exits insert
|
let g:chopsticks_enable_jk_escape = 1 " optional: insert-mode jk exits insert
|
||||||
let g:chopsticks_enable_ctrl_s_save = 1 " optional: Ctrl-S saves
|
let g:chopsticks_enable_ctrl_s_save = 1 " optional: Ctrl-S saves
|
||||||
let g:chopsticks_enable_sudo_save_bang = 1 " optional: :w!! sudo save
|
let g:chopsticks_enable_sudo_save_bang = 1 " optional: :w!! sudo save
|
||||||
|
let g:chopsticks_enable_completion_keymaps = 1 " optional: Tab/Enter completion
|
||||||
```
|
```
|
||||||
|
|
||||||
`minimal` avoids LSP, ALE, completion plugins, extra language syntax plugins,
|
`minimal` avoids LSP, ALE, completion plugins, extra language syntax plugins,
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,11 @@ let g:asyncomplete_auto_popup = 1
|
||||||
let g:asyncomplete_auto_completeopt = 0
|
let g:asyncomplete_auto_completeopt = 0
|
||||||
let g:asyncomplete_popup_delay = 50
|
let g:asyncomplete_popup_delay = 50
|
||||||
|
|
||||||
|
if get(g:, 'chopsticks_enable_completion_keymaps', 0)
|
||||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||||
inoremap <expr> <CR> pumvisible() ? asyncomplete#close_popup() : "\<CR>"
|
inoremap <expr> <CR> pumvisible() ? asyncomplete#close_popup() : "\<CR>"
|
||||||
|
endif
|
||||||
|
|
||||||
" ── Buffer Keymaps ──────────────────────────────────────────────────────────
|
" ── Buffer Keymaps ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,7 @@ check_vim() {
|
||||||
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
-c 'let last_change_map = nr2char(96) . "[v" . nr2char(96) . "]"' \
|
-c 'let last_change_map = nr2char(96) . "[v" . nr2char(96) . "]"' \
|
||||||
-c 'if maparg("0", "n") !=# "" || maparg("0", "v") !=# "" || maparg("Y", "n") !=# "" || maparg("Q", "n") !=# "" || maparg("<Space>", "n") !=# "" || maparg("//", "v") !=# "" || maparg("gV", "n") !=# "" || maparg("jk", "i") !=# "" || maparg("<C-s>", "n") !=# "" || maparg("<C-s>", "i") !=# "" || maparg("<C-h>", "n") !=# "" || maparg("<C-j>", "n") !=# "" || maparg("<C-k>", "n") !=# "" || maparg("<C-l>", "n") !=# "" || maparg("<C-p>", "n") !=# "" || maparg("<C-p>", "c") !=# "" || maparg("<C-n>", "c") !=# "" || maparg("w!!", "c") !=# "" | cquit | endif' \
|
-c 'if maparg("0", "n") !=# "" || maparg("0", "v") !=# "" || maparg("Y", "n") !=# "" || maparg("Q", "n") !=# "" || maparg("<Space>", "n") !=# "" || maparg("//", "v") !=# "" || maparg("gV", "n") !=# "" || maparg("jk", "i") !=# "" || maparg("<C-s>", "n") !=# "" || maparg("<C-s>", "i") !=# "" || maparg("<C-h>", "n") !=# "" || maparg("<C-j>", "n") !=# "" || maparg("<C-k>", "n") !=# "" || maparg("<C-l>", "n") !=# "" || maparg("<C-p>", "n") !=# "" || maparg("<C-p>", "c") !=# "" || maparg("<C-n>", "c") !=# "" || maparg("w!!", "c") !=# "" | cquit | endif' \
|
||||||
|
-c 'if maparg("<Tab>", "i") =~# "pumvisible" || maparg("<S-Tab>", "i") =~# "pumvisible" || maparg("<CR>", "i") =~# "asyncomplete#close_popup" | cquit | endif' \
|
||||||
-c 'if maparg(",/", "v") !~# "escape" || maparg(",v", "n") !=# last_change_map || maparg(",ff", "n") !~# "SmartFiles" | cquit | endif' \
|
-c 'if maparg(",/", "v") !~# "escape" || maparg(",v", "n") !=# last_change_map || maparg(",ff", "n") !~# "SmartFiles" | cquit | endif' \
|
||||||
-c 'qa!' 2>&1
|
-c 'qa!' 2>&1
|
||||||
|
|
||||||
|
|
@ -216,8 +217,10 @@ check_vim() {
|
||||||
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \
|
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \
|
||||||
-c 'let g:chopsticks_enable_ctrl_s_save = 1' \
|
-c 'let g:chopsticks_enable_ctrl_s_save = 1' \
|
||||||
-c 'let g:chopsticks_enable_sudo_save_bang = 1' \
|
-c 'let g:chopsticks_enable_sudo_save_bang = 1' \
|
||||||
|
-c 'let g:chopsticks_enable_completion_keymaps = 1' \
|
||||||
-c 'source .vimrc' \
|
-c 'source .vimrc' \
|
||||||
-c 'if maparg("<C-s>", "n") !~# ":w" || maparg("<C-s>", "i") !~# ":w" || maparg("w!!", "c") !~# "sudo tee" | cquit | endif' \
|
-c 'if maparg("<C-s>", "n") !~# ":w" || maparg("<C-s>", "i") !~# ":w" || maparg("w!!", "c") !~# "sudo tee" | cquit | endif' \
|
||||||
|
-c 'if maparg("<Tab>", "i") !~# "pumvisible" || maparg("<S-Tab>", "i") !~# "pumvisible" || maparg("<CR>", "i") !~# "asyncomplete#close_popup" | cquit | endif' \
|
||||||
-c 'qa!' 2>&1
|
-c 'qa!' 2>&1
|
||||||
|
|
||||||
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue