zsh and nvim completions
This commit is contained in:
parent
cf09544569
commit
44839849b6
@ -25,23 +25,26 @@ local function setup_cmp()
|
|||||||
['<Tab>'] = cmp.mapping(
|
['<Tab>'] = cmp.mapping(
|
||||||
function(fallback)
|
function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Select,
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
elseif has_words_before() then
|
elseif has_words_before() then
|
||||||
cmp.complete()
|
cmp.complete()
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{ "i", "s" }
|
{ "i", "s" }
|
||||||
),
|
),
|
||||||
['<S-Tab>'] = cmp.mapping.select_prev_item({ behaviour = cmp.SelectBehavior.Select }),
|
['<C-k>'] = cmp.mapping.select_prev_item({ behaviour = cmp.SelectBehavior.Select }),
|
||||||
|
['<C-j>'] = cmp.mapping.select_next_item({ behaviour = cmp.SelectBehavior.Select }),
|
||||||
['<C-p>'] = cmp.mapping.scroll_docs(4),
|
['<C-p>'] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-n>'] = cmp.mapping.scroll_docs(-4),
|
['<C-n>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
['<CR>'] = cmp.mapping.confirm({
|
|
||||||
behavior = cmp.ConfirmBehavior.Select,
|
|
||||||
select = false,
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
window = {
|
window = {
|
||||||
completion = cmp.config.window.bordered(border_opts),
|
completion = cmp.config.window.bordered(border_opts),
|
||||||
|
|||||||
@ -10,10 +10,7 @@ aliases[=]='noglob __calc'
|
|||||||
|
|
||||||
|
|
||||||
function accept-line() {
|
function accept-line() {
|
||||||
if [[ -z "${BUFFER}" ]]; then
|
if [[ ${BUFFER} =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
|
||||||
echo
|
|
||||||
ls
|
|
||||||
elif [[ ${BUFFER} =~ '^[ ]?\(?[-+]?[0-9]+[^a-zA-Z]+' ]]; then
|
|
||||||
echo
|
echo
|
||||||
test "${BUFFER[1]}" != " " && print -S -- "${BUFFER}" # saving the command to history
|
test "${BUFFER[1]}" != " " && print -S -- "${BUFFER}" # saving the command to history
|
||||||
__calc "${BUFFER}" | sed 's/\.$//'
|
__calc "${BUFFER}" | sed 's/\.$//'
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
|
|
||||||
# enable completion features
|
# enable completion features
|
||||||
fpath=(~/.zfunc $fpath)
|
fpath=(~/.zfunc $fpath)
|
||||||
|
zmodload zsh/complist
|
||||||
|
setopt menucomplete
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit -d ~/.cache/zcompdump
|
compinit -d ~/.cache/zcompdump
|
||||||
zstyle ':completion:*:*:*:*:*' menu select
|
zstyle ':completion:*' menu yes select
|
||||||
zstyle ':completion:*' auto-description 'specify: %d'
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||||
zstyle ':completion:*' format 'Completing %d'
|
zstyle ':completion:*' format 'Completing %d'
|
||||||
@ -32,3 +34,15 @@ zstyle ':completion:*:cd:*' ignore-parents parent pwd
|
|||||||
compdef _directories _d
|
compdef _directories _d
|
||||||
compdef _files _f
|
compdef _files _f
|
||||||
compdef _directories mcd
|
compdef _directories mcd
|
||||||
|
|
||||||
|
|
||||||
|
bindkey -M menuselect '^h' vi-backward-char
|
||||||
|
bindkey -M menuselect '^k' vi-up-line-or-history
|
||||||
|
bindkey -M menuselect '^j' vi-down-line-or-history
|
||||||
|
bindkey -M menuselect '^l' vi-forward-char
|
||||||
|
bindkey -M menuselect '^[' undo
|
||||||
|
bindkey -M menuselect '^I' accept-line
|
||||||
|
|
||||||
|
setopt list_packed
|
||||||
|
setopt always_to_end
|
||||||
|
setopt auto_param_slash
|
||||||
Loading…
x
Reference in New Issue
Block a user