diff --git a/docs/pacman_pkgs.txt b/docs/pacman_pkgs.txt index 9fbd27d..dfd02cd 100644 --- a/docs/pacman_pkgs.txt +++ b/docs/pacman_pkgs.txt @@ -1,4 +1,6 @@ bat +bear +ccls exa fd kitty diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index c01c19b..7483843 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -11,7 +11,7 @@ return { cmp.setup { mapping = cmp.mapping.preset.insert { - [""] = function(fallback) + [""] = function(fallback) if cmp.visible() then cmp.confirm { select=true } else diff --git a/zsh/dot-zshrc b/zsh/dot-zshrc index 79f2506..a1412bb 100644 --- a/zsh/dot-zshrc +++ b/zsh/dot-zshrc @@ -1,6 +1,15 @@ function create_dir() [ ! -d "$1" ] && mkdir -p "$1" function safe_source() [ -f "$1" ] && source "$1" function zsh_add_file() safe_source "$ZDOTDIR/$1" +function zsh_add_plugin() { + PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) + + [ ! -d "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME" ] && + git clone "https://github.com/$1.git" "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME" + + safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" + safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh" +} zsh_add_file "zsh-aliases" zsh_add_file "zsh-functions" @@ -12,16 +21,7 @@ zsh_add_plugin "zdharma-continuum/fast-syntax-highlighting" zsh_add_plugin "zsh-users/zsh-autosuggestions" zsh_add_plugin "zsh-users/zsh-completions" -create_dir "$HOME/.cache/zsh" -autoload -Uz compinit && compinit -d "$HOME/.cache/zsh/zcompdump" -zmodload zsh/complist -zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' - -autoload -z edit-command-line -zle -N edit-command-line - -bindkey -e -bindkey "^V" edit-command-line -bindkey '^K' autosuggest-execute +zsh_add_file "zsh-completions" +zsh_add_file "zsh-bindings" # vim: filetype=zsh diff --git a/zsh/zsh-bindings b/zsh/zsh-bindings new file mode 100644 index 0000000..b2108e9 --- /dev/null +++ b/zsh/zsh-bindings @@ -0,0 +1,8 @@ +autoload -z edit-command-line +zle -N edit-command-line +bindkey "^V" edit-command-line + +bindkey '^Y' autosuggest-execute +bindkey '^F' find-directory + +# vim: filetype=zsh diff --git a/zsh/zsh-completion b/zsh/zsh-completion new file mode 100644 index 0000000..4b1cf3f --- /dev/null +++ b/zsh/zsh-completion @@ -0,0 +1,7 @@ +create_dir "$HOME/.cache/zsh" +autoload -Uz compinit +compinit -d "$HOME/.cache/zsh/zcompdump" +zmodload zsh/complist +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + +# vim: filetype=zsh diff --git a/zsh/zsh-functions b/zsh/zsh-functions index 805c216..fdf4d2a 100644 --- a/zsh/zsh-functions +++ b/zsh/zsh-functions @@ -1,21 +1,6 @@ -function zsh_add_plugin() { - PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) - - [ ! -d "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME" ] && - git clone "https://github.com/$1.git" "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME" - - safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" - safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh" -} - function cc() python -c "from math import *; print($*)" function mkcd() mkdir -p -- $1 && cd -- $1 -function serve() { - gem list -i '^webrick$' > /dev/null || gem install webrick - ruby -run -e httpd . -p 3000 -} - function save-ssh-key() { mv "$1" "$HOME/.ssh/${1}_${2}" mv "$1.pub" "$HOME/.ssh/${1}_${2}.pub" @@ -25,4 +10,15 @@ function eik() { kitten edit-in-kitty "$1" } +function find-directory() { + FOLDER=$(fd -t d --hidden | fzf --height "50%" --reverse) + if [ -n "$FOLDER" ]; then + BUFFER="cd $FOLDER" + zle .accept-line + else + zle reset-prompt + fi +} +zle -N find-directory + # vim: filetype=zsh diff --git a/zsh/zsh-options b/zsh/zsh-options index 6c112ef..59ffc87 100644 --- a/zsh/zsh-options +++ b/zsh/zsh-options @@ -11,6 +11,8 @@ setopt INC_APPEND_HISTORY setopt RM_STAR_SILENT setopt NO_BEEP +bindkey -e + stty stop undef zle_highlight=("paste:none")