feat(shell): fzf integration
This commit is contained in:
parent
1e66f45f14
commit
6b924576c9
2 changed files with 7 additions and 7 deletions
|
|
@ -21,12 +21,12 @@ eval "$(starship init bash)"
|
||||||
eval "$(zoxide init bash)"
|
eval "$(zoxide init bash)"
|
||||||
|
|
||||||
fzf-config-widget() {
|
fzf-config-widget() {
|
||||||
local file
|
local selected
|
||||||
file="$(FZF_CTRL_T_COMMAND="fd --type file --hidden . \"$XDG_CONFIG_HOME\"/nix | sed \"s|$HOME|~|g\"" fzf --reverse)" || return
|
selected="$(FZF_CTRL_T_COMMAND="rg --files --hidden $HOME/.config" __fzf_select__)"
|
||||||
file="${file/#\~/$HOME}"
|
READLINE_LINE="${READLINE_LINE:0:READLINE_POINT}$selected${READLINE_LINE:READLINE_POINT}"
|
||||||
READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}${file}${READLINE_LINE:$READLINE_POINT}"
|
READLINE_POINT=$((READLINE_POINT + ${#selected}))
|
||||||
READLINE_POINT=$(( READLINE_POINT + ${#file} ))
|
|
||||||
}
|
}
|
||||||
bind -x '"\C-e": fzf-config-widget'
|
bind -m vi-insert -x '"\C-e": fzf-config-widget'
|
||||||
|
bind -m vi-command -x '"\C-e": fzf-config-widget'
|
||||||
|
|
||||||
[ -r "$OPAMROOT/opam-init/init.sh" ] && . "$OPAMROOT/opam-init/init.sh" > /dev/null 2> /dev/null
|
[ -r "$OPAMROOT/opam-init/init.sh" ] && . "$OPAMROOT/opam-init/init.sh" > /dev/null 2> /dev/null
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'barrettruth/cp.nvim',
|
'barrettruth/cp.nvim',
|
||||||
-- dir = '~/dev/cp.nvim',
|
dir = '~/dev/cp.nvim',
|
||||||
cmd = 'CP',
|
cmd = 'CP',
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>ce', '<cmd>CP edit<cr>' },
|
{ '<leader>ce', '<cmd>CP edit<cr>' },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue