From d3a88cbb28f64d643d6b66ad651ea6fac580f3eb Mon Sep 17 00:00:00 2001 From: aleidk Date: Mon, 5 Aug 2024 14:51:17 -0400 Subject: [PATCH] first commit config imported from personal dotfiles aleee-idk/dots --- .chezmoiroot | 1 + .gitignore | 18 + chezmoi/.chezmoi.toml.tmpl | 7 + chezmoi/.chezmoidata/packages.yaml | 27 + chezmoi/.chezmoiexternal.toml | 16 + chezmoi/.chezmoiignore | 2 + .../run_onchange_bootstrap.tmpl | 46 ++ chezmoi/dot_config/bat/config | 27 + chezmoi/dot_config/fzf/forgitrc | 49 ++ chezmoi/dot_config/fzf/fzfrc | 130 ++++ .../dot_config/fzf/widgets/alias_widget.zsh | 16 + .../fzf/widgets/atuin-history_widget.zsh | 25 + .../fzf/widgets/cd-recent-dir_widget.zsh | 15 + chezmoi/dot_config/fzf/widgets/cd_widget.zsh | 20 + .../fzf/widgets/dictionary_widget.zsh | 24 + .../fzf/widgets/fzf-rg-launcher.zsh | 7 + .../dot_config/fzf/widgets/locate_widget.zsh | 13 + chezmoi/dot_config/fzf/widgets/man_widget.zsh | 21 + chezmoi/dot_config/git/config | 7 + chezmoi/dot_config/git/ignore | 6 + chezmoi/dot_config/mise/config.toml | 6 + chezmoi/dot_config/nvim/init.lua | 26 + .../dot_config/nvim/lua/aleidk/autocmds.lua | 10 + .../dot_config/nvim/lua/aleidk/constants.lua | 63 ++ .../dot_config/nvim/lua/aleidk/keymaps.lua | 68 ++ .../dot_config/nvim/lua/aleidk/options.lua | 76 ++ .../nvim/lua/aleidk/plugins/auto-pairs.lua | 5 + .../nvim/lua/aleidk/plugins/bookmarks.lua | 19 + .../nvim/lua/aleidk/plugins/colorscheme.lua | 39 + .../nvim/lua/aleidk/plugins/comments.lua | 34 + .../nvim/lua/aleidk/plugins/completion.lua | 94 +++ .../nvim/lua/aleidk/plugins/dashboard.lua | 35 + .../nvim/lua/aleidk/plugins/database.lua | 44 ++ .../nvim/lua/aleidk/plugins/dressing.lua | 10 + .../nvim/lua/aleidk/plugins/file-explorer.lua | 66 ++ .../nvim/lua/aleidk/plugins/flash.lua | 25 + .../nvim/lua/aleidk/plugins/formatter.lua | 56 ++ .../nvim/lua/aleidk/plugins/git.lua | 87 +++ .../lua/aleidk/plugins/indent-blankline.lua | 30 + .../nvim/lua/aleidk/plugins/init.lua | 69 ++ .../nvim/lua/aleidk/plugins/key-help.lua | 75 ++ .../nvim/lua/aleidk/plugins/linters.lua | 29 + .../nvim/lua/aleidk/plugins/lsp.lua | 183 +++++ .../nvim/lua/aleidk/plugins/lualine.lua | 164 +++++ .../nvim/lua/aleidk/plugins/luasnip.lua | 27 + .../nvim/lua/aleidk/plugins/markdown.lua | 14 + .../nvim/lua/aleidk/plugins/mason.lua | 22 + .../nvim/lua/aleidk/plugins/noice.lua | 123 ++++ .../nvim/lua/aleidk/plugins/pretty-fold.lua | 42 ++ .../nvim/lua/aleidk/plugins/quickfix.lua | 89 +++ .../nvim/lua/aleidk/plugins/sessions.lua | 15 + .../nvim/lua/aleidk/plugins/smart-splits.lua | 65 ++ .../nvim/lua/aleidk/plugins/surround.lua | 6 + .../nvim/lua/aleidk/plugins/telescope.lua | 90 +++ .../nvim/lua/aleidk/plugins/todo-comments.lua | 13 + .../nvim/lua/aleidk/plugins/treesitter.lua | 98 +++ .../nvim/lua/aleidk/plugins/trouble.lua | 24 + .../lua/aleidk/plugins/ts-node-action.lua | 23 + .../nvim/lua/aleidk/plugins/zen.lua | 81 +++ .../dot_config/nvim/original_lazy-lock.json | 2 + .../nvim/symlink_lazy-lock.json.tmpl | 2 + chezmoi/dot_config/sesh/sesh.toml | 14 + chezmoi/dot_config/starship.toml | 234 ++++++ chezmoi/dot_config/tmux/tmux.conf | 116 +++ chezmoi/dot_config/yazi/init.lua | 1 + chezmoi/dot_config/yazi/keymap.toml | 293 ++++++++ chezmoi/dot_config/yazi/original_package.toml | 5 + .../dot_config/yazi/symlink_package.toml.tmpl | 2 + chezmoi/dot_config/yazi/theme.toml | 2 + chezmoi/dot_config/yazi/yazi.toml | 203 ++++++ chezmoi/dot_config/zsh/aliases/aliases.zsh | 61 ++ chezmoi/dot_config/zsh/aliases/configs.zsh | 4 + chezmoi/dot_config/zsh/aliases/fzf.zsh | 1 + chezmoi/dot_config/zsh/aliases/nvim.zsh | 22 + chezmoi/dot_config/zsh/aliases/pnpm.zsh | 47 ++ chezmoi/dot_config/zsh/completions/_cargo | 447 ++++++++++++ chezmoi/dot_config/zsh/completions/_chezmoi | 212 ++++++ chezmoi/dot_config/zsh/completions/_cht | 20 + chezmoi/dot_config/zsh/completions/_globdots | 1 + chezmoi/dot_config/zsh/completions/_lsd | 86 +++ chezmoi/dot_config/zsh/completions/_rg | 665 ++++++++++++++++++ chezmoi/dot_config/zsh/functions/fedora.zsh | 32 + .../dot_config/zsh/functions/functions.zsh | 68 ++ chezmoi/executable_dot_zprofile.tmpl | 32 + chezmoi/executable_dot_zshrc | 142 ++++ 85 files changed, 5236 insertions(+) create mode 100644 .chezmoiroot create mode 100644 .gitignore create mode 100644 chezmoi/.chezmoi.toml.tmpl create mode 100644 chezmoi/.chezmoidata/packages.yaml create mode 100644 chezmoi/.chezmoiexternal.toml create mode 100644 chezmoi/.chezmoiignore create mode 100644 chezmoi/.chezmoiscripts/run_onchange_bootstrap.tmpl create mode 100644 chezmoi/dot_config/bat/config create mode 100644 chezmoi/dot_config/fzf/forgitrc create mode 100644 chezmoi/dot_config/fzf/fzfrc create mode 100644 chezmoi/dot_config/fzf/widgets/alias_widget.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/atuin-history_widget.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/cd-recent-dir_widget.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/cd_widget.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/dictionary_widget.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/fzf-rg-launcher.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/locate_widget.zsh create mode 100644 chezmoi/dot_config/fzf/widgets/man_widget.zsh create mode 100644 chezmoi/dot_config/git/config create mode 100644 chezmoi/dot_config/git/ignore create mode 100644 chezmoi/dot_config/mise/config.toml create mode 100644 chezmoi/dot_config/nvim/init.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/autocmds.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/constants.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/options.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/auto-pairs.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/bookmarks.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/colorscheme.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/comments.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/completion.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/dashboard.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/database.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/dressing.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/file-explorer.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/flash.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/formatter.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/git.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/indent-blankline.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/init.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/key-help.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/linters.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/lsp.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/lualine.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/luasnip.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/markdown.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/mason.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/noice.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/pretty-fold.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/quickfix.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/sessions.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/smart-splits.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/telescope.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/todo-comments.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/treesitter.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/trouble.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/ts-node-action.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/zen.lua create mode 100644 chezmoi/dot_config/nvim/original_lazy-lock.json create mode 100644 chezmoi/dot_config/nvim/symlink_lazy-lock.json.tmpl create mode 100644 chezmoi/dot_config/sesh/sesh.toml create mode 100644 chezmoi/dot_config/starship.toml create mode 100644 chezmoi/dot_config/tmux/tmux.conf create mode 100644 chezmoi/dot_config/yazi/init.lua create mode 100644 chezmoi/dot_config/yazi/keymap.toml create mode 100644 chezmoi/dot_config/yazi/original_package.toml create mode 100644 chezmoi/dot_config/yazi/symlink_package.toml.tmpl create mode 100644 chezmoi/dot_config/yazi/theme.toml create mode 100644 chezmoi/dot_config/yazi/yazi.toml create mode 100644 chezmoi/dot_config/zsh/aliases/aliases.zsh create mode 100644 chezmoi/dot_config/zsh/aliases/configs.zsh create mode 100644 chezmoi/dot_config/zsh/aliases/fzf.zsh create mode 100644 chezmoi/dot_config/zsh/aliases/nvim.zsh create mode 100644 chezmoi/dot_config/zsh/aliases/pnpm.zsh create mode 100644 chezmoi/dot_config/zsh/completions/_cargo create mode 100644 chezmoi/dot_config/zsh/completions/_chezmoi create mode 100644 chezmoi/dot_config/zsh/completions/_cht create mode 100644 chezmoi/dot_config/zsh/completions/_globdots create mode 100644 chezmoi/dot_config/zsh/completions/_lsd create mode 100644 chezmoi/dot_config/zsh/completions/_rg create mode 100644 chezmoi/dot_config/zsh/functions/fedora.zsh create mode 100644 chezmoi/dot_config/zsh/functions/functions.zsh create mode 100644 chezmoi/executable_dot_zprofile.tmpl create mode 100644 chezmoi/executable_dot_zshrc diff --git a/.chezmoiroot b/.chezmoiroot new file mode 100644 index 0000000..73d74c2 --- /dev/null +++ b/.chezmoiroot @@ -0,0 +1 @@ +chezmoi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..218484e --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Config +**/packer_compiled.lua +config/spicetify/Extracted +config/vifm/Trash +config/vifm/vifminfo.json +config/lazygit/state.yml +config/mpv/shaders +config/tmux/plugins/* +!config/tmux/plugins/.gitkeep + + +config/spicetify/Backup +# nixos/hardware-configuration.nix +result +config/ncspot/userstate.cbor +config/zsh/zprofile.local +config/spicetify/CustomApps/* +chezmoi/dot_config/zsh/aliases/work.zsh diff --git a/chezmoi/.chezmoi.toml.tmpl b/chezmoi/.chezmoi.toml.tmpl new file mode 100644 index 0000000..9037de9 --- /dev/null +++ b/chezmoi/.chezmoi.toml.tmpl @@ -0,0 +1,7 @@ +{{- $osid := .chezmoi.os -}} +{{- if hasKey .chezmoi.osRelease "id" -}} +{{- $osid = printf "%s-%s" .chezmoi.os .chezmoi.osRelease.id -}} +{{- end -}} + +[data] + osid = {{ $osid | quote }} diff --git a/chezmoi/.chezmoidata/packages.yaml b/chezmoi/.chezmoidata/packages.yaml new file mode 100644 index 0000000..c917ab1 --- /dev/null +++ b/chezmoi/.chezmoidata/packages.yaml @@ -0,0 +1,27 @@ +packages: + cargo: + - du-dust + - mise + dnf: + copr: + - atim/starship + packages: + - bat + - dnf-plugin-system-upgrade + - duf + - eza + - fd-find + - fzf + - gcc + - gcc-c++ + - git + - neovim + - openssl + - openssl-devel + - ripgrep + - sd + - starship + - tmux + - tree-sitter-cli + - zoxide + - zsh diff --git a/chezmoi/.chezmoiexternal.toml b/chezmoi/.chezmoiexternal.toml new file mode 100644 index 0000000..3d95225 --- /dev/null +++ b/chezmoi/.chezmoiexternal.toml @@ -0,0 +1,16 @@ +[".local/share/zinit"] + type = "git-repo" + url = "https://github.com/zdharma-continuum/zinit.git" + refreshPeriod = "168h" + +[".config/bat/themes/Catppuccin-macchiato.tmTheme"] + # Run "bat cache --build" to make the theme available + type = "file" + url = "https://github.com/catppuccin/bat/raw/main/themes/Catppuccin%20Macchiato.tmTheme" + refreshPeriod = "168h" + +[".local/bin/sesh"] + type = "archive-file" + url = "https://github.com/joshmedeski/sesh/releases/latest/download/sesh_Linux_x86_64.tar.gz" + path = "sesh" + refreshPeriod = "168h" diff --git a/chezmoi/.chezmoiignore b/chezmoi/.chezmoiignore new file mode 100644 index 0000000..e09c792 --- /dev/null +++ b/chezmoi/.chezmoiignore @@ -0,0 +1,2 @@ +**/original_* +.config/lazygit/state.yml diff --git a/chezmoi/.chezmoiscripts/run_onchange_bootstrap.tmpl b/chezmoi/.chezmoiscripts/run_onchange_bootstrap.tmpl new file mode 100644 index 0000000..df9d632 --- /dev/null +++ b/chezmoi/.chezmoiscripts/run_onchange_bootstrap.tmpl @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -e + +NO_FORMAT="\033[0m" +C_DODGERBLUE1="\033[38;5;33m" +echo -e "${C_DODGERBLUE1}Installing packages...${NO_FORMAT}" + +{{- if eq .osid "darwin" }} +# macOS-specific code +{{- else if eq .osid "linux-debian" }} +# Debian-specific code +{{- else if eq .osid "linux-fedora" }} + + # ╭──────────────────────────────────────────────────────────╮ + # │ Add COPR repos │ + # ╰──────────────────────────────────────────────────────────╯ + + sudo dnf install -yq 'dnf-command(copr)' + + {{ range .packages.dnf.copr -}} + sudo dnf copr enable -y {{ . | quote }} &> /dev/null + {{ end -}} + + # ╭──────────────────────────────────────────────────────────╮ + # │ Install DNF packages │ + # ╰──────────────────────────────────────────────────────────╯ + + sudo dnf install -y {{ range .packages.dnf.packages }} {{ . | quote }} {{- end -}} + +{{ end }} + +# ╭──────────────────────────────────────────────────────────╮ +# │ Install Rust │ +# ╰──────────────────────────────────────────────────────────╯ + +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable + +rustup update + +# ╭──────────────────────────────────────────────────────────╮ +# │ Install Cargo Packages │ +# ╰──────────────────────────────────────────────────────────╯ + +cargo install {{ range .packages.cargo }} {{ . | quote }} {{- end -}} + diff --git a/chezmoi/dot_config/bat/config b/chezmoi/dot_config/bat/config new file mode 100644 index 0000000..c1d1c8a --- /dev/null +++ b/chezmoi/dot_config/bat/config @@ -0,0 +1,27 @@ +# This is `bat`s configuration file. Each line either contains a comment or +# a command-line option that you want to pass to `bat` by default. You can +# run `bat --help` to get a list of all possible configuration options. + +# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes` +# for a list of all available themes +--theme="Catppuccin-macchiato" + +--style="changes,numbers" + +# Enable this to use italic text on the terminal. This is not supported on all +# terminal emulators (like tmux, by default): +#--italic-text=always + +# Uncomment the following line to disable automatic paging: +#--paging=never + +# Uncomment the following line if you are using less version >= 551 and want to +# enable mouse scrolling support in `bat` when running inside tmux. This might +# disable text selection, unless you press shift. +#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse" + +# Syntax mappings: map a certain filename pattern to a language. +# Example 1: use the C++ syntax for Arduino .ino files +# Example 2: Use ".gitignore"-style highlighting for ".ignore" files +#--map-syntax "*.ino:C++" +#--map-syntax ".ignore:Git Ignore" diff --git a/chezmoi/dot_config/fzf/forgitrc b/chezmoi/dot_config/fzf/forgitrc new file mode 100644 index 0000000..17c15cc --- /dev/null +++ b/chezmoi/dot_config/fzf/forgitrc @@ -0,0 +1,49 @@ +forgit-list-command-widget() { + local cmd=$(alias | grep 'forgit' | sed -E 's/::/ /g; s/=/ :- /g; s/for//g' | \ + awk -v BLD=${BLD} -v RST=${RST} -v BLU=${BLU} -v CYN=${CYN} -F":" '{print BLU BLD $1 RST ":" CYN $2 RST }' | \ + column -ts":") + LBUFFER="$LBUFFER$( \ + fzf-tmux -p -w 30% -h 53% --preview-window=hidden --prompt=' List > ' \ + --header=$'Alias\t Description' <<< "$cmd" | awk '{print $1}')" + if [[ -n $LBUFFER ]]; then + zle accept-line + fi + zle reset-prompt +} + +zle -N forgit-list-command-widget +bindkey '^[g^[l' forgit-list-command-widget # + +export FORGIT_FZF_SHOW_HELP_OPTS="$( +cat <<-EOF + + Forgit Commands (Aliases) + + fga add + fgbl blame + fgbd branch delete + fgcb checkout branch + fgco checkout commit + fgcf checkout file + fgct checkout tag + fgcp cherry pick + fgclean clean + fgd diff + fgfu fixup + fgi ignore + fglo log + fgrb rebase + fgrh reset head + fgrev revert commit + fgsta stash push + fgsts stash show +EOF +)" + +export FORGIT_FZF_DEFAULT_OPTS=" +--cycle +--reverse +--height '80%' +--preview-window=nohidden +--bind 'alt-?:preview(printf \"${FORGIT_FZF_SHOW_HELP_OPTS}\")' +" diff --git a/chezmoi/dot_config/fzf/fzfrc b/chezmoi/dot_config/fzf/fzfrc new file mode 100644 index 0000000..d7c9236 --- /dev/null +++ b/chezmoi/dot_config/fzf/fzfrc @@ -0,0 +1,130 @@ +export FZF_SHOW_HELP_OPTS="$( +cat <<-EOF + + FZF Keybinds Shortcut + + ? Toggle/Hide Preview + C-space Change preview layout + C-e Open in Editor + C-v Open in VsCode + C-o Launch Application Chooser + M-o Open in Default Appllication + C-/ Directory: Navigate on broot + C-/ File: Open in Pager (bat) + + M-s Toggle Sort + C-y Copy/Yank + C-M-y Copy/Yank Working Directory + C-a Select all + C-M-d Deselect All + Del Delete/Remove file + + Alt-? Help (this page) + ESC Quit +EOF +)" + +export FZF_DEFAULT_OPTS=" \ +--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \ +--color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \ +--color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796" + +export FZF_PREVIEW_OPTS="--preview +'([[ {} =~ ('.jpg'|'.jpeg'|'.png'|'.gif'|'.bmp'|'.svg'|'.mp4'|'.mkv')$ ]] && (chafa --center=on {} && exiftool {})) || +([[ -f {} ]] && (bat --style=header,numbers,changes,plain --color=always --language=sh --line-range :500 {} || cat {})) || +([[ -d {} ]] && (lsd -all --long --tree --depth=5 --group-dirs=first -I=.git {} )) || echo {} 3>/dev/null | head -n 500' +" + +#'([[ \$(file -bL --mime-type {} 2> /dev/null = image) ]] && (catimg -w 100 {})) || # throwing an stb error cant silence + +export FZF_PREVIEW_KEYBIND_OPTS=" +--bind '?:toggle-preview' +--bind 'alt-?:preview(printf \"${FZF_SHOW_HELP_OPTS}\")' +--bind 'alt-j:preview-down' +--bind 'alt-k:preview-up' +--bind 'ctrl-d:preview-page-down' +--bind 'ctrl-u:preview-page-up' +--bind 'ctrl-t:preview-top' +--bind 'ctrl-b:preview-bottom' +--bind 'ctrl-l:clear-screen+clear-query+first' +--bind 'ctrl-space:change-preview-window(right,80%,nohidden|down,80%,border-top,nohidden|down,50%,nohidden|up,80%,border-down,nohidden|up,50%,nohidden|left,80%,nohidden|left,50%,nohidden|down:3:nohidden:wrap|up:3,nohidden:wrap|right,50%,nohidden)' +" +export FZF_KEYBIND_SHORTCUTS=" +$FZF_PREVIEW_KEYBIND_OPTS +--bind 'alt-o:execute(xdg-open {+})' +--bind 'alt-s:toggle-sort' +--bind 'ctrl-/:execute( +if [[ -d {} ]]; then + broot {} < /dev/tty > /dev/tty 2>&1 +elif [[ {} =~ ('.jpg'|'.jpeg'|'.png'|'.gif'|'.bmp'|'.svg'|'.mp4'|'.mkv')$ ]]; then + chafa --center {} | less > /dev/tty +else + bat --paging=always --style=plain --color=always --language=sh {} > /dev/tty +fi)' +--bind 'ctrl-a:select-all' +--bind 'ctrl-alt-d:deselect-all' +--bind 'ctrl-o:execute(flatpak run re.sonny.Junction {+})' +--bind 'ctrl-y:execute-silent(wl-copy {+})' +--bind 'ctrl-alt-y:execute-silent(readlink -f {+} | wl-copy)' +--bind 'ctrl-e:execute(${EDITOR} {} > /dev/tty)' +--bind 'ctrl-v:execute(code {+})' +--bind 'del:execute(rm -iv {};)+reload($FZF_DEFAULT_COMMAND)+clear-screen' +" +# --bind 'ctrl-/:execute(if [[ -f {} ]]; then bat --paging=always --style=\"header,numbers,changes\" --language=sh {} < /dev/tty > /dev/tty 2>&1; else broot {} < /dev/tty > /dev/tty 2>&1 +# ; fi)' + +export FZF_DEFAULT_COMMAND="fd --color=always --hidden --exclude .git" + +export FZF_DEFAULT_OPTS=" +"$FZF_PREVIEW_OPTS" +"$FZF_KEYBIND_SHORTCUTS" +"$FZF_THEME_CATPPUCCIN_MOCHA" +-i +--ansi +--multi +--height=90% +--info=inline +--no-separator +--layout=reverse +--preview-window=:hidden +" + +export FZF_ALT_C_COMMAND="fd --type=d --color=always --hidden --exclude .git" + +export FZF_ALT_C_OPTS=" +--preview 'lsd --all --long --tree --depth=3 {} | head -500' +--preview-window 'nohidden,<50(down,75%,border-top)' +--bind 'alt-h:reload(fd --type=d --color=always --follow --exclude .git)' +--bind 'alt-c:reload(fd -p ~ --color=always --hidden --type=d --follow)' +" + +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" + +export FZF_CTRL_T_OPTS=" +--exit-0 +--select-1 +--info=default +--layout=reverse-list +--preview-window '50%,<50(up,75%,border-down)' +--header 'Alt-D: Directories | Alt-F: Files | Alt-H: Hide Files' +--bind 'alt-d:change-prompt( Directories > )+reload("$FZF_ALT_C_COMMAND")' +--bind 'alt-f:change-prompt( Files > )+reload("$FZF_DEFAULT_COMMAND")' +--bind 'alt-h:change-prompt( Hide Files > )+reload(fd --type=f --color=always --follow)' +--bind 'ctrl-t:change-prompt(Home > )+reload(fd --base-directory ~ --color=always --hidden --exclude .git)' +" + +export FZF_CTRL_R_OPTS=" +--preview 'echo {+} | bat --color=always --wrap never --language=sh --style=plain' +--preview-window 'down:3:nohidden:wrap'" + +# export FZF_TMUX_OPTS='-p80% --color=border:blue' +# FZF_TMUX_CTRL_R_OPT="fzf-tmux -p $FZF_CTRL_R_OPTS" +# --bind 'alt-p:execute($'FZF_TMUX_OPTS'='-p90% --color=border:blue')' + +# fzf completion '**' doesn't preview files (idk if it is a bug) +_fzf_compgen_path() { + fd --color=always --hidden --follow --exclude ".git" . "$1" +} +_fzf_compgen_dir() { + fd --color=always --type d --hidden --follow --exclude ".git" . "$1" +} diff --git a/chezmoi/dot_config/fzf/widgets/alias_widget.zsh b/chezmoi/dot_config/fzf/widgets/alias_widget.zsh new file mode 100644 index 0000000..014307f --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/alias_widget.zsh @@ -0,0 +1,16 @@ +fzf-aliases-widget() { + LBUFFER="$LBUFFER$(FZF_DEFAULT_COMMAND= + alias | sed 's/=/ --- /' | \ + awk -v blu=$(tput setaf 4) -v cyn=$(tput setaf 6) -v bld=$(tput bold) -v rst=$(tput sgr0) -F '---' \ + '{ + print bld cyn $1 rst blu "--" $2 + }' | \ + tr -d "'" | column -tl2 | \ + fzf --prompt=" Aliases > " \ + --preview 'echo {3..} | bat --color=always --plain --language=sh' \ + --preview-window 'up:4:nohidden:wrap' | cut -d' ' -f 1)" + zle reset-prompt +} + +zle -N fzf-aliases-widget +bindkey '^[a' fzf-aliases-widget # diff --git a/chezmoi/dot_config/fzf/widgets/atuin-history_widget.zsh b/chezmoi/dot_config/fzf/widgets/atuin-history_widget.zsh new file mode 100644 index 0000000..05cf086 --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/atuin-history_widget.zsh @@ -0,0 +1,25 @@ +fzf-atuin-history-widget() { + local selected num + setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null + selected=( $(atuin history list --cmd-only | tac | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' | bat --color=always --wrap never --language=sh --style=plain | + FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) ) + local ret=$? + if [ -n "$selected" ]; then + cmd=$selected[1,-1] + if [ -n "$cmd" ]; then + zle vi-fetch-history -n $cmd + fi + fi + zle -U "$cmd" + zle kill-buffer + zle reset-prompt + return $ret +} + +if ! command -v atuin > /dev/null; then + zle -N fzf-history-widget + bindkey '^R' fzf-history-widget +else + zle -N fzf-atuin-history-widget + bindkey '^R' fzf-atuin-history-widget +fi diff --git a/chezmoi/dot_config/fzf/widgets/cd-recent-dir_widget.zsh b/chezmoi/dot_config/fzf/widgets/cd-recent-dir_widget.zsh new file mode 100644 index 0000000..5bccfe5 --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/cd-recent-dir_widget.zsh @@ -0,0 +1,15 @@ +fzf-cd-recent-dir-widget () { + local dir + print -rNC1 -- $dirstack | + FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-}" $(__fzfcmd) +m \ + --color=fg:bold:blue --query=${LBUFFER} --read0 --print0 | + IFS= read -rd '' dir + if [[ -n $dir ]]; then + BUFFER=" builtin cd -- $dir" + zle accept-line + fi + zle reset-prompt +} + +zle -N fzf-cd-recent-dir-widget +bindkey '^[C' fzf-cd-recent-dir-widget # diff --git a/chezmoi/dot_config/fzf/widgets/cd_widget.zsh b/chezmoi/dot_config/fzf/widgets/cd_widget.zsh new file mode 100644 index 0000000..23276fd --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/cd_widget.zsh @@ -0,0 +1,20 @@ +fzf-cd-widget() { + local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ + -o -type d -print 2> /dev/null | cut -b3-"}" + setopt localoptions pipefail no_aliases 2> /dev/null + local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-}" $(__fzfcmd) +m)" + if [[ -z "$dir" ]]; then + zle redisplay + return 0 + fi + zle push-line # Clear buffer. Auto-restored on next prompt. + BUFFER=" builtin cd -- ${(q)dir}" + zle accept-line + local ret=$? + unset dir # ensure this doesn't end up appearing in prompt expansion + zle reset-prompt + return $ret +} + +zle -N fzf-cd-widget +bindkey '^[c' fzf-cd-widget # diff --git a/chezmoi/dot_config/fzf/widgets/dictionary_widget.zsh b/chezmoi/dot_config/fzf/widgets/dictionary_widget.zsh new file mode 100644 index 0000000..520a4e2 --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/dictionary_widget.zsh @@ -0,0 +1,24 @@ +fzf-dictionary-widget() { +local dict wiki wikis gogl +dict="dict {}" +wiki="wiki {} > /dev/tty" +wweb="w3m https://en.wikipedia.org/wiki/{}" +gogl="w3m https://google.com/search?q=define\ {}" + LBUFFER="$LBUFFER$(FZF_DEFAULT_COMMAND= cat /usr/share/dict/*words | sort | uniq -id | \ + fzf-tmux \ + -p60% \ + --layout=default \ + --header-first \ + --header="M-w: Wiki | M-d: Define | M-g: Google" \ + --color=fg:blue,fg+:blue,border:blue \ + --bind="alt-d:change-preview($dict)" \ + --bind="alt-w:execute($wiki)" \ + --bind="alt-g:execute($gogl)" \ + --prompt=" > " \ + --preview "$dict" \ + --preview-window='up,85%,border-bottom,wrap' | paste -sd" " -)" + zle reset-prompt +} + +zle -N fzf-dictionary-widget +bindkey '^[d' fzf-dictionary-widget # diff --git a/chezmoi/dot_config/fzf/widgets/fzf-rg-launcher.zsh b/chezmoi/dot_config/fzf/widgets/fzf-rg-launcher.zsh new file mode 100644 index 0000000..004e1fc --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/fzf-rg-launcher.zsh @@ -0,0 +1,7 @@ +function fzf-rg-widget() { + bash ${DOOTS:-$HOME/.local}/bin/fzf-rg-launcher "$LBUFFER" + zle redisplay +} + +zle -N fzf-rg-widget +bindkey '^F' fzf-rg-widget diff --git a/chezmoi/dot_config/fzf/widgets/locate_widget.zsh b/chezmoi/dot_config/fzf/widgets/locate_widget.zsh new file mode 100644 index 0000000..9e58433 --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/locate_widget.zsh @@ -0,0 +1,13 @@ +fzf-locate-widget() { + local selected + if selected=$(locate / | fzf --prompt " Locate > " -q "$LBUFFER" \ + --bind 'alt-u:execute(sudo updatedb)' --header 'M-u: UpdateDB' \ + --color=fg:bold:blue --preview-window '<50(down,75%,border-top)' + ); then + LBUFFER=$selected + fi + zle reset-prompt +} +zle -N fzf-locate-widget +bindkey '^[i' fzf-locate-widget # + diff --git a/chezmoi/dot_config/fzf/widgets/man_widget.zsh b/chezmoi/dot_config/fzf/widgets/man_widget.zsh new file mode 100644 index 0000000..4c960e2 --- /dev/null +++ b/chezmoi/dot_config/fzf/widgets/man_widget.zsh @@ -0,0 +1,21 @@ +fzf-man-widget() { + batman="man {1} | col -bx | bat --language=man --plain --color always --theme=\"Monokai Extended\"" + man -k . | sort \ + | awk -v CYN=${CYN} -v BLU=${BLU} -v RES=${RES} -v BLD=${BLD} '{ $1=CYN BLD $1; $2=RES BLU;} 1' \ + | fzf \ + -q "$LBUFFER" \ + --ansi \ + --tiebreak=begin \ + --prompt=' Man > ' \ + --header="M-u: update mandb | M-t: tl;dr | M-c: cheat.sh | M:m manual " \ + --preview-window '50%,rounded,<50(down,80%,border-up)' \ + --preview "${batman}" \ + --bind "enter:execute(man {1})" \ + --bind "alt-c:+change-preview(curl -s cht.sh/{1})+change-prompt(ﯽ Cheat > )" \ + --bind "alt-m:+change-preview(${batman})+change-prompt( Man > )" \ + --bind "alt-u:execute(sudo mandb && echo -e '\nUpdating tl;dr cache...';tldr --update)" \ + --bind "alt-t:+change-preview(tldr --color=always {1})+change-prompt(ﳁ TLDR > )" + zle reset-prompt +} +zle -N fzf-man-widget +bindkey '^[h' fzf-man-widget diff --git a/chezmoi/dot_config/git/config b/chezmoi/dot_config/git/config new file mode 100644 index 0000000..0597563 --- /dev/null +++ b/chezmoi/dot_config/git/config @@ -0,0 +1,7 @@ +[user] + name = aleidk + email = ale.navarro.parra@gmail.com +[pull] + rebase = true +[init] + defaultBranch = main diff --git a/chezmoi/dot_config/git/ignore b/chezmoi/dot_config/git/ignore new file mode 100644 index 0000000..6417329 --- /dev/null +++ b/chezmoi/dot_config/git/ignore @@ -0,0 +1,6 @@ +# Git Worktrees +.worktrees/* + +# PHP Stuff +vendor +.php-cs-fixer.cache diff --git a/chezmoi/dot_config/mise/config.toml b/chezmoi/dot_config/mise/config.toml new file mode 100644 index 0000000..5e602c1 --- /dev/null +++ b/chezmoi/dot_config/mise/config.toml @@ -0,0 +1,6 @@ +[tools] +# node = 'lts' +# python = {version='3', virtualenv='.venv'} +# python = {version='3'} # setting virtualenv adds a virtualenv in every directory +# php = "8.2" +# go = "latest" diff --git a/chezmoi/dot_config/nvim/init.lua b/chezmoi/dot_config/nvim/init.lua new file mode 100644 index 0000000..a9b3bcc --- /dev/null +++ b/chezmoi/dot_config/nvim/init.lua @@ -0,0 +1,26 @@ +-- Loadnoptions before anything +require("aleidk.options") + +-- Init PLugins + +-- Install package manager https://github.com/folke/lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Load plugins +require("lazy").setup("aleidk.plugins") + +-- Rest of configuratin + +require("aleidk.keymaps") +require("aleidk.autocmds") diff --git a/chezmoi/dot_config/nvim/lua/aleidk/autocmds.lua b/chezmoi/dot_config/nvim/lua/aleidk/autocmds.lua new file mode 100644 index 0000000..22c9fbd --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/autocmds.lua @@ -0,0 +1,10 @@ +-- Highlight on yank +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = "*", +}) diff --git a/chezmoi/dot_config/nvim/lua/aleidk/constants.lua b/chezmoi/dot_config/nvim/lua/aleidk/constants.lua new file mode 100644 index 0000000..0d9495c --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/constants.lua @@ -0,0 +1,63 @@ +return { + icons = { + misc = { + pint = " ", + }, + dap = { + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", + }, + diagnostics = { + Error = " ", + Warn = " ", + Hint = " ", + Info = " ", + }, + git = { + added = " ", + modified = " ", + removed = " ", + branch = "", + }, + kinds = { + Array = " ", + Boolean = " ", + Class = " ", + Color = " ", + Constant = " ", + Constructor = " ", + Copilot = " ", + Enum = " ", + EnumMember = " ", + Event = " ", + Field = " ", + File = " ", + Folder = " ", + Function = " ", + Interface = " ", + Key = " ", + Keyword = " ", + Method = " ", + Module = " ", + Namespace = " ", + Null = " ", + Number = " ", + Object = " ", + Operator = " ", + Package = " ", + Property = " ", + Reference = " ", + Snippet = " ", + String = " ", + Struct = " ", + Text = " ", + TypeParameter = " ", + Unit = " ", + Value = " ", + Variable = " ", + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua b/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua new file mode 100644 index 0000000..75b54d7 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua @@ -0,0 +1,68 @@ +-- [[ Basic Keymaps ]] + +function MAP(mode, l, r, desc) + vim.keymap.set(mode, l, r, { desc = desc, silent = true }) +end + +local function default(desc) + return { + silent = true, + desc = desc, + } +end + +local function fixIndentation() + local indent = 2 + vim.opt.tabstop = indent + vim.opt.shiftwidth = indent + vim.opt.softtabstop = indent + + vim.cmd("retab") +end + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ "n", "v" }, "", "", { silent = true }) + +-- vim.keymap.set("n", "", "w", default("Keep cursor centered while junping")) + +-- Remap for dealing with word wrap +vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +vim.keymap.set("n", "J", "mzJ`z", default("Keep cursor in column while joining lines")) + +vim.keymap.set("n", "|", ":vs", default("Open vsplit")) +vim.keymap.set("n", "°", ":sp", default("Open split")) + +vim.keymap.set("n", "", "zz", default("Keep cursor centered while junping")) +vim.keymap.set("n", "", "zz", default("Keep cursor centered while junping")) + +vim.keymap.set("n", "n", "nzzzv", default("Keep cursor centered while searching")) +vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching")) + +vim.keymap.set("n", "Q", "", {}) + +vim.keymap.set( + "n", + "rw", + [[:%s/\<\>//gI]], + default("Search and replace current word") +) + +-- vim.keymap.set("n", "rR", ":s/", default("Search and replace inline")) +-- vim.keymap.set("n", "rr", ":%s/", default("Search and replace globally")) +-- vim.keymap.set("v", "r", ":s/", default("Search and replace in selection")) + +vim.keymap.set("v", "p", [["_dP]], default("Paste without lossing yanked text")) + +vim.keymap.set("v", "J", ":m '>+1gv=gv", default("Move selection down")) +vim.keymap.set("v", "K", ":m '<-2gv=gv", default("Move selection up")) +vim.keymap.set("n", "uI", fixIndentation, default("Fix indentation")) + +vim.keymap.set("n", "uh", ":nohl", default("Remove search highlight")) + +vim.keymap.set("t", "", "", default("Exit insert mode on terminal")) + +vim.keymap.set("n", "bc", "bd", default("Close buffer")) +vim.keymap.set("n", "bA", "bufdo bd", default("Close all buffers")) diff --git a/chezmoi/dot_config/nvim/lua/aleidk/options.lua b/chezmoi/dot_config/nvim/lua/aleidk/options.lua new file mode 100644 index 0000000..cd81c12 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/options.lua @@ -0,0 +1,76 @@ +-- [[ Setting options ]] +-- See `:help vim.o` + +-- Set as the leader key +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +local opt = vim.opt + +-- stylua: ignore +opt.autowrite = true -- Enable auto write +opt.clipboard = "unnamedplus" -- Sync with system clipboard +opt.completeopt = "menu,menuone,noselect" +opt.conceallevel = 2 -- Hide * markup for bold and italic +opt.confirm = true -- Confirm to save changes before exiting modified buffer +opt.cursorline = true -- Enable highlighting of the current line +opt.expandtab = true -- Use spaces instead of tabs +opt.formatoptions = "jcroqlnt" -- tcqj +opt.grepformat = "%f:%l:%c:%m" +opt.grepprg = "rg --vimgrep" +opt.ignorecase = true -- Ignore case +opt.inccommand = "nosplit" -- preview incremental substitute +opt.laststatus = 0 +opt.list = true -- Show some invisible characters (tabs... +opt.mouse = "a" -- Enable mouse mode +opt.number = true -- Print line number +opt.pumblend = 10 -- Popup blend +opt.pumheight = 10 -- Maximum number of entries in a popup +opt.relativenumber = true -- Relative line numbers +opt.scrolloff = 15 -- Lines of context +opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } +opt.shiftround = true -- Round indent +opt.shiftwidth = 2 -- Size of an indent +opt.shortmess:append({ W = true, I = true, c = true }) +opt.showmode = false -- Dont show mode since we have a statusline +opt.sidescrolloff = 8 -- Columns of context +opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +opt.smartcase = true -- Don't ignore case with capitals +opt.smartindent = true -- Insert indents automatically +opt.spelllang = { "en" } +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current +opt.tabstop = 2 -- Number of spaces tabs count for +opt.termguicolors = true -- True color support +opt.timeoutlen = 300 +opt.undofile = true +opt.undolevels = 10000 +opt.updatetime = 200 -- Save swap file and trigger CursorHold +opt.wildmode = "longest,list:full" -- Command-line completion mode +opt.winminwidth = 5 -- Minimum window width +opt.wrap = false -- Disable line wrap + +vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" + +vim.filetype.add({ + -- Detect and assign filetype based on the extension of the filename + extension = { + mdx = "mdx", + log = "log", + conf = "conf", + env = "dotenv", + }, + -- Detect and apply filetypes based on the entire filename + filename = { + [".env"] = "dotenv", + ["env"] = "dotenv", + ["tsconfig.json"] = "jsonc", + }, + -- Detect and apply filetypes based on certain patterns of the filenames + pattern = { + -- INFO: Match filenames like - ".env.example", ".env.local" and so on + ["%.env%.[%w_.-]+"] = "dotenv", + [".*%.blade%.php"] = "blade", + [".*%.hurl.*"] = "hurl", + }, +}) diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/auto-pairs.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/auto-pairs.lua new file mode 100644 index 0000000..2355082 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/auto-pairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, -- this is equalent to setup({}) function +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/bookmarks.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/bookmarks.lua new file mode 100644 index 0000000..fcfd24f --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/bookmarks.lua @@ -0,0 +1,19 @@ +return { + "cbochs/grapple.nvim", + dependencies = { + { "nvim-tree/nvim-web-devicons", lazy = true }, + }, + lazy = false, + cmd = "Grapple", + keys = { + { "a", "Grapple toggle", desc = "Toggle bookmark for current file" }, + { "t", "Grapple toggle_tags", desc = "Toggle bookmarks window" }, + { "T", "Grapple toggle_scopes", desc = "Toggle scopes window" }, + { "n", "Grapple cycle forward", desc = "Next bookmark" }, + { "N", "Grapple cycle backward", desc = "Prev bookmark" }, + { "j", "Grapple select index=1", desc = "bookmark 1" }, + { "k", "Grapple select index=2", desc = "bookmark 2" }, + { "l", "Grapple select index=3", desc = "bookmark 3" }, + { "ñ", "Grapple select index=4", desc = "bookmark 4" }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/colorscheme.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/colorscheme.lua new file mode 100644 index 0000000..5f126e9 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/colorscheme.lua @@ -0,0 +1,39 @@ +return { -- Change colors.none if not using a transparent background + "catppuccin/nvim", + priority = 1000, + lazy = false, + opts = { + flavour = "macchiato", + transparent_background = true, + integrations = { + cmp = true, + notify = true, + harpoon = false, + mason = true, + neogit = true, + noice = true, + hop = true, + lsp_trouble = true, + indent_blankline = { + enabled = true, + }, + }, + custom_highlights = function(colors) + return { + -- Fix colors for cmp + Pmenu = { bg = colors.none, blend = 0 }, + FloatBorder = { bg = colors.none }, + CmpItemMenu = { fg = colors.text, bg = colors.none }, + -- dadbod-ui + NotificationInfo = { bg = colors.none, fg = colors.text }, + NotificationWarning = { bg = colors.none, fg = colors.yellow }, + NotificationError = { bg = colors.none, fg = colors.red }, + } + end, + }, + + config = function(_, opts) + require("catppuccin").setup(opts) + vim.cmd.colorscheme("catppuccin") + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/comments.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/comments.lua new file mode 100644 index 0000000..1a20d86 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/comments.lua @@ -0,0 +1,34 @@ +return { + { + "echasnovski/mini.comment", + version = "*", + event = "VeryLazy", + dependencies = { + { "nvim-treesitter/nvim-treesitter-context" }, + }, + opts = { + options = { + custom_commentstring = function() + return require("ts_context_commentstring.internal").calculate_commentstring() + or vim.bo.commentstring + end, + }, + }, + }, + { + "LudoPinelli/comment-box.nvim", + event = "VeryLazy", + config = function() + require("comment-box").setup({ + outer_blank_lines = true, + }) + + local cb = require("comment-box") + + -- left aligned fixed size box with left aligned text + MAP({ "n", "v" }, "gcb", cb.lcbox, "Create a comment box") + -- centered adapted box with centered text + MAP({ "n", "v" }, "gll", cb.cline, "Create a comment line") + end, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/completion.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/completion.lua new file mode 100644 index 0000000..a3cad37 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/completion.lua @@ -0,0 +1,94 @@ +---@diagnostic disable: missing-fields +return { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "petertriho/cmp-git", + "hrsh7th/cmp-cmdline", + "saadparwaiz1/cmp_luasnip", + "L3MON4D3/LuaSnip", + "windwp/nvim-autopairs", + }, + config = function() + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local cmp = require("cmp") + + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + + local defaults = require("cmp.config.default")() + local window_opts = { + border = "rounded", + side_padding = 1, + -- fix colors for catppuccin colorscheme + winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", + } + local opts = { + visible_docs = false, + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = function() + if cmp.visible_docs() then + cmp.close_docs() + else + cmp.open_docs() + end + end, + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + ["
"] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = false }), -- Confirm only if selected an item + [""] = cmp.mapping.confirm({ + -- Auto confirms first item + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }), + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(_, item) + local icons = require("aleidk.constants").icons.kinds + if icons[item.kind] then + item.kind = icons[item.kind] .. item.kind + end + return item + end, + }, + window = { + completion = cmp.config.window.bordered(window_opts), + documentation = cmp.config.window.bordered(window_opts), + }, + experimental = { + ghost_text = { + hl_group = "CmpGhostText", + }, + }, + sorting = defaults.sorting, + } + + cmp.setup(opts) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/dashboard.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/dashboard.lua new file mode 100644 index 0000000..db755d4 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/dashboard.lua @@ -0,0 +1,35 @@ +return { + "goolord/alpha-nvim", + lazy = false, + opts = function() + local dashboard = require("alpha.themes.dashboard") + + dashboard.section.header.val = { + " ████ ███ █████ █████ ", + " ░░███ ░░░ ░░███ ░░███ ", + " ██████ ░███ ██████ ████ ███████ ░███ █████", + " ░░░░░███ ░███ ███░░███░░███ ███░░███ ░███░░███ ", + " ███████ ░███ ░███████ ░███ ░███ ░███ ░██████░ ", + " ███░░███ ░███ ░███░░░ ░███ ░███ ░███ ░███░░███ ", + "░░████████ █████░░██████ █████░░████████ ████ █████", + " ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ", + } + dashboard.section.header.opts.hl = "DashboardHeader" + + dashboard.section.buttons.val = { + dashboard.button("LDR f f", " Find File ", "ff"), + dashboard.button("LDR LDR t", " Bookmars", "t"), + dashboard.button("LDR g g", " Git ", "gg"), + } + + dashboard.section.footer.val = + { " ", " ", " ", "Nvim loaded " .. require("lazy").stats().count .. " plugins " } + dashboard.section.footer.opts.hl = "DashboardFooter" + + dashboard.config.layout[1].val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) + dashboard.config.layout[3].val = 5 + dashboard.config.opts.noautocmd = true + + return dashboard.opts + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/database.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/database.lua new file mode 100644 index 0000000..941e717 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/database.lua @@ -0,0 +1,44 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + { "tpope/vim-dadbod", lazy = true }, + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + }, + cmd = { + "DBUI", + "DBUIToggle", + "DBUIAddConnection", + "DBUIFindBuffer", + }, + keys = { + { "ud", "DBUIToggle", desc = "Toggle DB UI" }, + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.db_ui_force_echo_notifications = 1 + + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + command = [[setlocal omnifunc=vim_dadbod_completion#omni]], + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + callback = function() + ---@diagnostic disable-next-line: missing-fields + require("cmp").setup.buffer({ + sources = { { name = "vim-dadbod-completion" }, { name = "buffer" } }, + }) + end, + }) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/dressing.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/dressing.lua new file mode 100644 index 0000000..9d2a5e4 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/dressing.lua @@ -0,0 +1,10 @@ +return { + -- better imputs + "stevearc/dressing.nvim", + opts = { + input = { + -- handle by noice + enabled = false, + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/file-explorer.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/file-explorer.lua new file mode 100644 index 0000000..2fe15eb --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/file-explorer.lua @@ -0,0 +1,66 @@ +return { + "rolv-apneseth/tfm.nvim", + lazy = false, + opts = { + -- TFM to use + -- Possible choices: "ranger" | "nnn" | "lf" | "vifm" | "yazi" (default) + file_manager = "yazi", + -- Replace netrw entirely + -- Default: false + replace_netrw = true, + -- Enable creation of commands + -- Default: false + -- Commands: + -- Tfm: selected file(s) will be opened in the current window + -- TfmSplit: selected file(s) will be opened in a horizontal split + -- TfmVsplit: selected file(s) will be opened in a vertical split + -- TfmTabedit: selected file(s) will be opened in a new tab page + enable_cmds = true, + -- Custom keybindings only applied within the TFM buffer + -- Default: {} + keybindings = { + [""] = "q", + }, + -- Customise UI. The below options are the default + ui = { + border = "rounded", + height = 1, + width = 1, + x = 0.5, + y = 0.5, + }, + }, + keys = { + { + "e", + function() + require("tfm").open() + end, + desc = "TFM", + }, + { + "mh", + function() + local tfm = require("tfm") + tfm.open(nil, tfm.OPEN_MODE.split) + end, + desc = "TFM - horizontal split", + }, + { + "mv", + function() + local tfm = require("tfm") + tfm.open(nil, tfm.OPEN_MODE.vsplit) + end, + desc = "TFM - vertical split", + }, + { + "mt", + function() + local tfm = require("tfm") + tfm.open(nil, tfm.OPEN_MODE.tabedit) + end, + desc = "TFM - new tab", + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/flash.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/flash.lua new file mode 100644 index 0000000..faf9fa5 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/flash.lua @@ -0,0 +1,25 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = { + label = { + rainbow = { + enabled = true, + }, + }, + modes = { + search = { + enabled = false, -- actibable with require("flash").toggle(), + }, + }, + }, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/formatter.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/formatter.lua new file mode 100644 index 0000000..8a60e17 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/formatter.lua @@ -0,0 +1,56 @@ +return { + "stevearc/conform.nvim", + event = "VeryLazy", + opts = { + -- See aviable formatters in: https://github.com/stevearc/conform.nvim#formatters + -- Formatters can be installed by mason + formatters_by_ft = { + -- Conform will run multiple formatters sequentially + -- Use a sub-list to run only the first available formatter + -- Use the "_" filetype to run formatters on filetypes that don't + -- have other formatters configured. + ["_"] = { "trim_whitespace" }, + blade = { "blade-formatter" }, + css = { { "prettierd", "prettier" } }, + html = { "prettierd" }, + javascript = { { "prettierd", "prettier" } }, + javascriptreact = { { "prettierd", "prettier" } }, + json = { { "prettierd", "prettier" } }, + jsonc = { { "prettierd", "prettier" } }, + lua = { "stylua" }, + markdown = { "markdownlint" }, + nim = { "nimpretty" }, + php = { "pint" }, + python = { "blue" }, + scss = { { "prettierd", "prettier" } }, + sh = { "shfmt" }, + typescript = { { "prettierd", "prettier" } }, + typescriptreact = { { "prettierd", "prettier" } }, + zsh = { "shfmt" }, + go = { { "gofumpt", "goimports_reviser", "golines" } }, + xml = { "lemminx" } + }, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 2000, lsp_fallback = true } + end, + }, + config = function(_, opts) + require("conform").setup(opts) + + local function toggleAutoFormat() + -- to make this global, change b to g + if vim.b.disable_autoformat == nil then + vim.b.disable_autoformat = true + return + end + + vim.b.disable_autoformat = not vim.b.disable_autoformat + end + + MAP("n", "uf", toggleAutoFormat, "Toggle auto format") + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/git.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/git.lua new file mode 100644 index 0000000..e7d43be --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/git.lua @@ -0,0 +1,87 @@ +return { + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc) + vim.keymap.set(mode, "g" .. l, r, { buffer = buffer, desc = desc }) + end + + -- stylua: ignore start + map("n", "j", gs.next_hunk, "Next Hunk") + map("n", "k", gs.prev_hunk, "Prev Hunk") + map({ "n", "v" }, "s", ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "v" }, "r", ":Gitsigns reset_hunk", "Reset Hunk") + map("n", "u", gs.undo_stage_hunk, "Undo Stage Hunk") + map("n", "R", gs.reset_buffer, "Reset Buffer") + map("n", "", gs.preview_hunk, "Preview Hunk") + map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line") + map("n", "d", gs.diffthis, "Diff This") + end, + }, + }, + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "nvim-telescope/telescope.nvim", -- optional + "sindrets/diffview.nvim", -- optional + }, + config = true, + opts = { + disable_line_numbers = false, + console_timeout = 8000, + graph_style = "unicode", + kind = "tab", + ignored_settings = { + "NeogitPushPopup--force", + "NeogitPullPopup--rebase", + "NeogitCommitPopup--allow-empty", + "NeogitCommitPopup--reuse-message", + "NeogitRevertPopup--no-edit", + }, + }, + keys = { + { + "gg", + function() + require("neogit").open() + end, + desc = "Neogit", + }, + { + "gc", + function() + require("neogit").open({ "commit" }) + end, + desc = "Commit", + }, + { + "gp", + function() + require("neogit").open({ "pull" }) + end, + desc = "Pull", + }, + { + "gP", + function() + require("neogit").open({ "push" }) + end, + desc = "Push", + }, + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/indent-blankline.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/indent-blankline.lua new file mode 100644 index 0000000..95b4c4f --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/indent-blankline.lua @@ -0,0 +1,30 @@ +return { + -- Add indentation guides even on blank lines + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPost", "BufNewFile" }, + main = "ibl", + opts = { + -- char = "▏", + indent = { + char = "│", + tab_char = "│", + }, + scope = { + enabled = true, + }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/init.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/init.lua new file mode 100644 index 0000000..fcac693 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/init.lua @@ -0,0 +1,69 @@ +return { + -- Detect tabstop and shiftwidth automatically + "tpope/vim-sleuth", + { "nvim-tree/nvim-web-devicons", lazy = true }, + { + "mbbill/undotree", + config = function() + vim.g.undotree_WindowLayout = 2 + vim.g.undotree_ShortIndicators = 1 + vim.g.undotree_SetFocusWhenToggle = 1 + end, + keys = { + { "fu", vim.cmd.UndotreeToggle, desc = "Undo tree" }, + }, + }, + { + -- Highlight word under cursor + "RRethy/vim-illuminate", + event = { "BufReadPost", "BufNewFile" }, + opts = { delay = 200 }, + config = function(_, opts) + require("illuminate").configure(opts) + end, + }, + { + -- Color Picker + "uga-rosa/ccc.nvim", + event = "VeryLazy", + opts = { + auto_enable = true, + lsp = true, + }, + }, + -- Dotfiles management + { + "xvzc/chezmoi.nvim", + dependencies = { "nvim-lua/plenary.nvim", "alker0/chezmoi.vim" }, + config = function() + require("chezmoi").setup({ + { + edit = { + watch = false, + force = false, + }, + notification = { + on_open = true, + on_apply = true, + on_watch = false, + }, + telescope = { + select = { "" }, + }, + }, + }) + + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + -- INFO: this should be the same as $(chezmoi source-path) + pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/chezmoi/*" }, + callback = function() + vim.schedule(require("chezmoi.commands.__edit").watch) + end, + }) + local telescope = require("telescope") + + telescope.load_extension("chezmoi") + vim.keymap.set("n", "fz", telescope.extensions.chezmoi.find_files, { desc = "Find dotfile" }) + end, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/key-help.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/key-help.lua new file mode 100644 index 0000000..6f6cc24 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/key-help.lua @@ -0,0 +1,75 @@ +return { + "echasnovski/mini.clue", + version = "*", + event = "VeryLazy", + config = function() + local miniclue = require("mini.clue") + miniclue.setup({ + triggers = { + -- Leader triggers + { mode = "n", keys = "" }, + { mode = "x", keys = "" }, + + -- Built-in completion + { mode = "i", keys = "" }, + + -- `g` key + { mode = "n", keys = "g" }, + { mode = "x", keys = "g" }, + + -- Marks + { mode = "n", keys = "'" }, + { mode = "n", keys = "`" }, + { mode = "x", keys = "'" }, + { mode = "x", keys = "`" }, + + -- Registers + { mode = "n", keys = '"' }, + { mode = "x", keys = '"' }, + { mode = "i", keys = "" }, + { mode = "c", keys = "" }, + + -- Window commands + { mode = "n", keys = "" }, + + -- `z` key + { mode = "n", keys = "z" }, + { mode = "x", keys = "z" }, + }, + + -- Add a "postkeys" value to activate those keys after others + clues = { + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + + { mode = "n", keys = "", desc = "+Bookmarks" }, + { mode = "n", keys = "n", postkeys = "" }, + { mode = "n", keys = "N", postkeys = "" }, + { mode = "n", keys = "b", desc = "+Buffers" }, + { mode = "n", keys = "f", desc = "+Find" }, + { mode = "n", keys = "g", desc = "+Git" }, + { mode = "n", keys = "l", desc = "+LSP" }, + { mode = "n", keys = "r", desc = "+Replace" }, + { mode = "n", keys = "u", desc = "+UI & Config" }, + { mode = "n", keys = "un", desc = "+Noice" }, + }, + + -- Clue window settings + window = { + -- Floating window config + config = { + width = "auto", + }, + -- Delay before showing clue window + delay = 200, + -- Keys to scroll inside the clue window + scroll_down = "", + scroll_up = "", + }, + }) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/linters.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/linters.lua new file mode 100644 index 0000000..ede5ade --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/linters.lua @@ -0,0 +1,29 @@ +return { + "mfussenegger/nvim-lint", + event = "VeryLazy", + config = function() + local lint = require("lint") + + lint.linters.gitlint.stdin = true + lint.linters.gitlint.args = { "--contrib", "contrib-title-conventional-commits", "--msg-filename", "-" } + + lint.linters_by_ft = { + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + -- astro = { "eslint_d" }, + python = { "pylint" }, + sh = { "shellcheck" }, + NeogitCommitMessage = { "gitlint" }, + gitcommit = { "gitlint" }, + markdown = { "markdownlint" }, + } + + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + require("lint").try_lint() + end, + }) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/lsp.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/lsp.lua new file mode 100644 index 0000000..6b0d8f9 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/lsp.lua @@ -0,0 +1,183 @@ +return { + -- LSP Configuration & Plugins + "neovim/nvim-lspconfig", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + dependencies = { + -- Automatically install LSPs to stdpath for neovim + { "williamboman/mason.nvim" }, + "williamboman/mason-lspconfig.nvim", + -- Additional lua configuration, makes nvim stuff amazing! + { "folke/neodev.nvim", opts = {} }, + }, + + config = function() + -- LSP settings. + local on_attach = function(_, bufnr) + local nmap = function(keys, func, desc) + if desc then + desc = "LSP: " .. desc + end + + vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc }) + end + + nmap("lr", vim.lsp.buf.rename, "Rename") + -- stylua: ignore + vim.keymap.set({ "n", "x", "v" }, "la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" }) + nmap("ld", vim.lsp.buf.type_definition, "Go to type definition") + nmap("lf", function() + vim.lsp.buf.format() + end, "Format") + + nmap("gd", vim.lsp.buf.definition, "Go to definition") + nmap("gr", require("telescope.builtin").lsp_references, "Goto References") + nmap("gI", vim.lsp.buf.implementation, "Go to Implementation") + + -- See `:help K` for why this keymap + nmap("K", vim.lsp.buf.hover, "Hover Documentation") + -- nmap("", vim.lsp.buf.signature_help, "Signature Documentation") + + -- Lesser used LSP functionality + nmap("gD", vim.lsp.buf.declaration, "Goto Declaration") + + nmap("lj", vim.diagnostic.goto_next, "Go to next diagnostic") + nmap("lk", vim.diagnostic.goto_prev, "Go to prev diagnostic") + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "Format current buffer with LSP" }) + end + + -- Enable the following language servers + -- To see options and cofigurations: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md + local servers = { + astro = {}, + bashls = {}, + cssls = {}, + dockerls = {}, + emmet_ls = {}, + html = {}, + marksman = {}, + pyright = {}, + phpactor = {}, + gopls = { + settings = { + gopls = { + completeUnimported = true, + usePlaceholders = true, + analyses = { + unusedparams = true, + }, + }, + }, + }, + rust_analyzer = { + settings = { + ["rust-analyzer"] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true, + }, + }, + }, + }, + sqlls = {}, + yamlls = {}, + tsserver = { + init_options = { + preferences = { + disableSuggestions = true, + }, + }, + }, + lua_ls = { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + }, + }, + }, + }, + }, + } + + -- nvim-cmp supports additional completion capabilities, so broadcast that to servers + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + + -- Ensure the servers above are installed + local mason_lspconfig = require("mason-lspconfig") + + mason_lspconfig.setup({ + ensure_installed = vim.tbl_keys(servers), + }) + + mason_lspconfig.setup_handlers({ + function(server_name) + local _border = "single" + + local default_config = { + capabilities = capabilities, + on_attach = on_attach, + handlers = { + ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = _border, + }), + ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = _border, + }), + }, + } + + require("lspconfig")[server_name].setup( + vim.tbl_deep_extend("force", default_config, servers[server_name] or {}) + ) + end, + }) + + vim.diagnostic.config({ + underline = true, + update_in_insert = false, + virtual_text = false, + -- virtual_text = { + -- spacing = 1, + -- source = "if_many", + -- prefix = " ●", + -- suffix = " ", + -- -- this will set set the prefix to a function that returns the diagnostics icon based on the severity + -- -- this only works on a recent 0.10.0 build. Will be set to "●" when not supported + -- -- prefix = "icons", + -- }, + severity_sort = true, + }) + + -- Customize gutter icons + local signs = require("aleidk.constants").icons.diagnostics + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/lualine.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/lualine.lua new file mode 100644 index 0000000..e12fff4 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/lualine.lua @@ -0,0 +1,164 @@ +return { + "nvim-lualine/lualine.nvim", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + "cbochs/grapple.nvim", + }, + opts = function() + local icons = require("aleidk.constants").icons + + local function diff_source() + local gitsigns = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitsigns.added, + modified = gitsigns.changed, + removed = gitsigns.removed, + } + end + end + + local function position_scrollbar(str) + local sbar = { "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } + + local curr_line = vim.api.nvim_win_get_cursor(0)[1] + local lines = vim.api.nvim_buf_line_count(0) + local i = math.floor((curr_line - 1) / lines * #sbar) + 1 + return str .. " " .. sbar[i] + end + + return { + options = { + theme = "auto", + globalstatus = true, + disabled_filetypes = { statusline = { "dashboard", "alpha" } }, + component_separators = "", + section_separators = "", + }, + sections = { + lualine_a = { + { + "mode", + padding = 0, + fmt = function() + return " " + end, + }, + }, + lualine_b = {}, + lualine_c = { + { "branch", icon = icons.git.branch }, + { + "overseer", + }, + { + -- Macro recording status + function() + return require("noice").api.status.mode.get() + end, + cond = function() + return package.loaded["noice"] and require("noice").api.status.mode.has() + end, + }, + }, + lualine_x = { + { + function() + return require("grapple").statusline() + end, + }, + }, + lualine_y = { + { "searchcount" }, + { "location" }, + { + "progress", + fmt = position_scrollbar, + separator = " ", + padding = 0, + }, + }, + lualine_z = {}, + }, + winbar = { + lualine_b = { + { + "filename", + path = 1, + symbols = { + modified = " ●", -- Text to show when the buffer is modified + alternate_file = "#", -- Text to show to identify the alternate file + directory = "", -- Text to show when the buffer is a directory + }, + }, + }, + lualine_y = { + { + "diff", + symbols = { + added = icons.git.added, + modified = icons.git.modified, + removed = icons.git.removed, + }, + source = diff_source, + }, + { + "diagnostics", + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warn, + info = icons.diagnostics.Info, + hint = icons.diagnostics.Hint, + }, + }, + }, + }, + inactive_winbar = { + lualine_b = { + { + "filename", + path = 1, + symbols = { + modified = " ●", -- Text to show when the buffer is modified + alternate_file = "#", -- Text to show to identify the alternate file + directory = "", -- Text to show when the buffer is a directory + }, + }, + }, + lualine_y = { + { + "diff", + symbols = { + added = icons.git.added, + modified = icons.git.modified, + removed = icons.git.removed, + }, + source = diff_source, + }, + { + "diagnostics", + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warn, + info = icons.diagnostics.Info, + hint = icons.diagnostics.Hint, + }, + }, + }, + }, + extensions = { + "neo-tree", + "lazy", + "fugitive", + "fzf", + "man", + "mason", + "nvim-tree", + "quickfix", + "symbols-outline", + "trouble", + }, + } + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/luasnip.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/luasnip.lua new file mode 100644 index 0000000..5f4e132 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/luasnip.lua @@ -0,0 +1,27 @@ +return { + "L3MON4D3/LuaSnip", + dependencies = { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + opts = { + history = true, + delete_check_events = "TextChanged", + }, + -- stylua: ignore + keys = { + { + "", + function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, + expr = true, + silent = true, + mode = "i", + }, + { "", function() require("luasnip").jump(1) end, mode = "s" }, + { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/markdown.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/markdown.lua new file mode 100644 index 0000000..581a25a --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/markdown.lua @@ -0,0 +1,14 @@ +return { + { + "MeanderingProgrammer/markdown.nvim", + name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons + opts = { + sign = { + enabled = false, + }, + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/mason.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/mason.lua new file mode 100644 index 0000000..12cef01 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/mason.lua @@ -0,0 +1,22 @@ +return { + "williamboman/mason.nvim", + cmd = "Mason", + keys = { { "cm", "Mason", desc = "Mason" } }, + build = ":MasonUpdate", + opts = { + ensure_installed = { + "blue", + "pylint", + "eslint_d", + "markdownlint", + "nimlsp", + "prettierd", + "shellcheck", + "stylua", + "gofumpt", + "golines", + "goimports-reviser", + "gopls" + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/noice.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/noice.lua new file mode 100644 index 0000000..281d632 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/noice.lua @@ -0,0 +1,123 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + }, + opts = { + presets = { + bottom_search = true, + -- command_palette = true, + long_message_to_split = true, + inc_rename = true, + }, + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + routes = { + { + filter = { + event = "msg_show", + any = { + { find = "%d+L, %d+B" }, + { find = "; after #%d+" }, + { find = "; before #%d+" }, + }, + }, + view = "mini", + }, + { + filter = { + event = "msg_show", + kind = "search_count", + }, + opts = { skip = true }, + }, + }, + views = { + cmdline_popup = { + position = { + row = 5, + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + popupmenu = { + relative = "editor", + position = { + row = 8, + col = "50%", + }, + size = { + width = 60, + height = 10, + }, + border = { + style = "rounded", + padding = { 0, 1 }, + }, + win_options = { + winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" }, + }, + }, + notify = { + enabled = false, + }, + messages = { + enabled = false, + }, + }, + }, + -- stylua: ignore + keys = { + { + "", + function() require("noice").redirect(vim.fn.getcmdline()) end, + mode = "c", + desc = + "Redirect Cmdline" + }, + { + "unl", + function() require("noice").cmd("last") end, + desc = + "Noice Last Message" + }, + { + "unh", + function() require("noice").cmd("history") end, + desc = + "Noice History" + }, + { "una", function() require("noice").cmd("all") end, desc = "Noice All" }, + { "und", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, + { + "", + function() if not require("noice.lsp").scroll(4) then return "" end end, + silent = true, + expr = true, + desc = + "Scroll forward", + mode = { + "i", "n", "s" } + }, + { + "", + function() if not require("noice.lsp").scroll(-4) then return "" end end, + silent = true, + expr = true, + desc = + "Scroll backward", + mode = { + "i", "n", "s" } + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/pretty-fold.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/pretty-fold.lua new file mode 100644 index 0000000..d87ab95 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/pretty-fold.lua @@ -0,0 +1,42 @@ +return { + "anuvyklack/pretty-fold.nvim", + opts = { + sections = { + left = { + "+", + function() + return string.rep("-", vim.v.foldlevel) + end, + " ", + "content", + " ", + "number_of_folded_lines", + " ", + function() + return string.rep("-", vim.v.foldlevel) + end, + "+", + }, + }, + fill_char = " ", + + -- Possible values: + -- "delete" : Delete all comment signs from the fold string. + -- "spaces" : Replace all comment signs with equal number of spaces. + -- false : Do nothing with comment signs. + process_comment_signs = "delete", + + -- List of patterns that will be removed from content foldtext section. + stop_words = { + "@brief%s*", -- (for C++) Remove '@brief' and all spaces after. + }, + + matchup_patterns = { + { "{", "}" }, + { "%(", ")" }, -- % to escape lua pattern char + { "%[", "]" }, -- % to escape lua pattern char + }, + + ft_ignore = { "neorg" }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/quickfix.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/quickfix.lua new file mode 100644 index 0000000..7ce267a --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/quickfix.lua @@ -0,0 +1,89 @@ +return { + { + "kevinhwang91/nvim-bqf", + event = "VeryLazy", + dependencies = {}, + config = function() + local fn = vim.fn + + function _G.qftf(info) + local items + local ret = {} + -- The name of item in list is based on the directory of quickfix window. + -- Change the directory for quickfix window make the name of item shorter. + -- It's a good opportunity to change current directory in quickfixtextfunc :) + -- + -- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window + -- local root = getRootByAlterBufnr(alterBufnr) + -- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root))) + -- + if info.quickfix == 1 then + items = fn.getqflist({ id = info.id, items = 0 }).items + else + items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items + end + local limit = 31 + local fnameFmt1, fnameFmt2 = "%-" .. limit .. "s", "…%." .. (limit - 1) .. "s" + local validFmt = "%s │%5d:%-3d│%s %s" + for i = info.start_idx, info.end_idx do + local e = items[i] + local fname = "" + local str + if e.valid == 1 then + if e.bufnr > 0 then + fname = fn.bufname(e.bufnr) + if fname == "" then + fname = "[No Name]" + else + fname = fname:gsub("^" .. vim.env.HOME, "~") + end + -- char in fname may occur more than 1 width, ignore this issue in order to keep performance + if #fname <= limit then + fname = fnameFmt1:format(fname) + else + fname = fnameFmt2:format(fname:sub(1 - limit)) + end + end + local lnum = e.lnum > 99999 and -1 or e.lnum + local col = e.col > 999 and -1 or e.col + local qtype = e.type == "" and "" or " " .. e.type:sub(1, 1):upper() + str = validFmt:format(fname, lnum, col, qtype, e.text) + else + str = e.text + end + table.insert(ret, str) + end + return ret + end + + vim.o.qftf = "{info -> v:lua._G.qftf(info)}" + + -- Adapt fzf's delimiter in nvim-bqf + require("bqf").setup({ + filter = { + fzf = { + extra_opts = { "--bind", "ctrl-o:toggle-all", "--delimiter", "│" }, + }, + }, + }) + + local toggle_qf = function() + local qf_open = false + for _, win in pairs(vim.fn.getwininfo()) do + if win["quickfix"] == 1 then + qf_open = true + end + end + if qf_open == true then + vim.cmd("cclose") + return + end + if not vim.tbl_isempty(vim.fn.getqflist()) then + vim.cmd("copen") + end + end + + MAP("n", "fQ", toggle_qf, "Toggle quickfix") + end, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/sessions.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/sessions.lua new file mode 100644 index 0000000..9878d89 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/sessions.lua @@ -0,0 +1,15 @@ +return { + -- sessions + "rmagatti/auto-session", + config = function() + ---@diagnostic disable-next-line: missing-fields + require("auto-session").setup({ + log_level = "error", + auto_session_suppress_dirs = { "~/", "~/Downloads", "/", "~/.config/**", "~/.local/share/chezmoi/" }, + bypass_session_save_file_types = { + "NeogitStatus", + "Lazy", + }, + }) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/smart-splits.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/smart-splits.lua new file mode 100644 index 0000000..c58890c --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/smart-splits.lua @@ -0,0 +1,65 @@ +-- Move to windows with Ctrl and hjkl +-- Resize to windows with Alt and hjkl +-- Tmux aware +return { + "mrjones2014/smart-splits.nvim", + opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } }, + keys = { + { + "", + function() + require("smart-splits").move_cursor_left() + end, + desc = "Move to left window", + }, + { + "", + function() + require("smart-splits").move_cursor_down() + end, + desc = "Move to bottom window", + }, + { + "", + function() + require("smart-splits").move_cursor_up() + end, + desc = "Move to upper window", + }, + { + "", + function() + require("smart-splits").move_cursor_right() + end, + desc = "Move to right window", + }, + { + "", + function() + require("smart-splits").resize_left() + end, + desc = "Move to left window", + }, + { + "", + function() + require("smart-splits").resize_down() + end, + desc = "Move to bottom window", + }, + { + "", + function() + require("smart-splits").resize_up() + end, + desc = "Move to upper window", + }, + { + "", + function() + require("smart-splits").resize_right() + end, + desc = "Move to right window", + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua new file mode 100644 index 0000000..2cbb1d3 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua @@ -0,0 +1,6 @@ +return { + "echasnovski/mini.surround", + disabled = true, + version = "*", + opts = {}, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/telescope.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/telescope.lua new file mode 100644 index 0000000..f6bb853 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/telescope.lua @@ -0,0 +1,90 @@ +-- Fuzzy Finder (files, lsp, etc) +return { + "nvim-telescope/telescope.nvim", + version = "*", + event = "VeryLazy", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { + -- Blazingly Fast Fuzzy Finder Algorithm for Telescope + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + cond = function() + return vim.fn.executable("make") == 1 + end, + }, + }, + config = function() + local actions = require("telescope.actions") + local telescope = require("telescope") + local builtin = require("telescope.builtin") + + local opts = { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + layout_strategy = "vertical", + layout_config = { vertical = { height = 0.99, mirror = true, prompt_position = "top" } }, + mappings = { + i = { + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.file_vsplit, + [""] = actions.file_split, + [""] = actions.close, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = function(...) + return require("trouble.providers.telescope").open_with_trouble(...) + end, + [""] = function(...) + return require("trouble.providers.telescope").open_selected_with_trouble(...) + end, + }, + }, + }, + } + telescope.setup(opts) + + -- Enable telescope fzf native, if installed + pcall(telescope.load_extension, "fzf") + + -- Find files + vim.keymap.set( + "n", + "fe", + ":Telescope file_browser path=%:p:h select_buffer=true", + { desc = "File Explorer" } + ) + vim.keymap.set("n", "fb", builtin.buffers, { desc = "Find buffers" }) + vim.keymap.set("n", "ff", builtin.find_files, { desc = "Find files" }) + vim.keymap.set("n", "fF", function() + builtin.find_files({ hidden = true, no_ignore = true }) + end, { desc = "Find all files" }) + + -- Search inside files + vim.keymap.set("n", "fw", builtin.grep_string, { desc = "Find word under cursor" }) + vim.keymap.set("n", "fW", builtin.live_grep, { desc = "Find word (live grep)" }) + + -- Help + vim.keymap.set("n", "fc", builtin.command_history, { desc = "Find in commands history" }) + vim.keymap.set("n", "fC", builtin.commands, { desc = "Find a command" }) + vim.keymap.set("n", "fh", builtin.help_tags, { desc = "Find Help" }) + vim.keymap.set("n", "fk", builtin.keymaps, { desc = "Find Keymaps" }) + + -- Git + vim.keymap.set("n", "gb", builtin.git_branches, { desc = "Change branch" }) + + -- Diagnosticos + -- Disabled, handle by trouble + -- vim.keymap.set("n", "fD", function() + -- builtin.diagnostics({ bufnr = 0 }) + -- end, { desc = "Find diagnostics (Telescope)" }) + -- vim.keymap.set("n", "fD", function() + -- builtin.diagnostics({ bufnr = nil }) + -- end, { desc = "Find diagnostics in workspace (Telescope)" }) + -- vim.keymap.set("n", "fz", builtin.spell_suggest, { desc = "Find spell suggestion" }) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/todo-comments.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/todo-comments.lua new file mode 100644 index 0000000..33f2372 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/todo-comments.lua @@ -0,0 +1,13 @@ +return { + "folke/todo-comments.nvim", + cmd = { "TodoTrouble", "TodoTelescope" }, + event = { "BufReadPost", "BufNewFile" }, + config = true, + -- stylua: ignore + keys = { + { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, + { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, + { "ft", "TodoTrouble", desc = "Find todos (Trouble)" }, + { "fT", "TodoTelescope", desc = "Find todos (Telescope)" }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/treesitter.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/treesitter.lua new file mode 100644 index 0000000..3763759 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/treesitter.lua @@ -0,0 +1,98 @@ +return { + -- Highlight, edit, and navigate code + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" }, + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + "windwp/nvim-ts-autotag", + "JoosepAlviste/nvim-ts-context-commentstring", + "nvim-treesitter/nvim-treesitter-context", + }, + build = ":TSUpdate", + config = function() + ---@diagnostic disable-next-line: missing-fields + require("nvim-treesitter.configs").setup({ + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { + "bash", + "c", + "cpp", + "go", + "lua", + "markdown", + "markdown_inline", + "python", + "regex", + "rust", + "sql", + "tsx", + "javascript", + "typescript", + "vim", + "vimdoc", + }, + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { + enable = true, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + }, + autotag = { enable = true }, + }) + + require('ts_context_commentstring').setup { + enable_autocmd = false, + } + + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + + -- Uncoment this line to disable auto folding on file open + vim.cmd("set nofoldenable") + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/trouble.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/trouble.lua new file mode 100644 index 0000000..86b58a9 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/trouble.lua @@ -0,0 +1,24 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + cmd = { "TroubleToggle", "Trouble" }, + keys = { + { "fq", "TroubleToggle", desc = "Toggle trouble" }, + { "fd", "TroubleToggle workspace_diagnostics", desc = "Find diagnostics" }, + { + "fD", + "TroubleToggle document_diagnostics", + desc = "Find diagnostics in workspace", + }, + }, + config = function() + require("trouble").setup({ + mode = "document_diagnostics", + action_keys = { + open_split = "s", + open_vsplit = "v", + open_tab = "t", + }, + }) + end, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/ts-node-action.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/ts-node-action.lua new file mode 100644 index 0000000..1dc970d --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/ts-node-action.lua @@ -0,0 +1,23 @@ +return { + { + "ckolkey/ts-node-action", + dependencies = { "nvim-treesitter" }, + event = "VeryLazy", + config = function() + require("ts-node-action").setup({}) + + vim.keymap.set({ "n" }, "lA", require("ts-node-action").node_action, { desc = "Node Action" }) + end, + }, + { + "Wansmer/treesj", + cmd = { "TSJToggle" }, + keys = { + { "lm", "TSJToggle", desc = "Toggle treesitter join" }, + }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + opts = { + use_default_keymaps = true, + }, + }, +} diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/zen.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/zen.lua new file mode 100644 index 0000000..14374e5 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/zen.lua @@ -0,0 +1,81 @@ +return { + "folke/zen-mode.nvim", + dependencies = { + { + "folke/twilight.nvim", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + }, + }, + keys = { + { + "uz", + function() + require("zen-mode").toggle({}) + end, + desc = "Toggle zen mode", + }, + }, + opts = { + window = { + backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal + -- height and width can be: + -- * an absolute number of cells when > 1 + -- * a percentage of the width / height of the editor when <= 1 + -- * a function that returns the width or the height + width = 0.8, -- width of the Zen window + height = 1, -- height of the Zen window + -- by default, no options are changed for the Zen window + -- uncomment any of the options below, or add other vim.wo options you want to apply + options = { + -- signcolumn = "no", -- disable signcolumn + -- number = false, -- disable number column + -- relativenumber = false, -- disable relative numbers + cursorline = false, -- disable cursorline + -- cursorcolumn = false, -- disable cursor column + -- foldcolumn = "0", -- disable fold column + list = false, -- disable whitespace characters + }, + }, + plugins = { + -- disable some global vim options (vim.o...) + -- comment the lines to not apply the options + options = { + enabled = true, + ruler = true, -- disables the ruler text in the cmd line area + showcmd = false, -- disables the command in the last line of the screen + -- you may turn on/off statusline in zen mode by setting 'laststatus' + -- statusline will be shown only if 'laststatus' == 3 + laststatus = 0, -- turn off the statusline in zen mode + }, + twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + gitsigns = { enabled = false }, -- disables git signs + tmux = { enabled = true }, -- disables the tmux statusline + -- this will change the font size on kitty when in zen mode + -- to make this work, you need to set the following kitty options: + -- - allow_remote_control socket-only + -- - listen_on unix:/tmp/kitty + kitty = { + enabled = true, + font = "+8", -- font size increment + }, + -- this will change the font size on alacritty when in zen mode + -- requires Alacritty Version 0.10.0 or higher + -- uses `alacritty msg` subcommand to change font size + alacritty = { + enabled = true, + font = "14", -- font size + }, + -- this will change the font size on wezterm when in zen mode + -- See else also the Plugins/Wezterm section in this projects README + wezterm = { + enabled = true, + -- can be either an absolute font size or the number of incremental steps + font = "+4", -- (10% increase per step) + }, + }, + }, +} diff --git a/chezmoi/dot_config/nvim/original_lazy-lock.json b/chezmoi/dot_config/nvim/original_lazy-lock.json new file mode 100644 index 0000000..311847d --- /dev/null +++ b/chezmoi/dot_config/nvim/original_lazy-lock.json @@ -0,0 +1,2 @@ +{} + diff --git a/chezmoi/dot_config/nvim/symlink_lazy-lock.json.tmpl b/chezmoi/dot_config/nvim/symlink_lazy-lock.json.tmpl new file mode 100644 index 0000000..efac3ee --- /dev/null +++ b/chezmoi/dot_config/nvim/symlink_lazy-lock.json.tmpl @@ -0,0 +1,2 @@ +{{ .chezmoi.sourceDir }}/dot_config/nvim/original_lazy-lock.json + diff --git a/chezmoi/dot_config/sesh/sesh.toml b/chezmoi/dot_config/sesh/sesh.toml new file mode 100644 index 0000000..23c1186 --- /dev/null +++ b/chezmoi/dot_config/sesh/sesh.toml @@ -0,0 +1,14 @@ +[[session]] +name = "Downloads" +path = "~/Downloads" +startup_command = "ls" + +[[session]] +name = "Dotfiles" +path = "~/.local/share/chezmoi/" +startup_command = "nvim -c ':Telescope find_files'" + +[[session]] +name = "SSH" +path = "~/.ssh/" +startup_command = "nvim config" diff --git a/chezmoi/dot_config/starship.toml b/chezmoi/dot_config/starship.toml new file mode 100644 index 0000000..b6412b4 --- /dev/null +++ b/chezmoi/dot_config/starship.toml @@ -0,0 +1,234 @@ +[character] +success_symbol = "[>](bold green)" +error_symbol = "[x](bold red)" +vimcmd_symbol = "[<](bold green)" + +[git_commit] +tag_symbol = " tag " + +[git_status] +ahead = ">" +behind = "<" +diverged = "<>" +renamed = "r" +deleted = "x" + +[aws] +symbol = "aws " + +[azure] +symbol = "az " + +[bun] +symbol = "bun " + +[c] +symbol = "C " + +[cobol] +symbol = "cobol " + +[conda] +symbol = "conda " + +[crystal] +symbol = "cr " + +[cmake] +symbol = "cmake " + +[daml] +symbol = "daml " + +[dart] +symbol = "dart " + +[deno] +symbol = "deno " + +[dotnet] +symbol = ".NET " + +[directory] +read_only = " ro" + +[docker_context] +symbol = "docker " + +[elixir] +symbol = "exs " + +[elm] +symbol = "elm " + +[fennel] +symbol = "fnl " + +[fossil_branch] +symbol = "fossil " + +[gcloud] +symbol = "gcp " + +[git_branch] +symbol = "git " + +[gleam] +symbol = "gleam " + +[golang] +symbol = "go " + +[gradle] +symbol = "gradle " + +[guix_shell] +symbol = "guix " + +[hg_branch] +symbol = "hg " + +[java] +symbol = "java " + +[julia] +symbol = "jl " + +[kotlin] +symbol = "kt " + +[lua] +symbol = "lua " + +[nodejs] +symbol = "nodejs " + +[memory_usage] +symbol = "memory " + +[meson] +symbol = "meson " + +[nats] +symbol = "nats " + +[nim] +symbol = "nim " + +[nix_shell] +symbol = "nix " + +[ocaml] +symbol = "ml " + +[opa] +symbol = "opa " + +[os.symbols] +AIX = "aix " +Alpaquita = "alq " +AlmaLinux = "alma " +Alpine = "alp " +Amazon = "amz " +Android = "andr " +Arch = "rch " +Artix = "atx " +CentOS = "cent " +Debian = "deb " +DragonFly = "dfbsd " +Emscripten = "emsc " +EndeavourOS = "ndev " +Fedora = "fed " +FreeBSD = "fbsd " +Garuda = "garu " +Gentoo = "gent " +HardenedBSD = "hbsd " +Illumos = "lum " +Kali = "kali " +Linux = "lnx " +Mabox = "mbox " +Macos = "mac " +Manjaro = "mjo " +Mariner = "mrn " +MidnightBSD = "mid " +Mint = "mint " +NetBSD = "nbsd " +NixOS = "nix " +OpenBSD = "obsd " +OpenCloudOS = "ocos " +openEuler = "oeul " +openSUSE = "osuse " +OracleLinux = "orac " +Pop = "pop " +Raspbian = "rasp " +Redhat = "rhl " +RedHatEnterprise = "rhel " +RockyLinux = "rky " +Redox = "redox " +Solus = "sol " +SUSE = "suse " +Ubuntu = "ubnt " +Ultramarine = "ultm " +Unknown = "unk " +Void = "void " +Windows = "win " + +[package] +symbol = "pkg " + +[perl] +symbol = "pl " + +[php] +symbol = "php " + +[pijul_channel] +symbol = "pijul " + +[pulumi] +symbol = "pulumi " + +[purescript] +symbol = "purs " + +[python] +symbol = "py " + +[quarto] +symbol = "quarto " + +[raku] +symbol = "raku " + +[ruby] +symbol = "rb " + +[rust] +symbol = "rs " + +[scala] +symbol = "scala " + +[spack] +symbol = "spack " + +[solidity] +symbol = "solidity " + +[status] +symbol = "[x](bold red) " + +[sudo] +symbol = "sudo " + +[swift] +symbol = "swift " + +[typst] +symbol = "typst " + +[terraform] +symbol = "terraform " + +[zig] +symbol = "zig " diff --git a/chezmoi/dot_config/tmux/tmux.conf b/chezmoi/dot_config/tmux/tmux.conf new file mode 100644 index 0000000..e3e9a49 --- /dev/null +++ b/chezmoi/dot_config/tmux/tmux.conf @@ -0,0 +1,116 @@ +## Base Config + +set-option -sa terminal-overrides ",xterm*:Tc" +# set -g default-terminal "screen-256color" +set -g mouse on +set -g history-limit 100000 +set -g base-index 1 # start windows in 1 +set-window-option -g pane-base-index 1 +set-window-option -g mode-keys vi +unbind -T copy-mode-vi Space; #Default for begin-selection +unbind -T copy-mode-vi Enter; #Default for copy-selection +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy" +# set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' +set -sg escape-time 0 +set-option -g focus-events on +set-option -g renumber-windows on +set -g detach-on-destroy off # don't exit from tmux when closing a session + +# Yazi need this config to show image preview +set -g allow-passthrough on +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM + +## Keybindings +unbind C-b +unbind C-Space +set -g prefix C-Space + +# Reload Config +unbind R +bind R source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf" + +# Copy Mode +unbind [ +bind V copy-mode + +# Panes +unbind v +unbind s +unbind D +unbind % # Split vertically +unbind '"' # Split horizontally + +bind s split-window -h -c "#{pane_current_path}" +bind v split-window -v -c "#{pane_current_path}" +bind D kill-pane + +bind-key C-Space if-shell -F '#{==:#{session_name},scratch}' { +detach-client +} { +display-popup -w '80%' -h '80%' -d "#{pane_current_path}" -E "tmux new-session -A -s scratch" +} + +bind -r m resize-pane -Z # maximize pane + +bind-key M choose-window -Nwf"##{==:##{session_name},#{session_name}}" "join-pane -h -t '%%'" # Send pane to window +bind-key N break-pane # send current pane to new window +bind-key S command-prompt -p "Swap window with:" "swap-window -d -t '%%'" # send current pane to new window + +# Windows +unbind r +unbind n +unbind h +unbind l + +bind r command-prompt "rename-window '%%'" +bind n new-window -c "#{pane_current_path}" +bind h previous-window +bind l next-window + +# set -g status-right '#(bartib current | sed -n 3p | awk \'{print $NF}\')' + +## Plugins + +## Auto install plugins +if "test ! -d ~/.config/tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'" + +run -b '~/.config/tmux/plugins/tpm/tpm' +set -g @plugin 'tmux-plugins/tpm' + +set -g @plugin 'catppuccin/tmux' +# set -g @plugin 'rwxd/catppuccin-tmux' + +set -g @plugin 'tmux-plugins/tmux-copycat'` +set -g @plugin 'laktak/extrakto' +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'sainnhe/tmux-fzf' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' + + +## Plugin Config +set -g @catppuccin_flavour 'macchiato' +set -g @catppuccin_window_tabs_enabled off # or off to disable window_tabs +set -g @catppuccin_status_modules_right "session" +set -g @catppuccin_status_left_separator " " +set -g @catppuccin_status_right_separator "" +set -g @catppuccin_status_right_separator_inverse "no" +set -g @catppuccin_status_fill "icon" +set -g @catppuccin_status_connect_separator "no" +set -g @catppuccin_window_default_text "#{?window_zoomed_flag, ,}#W" +set -g @catppuccin_window_current_text "#{?window_zoomed_flag, ,}#W" +set -g @continuum-restore 'on' +set -g @resurrect-processes 'vi vim nvim man "~pnpm dev->pnpm dev *"' + +TMUX_FZF_LAUNCH_KEY="w" +TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m" + + +# Tmux Management +bind-key "f" run-shell "~/.local/share/chezmoi/scripts/fzf-tmux-sessions" + +bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch" +# bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/window.sh switch" diff --git a/chezmoi/dot_config/yazi/init.lua b/chezmoi/dot_config/yazi/init.lua new file mode 100644 index 0000000..6c283c4 --- /dev/null +++ b/chezmoi/dot_config/yazi/init.lua @@ -0,0 +1 @@ +require("full-border"):setup() diff --git a/chezmoi/dot_config/yazi/keymap.toml b/chezmoi/dot_config/yazi/keymap.toml new file mode 100644 index 0000000..ceeeee3 --- /dev/null +++ b/chezmoi/dot_config/yazi/keymap.toml @@ -0,0 +1,293 @@ +# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. +# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. +"$schema" = "https://yazi-rs.github.io/schemas/keymap.json" + +[manager] + +keymap = [ + { on = [ "" ], run = "escape --all", desc = "Exit visual mode, clear selected, or cancel search" }, + { on = [ "q" ], run = "quit", desc = "Exit the process" }, + { on = [ "Q" ], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" }, + { on = [ "" ], run = "close", desc = "Close the current tab, or quit if it is last tab" }, + { on = [ "" ], run = "suspend", desc = "Suspend the process" }, + + # Hopping + { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], run = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], run = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], run = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "" ], run = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], run = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], run = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], run = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "g", "g" ], run = "arrow -99999999", desc = "Move cursor to the top" }, + { on = [ "G" ], run = "arrow 99999999", desc = "Move cursor to the bottom" }, + + # Navigation + { on = [ "h" ], run = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" }, + { on = [ "l" ], run = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" }, + + { on = [ "" ], run = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" }, + { on = [ "" ], run = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" }, + + { on = [ "H" ], run = "back", desc = "Go back to the previous directory" }, + { on = [ "L" ], run = "forward", desc = "Go forward to the next directory" }, + + # Seeking + { on = ["K"], run = "seek -5", desc = "Seek up 5 units in the preview" }, + { on = ["J"], run = "seek 5", desc = "Seek down 5 units in the preview" }, + + # Selection + { on = [ "" ], run = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" }, + { on = [ "v" ], run = "visual_mode", desc = "Enter visual mode (selection mode)" }, + { on = [ "V" ], run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, + { on = [ "" ], run = "select_all --state=true", desc = "Select all files" }, + { on = [ "" ], run = "select_all --state=none", desc = "Inverse selection of all files" }, + + # Operation + { on = [ "o" ], run = "open", desc = "Open the selected files" }, + { on = [ "O" ], run = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "" ], run = "open", desc = "Open the selected files" }, + { on = [ "" ], run = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "y" ], run = [ "yank", "escape --visual --select" ], desc = "Copy the selected files" }, + { on = [ "Y" ], run = [ "unyank", "escape --visual --select" ], desc = "Cancel the yank status of files" }, + { on = [ "x" ], run = [ "yank --cut", "escape --visual --select" ], desc = "Cut the selected files" }, + { on = [ "p" ], run = "paste", desc = "Paste the files" }, + { on = [ "P" ], run = "paste --force", desc = "Paste the files (overwrite if the destination exists)" }, + { on = [ "-" ], run = "link", desc = "Symlink the absolute path of files" }, + { on = [ "_" ], run = "link --relative", desc = "Symlink the relative path of files" }, + { on = [ "d" ], run = [ "remove", "escape --visual --select" ], desc = "Move the files to the trash" }, + { on = [ "D" ], run = [ "remove --permanently", "escape --visual --select" ], desc = "Permanently delete the files" }, + { on = [ "a" ], run = "create", desc = "Create a file or directory (ends with / for directories)" }, + { on = [ "r" ], run = "rename --cursor=before_ext", desc = "Rename a file or directory" }, + { on = [ ";" ], run = "shell", desc = "Run a shell command" }, + { on = [ ":" ], run = "shell --block", desc = "Run a shell command (block the UI until the command finishes)" }, + { on = [ "." ], run = "hidden toggle", desc = "Toggle the visibility of hidden files" }, + { on = [ "s" ], run = "search fd", desc = "Search files by name using fd" }, + { on = [ "S" ], run = "search rg", desc = "Search files by content using ripgrep" }, + { on = [ "" ], run = "search none", desc = "Cancel the ongoing search" }, + { on = [ "z" ], run = "plugin zoxide", desc = "Jump to a directory using zoxide" }, + { on = [ "Z" ], run = "plugin fzf", desc = "Jump to a directory, or reveal a file using fzf" }, + + # Linemode + { on = [ "m", "s" ], run = "linemode size", desc = "Set linemode to size" }, + { on = [ "m", "p" ], run = "linemode permissions", desc = "Set linemode to permissions" }, + { on = [ "m", "m" ], run = "linemode mtime", desc = "Set linemode to mtime" }, + { on = [ "m", "n" ], run = "linemode none", desc = "Set linemode to none" }, + + # Copy + { on = [ "c", "c" ], run = "copy path", desc = "Copy the absolute path" }, + { on = [ "c", "d" ], run = "copy dirname", desc = "Copy the path of the parent directory" }, + { on = [ "c", "f" ], run = "copy filename", desc = "Copy the name of the file" }, + { on = [ "c", "n" ], run = "copy name_without_ext", desc = "Copy the name of the file without the extension" }, + + # Filter + { on = [ "f" ], run = "filter --smart", desc = "Filter the files" }, + + # Find + { on = [ "/" ], run = "find --smart", desc = "Find next file" }, + { on = [ "?" ], run = "find --previous --smart", desc = "Find previous file" }, + { on = [ "n" ], run = "find_arrow", desc = "Go to next found file" }, + { on = [ "N" ], run = "find_arrow --previous", desc = "Go to previous found file" }, + + # Sorting + { on = [ ",", "m" ], run = "sort modified --reverse=no", desc = "Sort by modified time" }, + { on = [ ",", "M" ], run = "sort modified --reverse", desc = "Sort by modified time (reverse)" }, + { on = [ ",", "c" ], run = "sort created --reverse=no", desc = "Sort by created time" }, + { on = [ ",", "C" ], run = "sort created --reverse", desc = "Sort by created time (reverse)" }, + { on = [ ",", "e" ], run = "sort extension --reverse=no", desc = "Sort by extension" }, + { on = [ ",", "E" ], run = "sort extension --reverse", desc = "Sort by extension (reverse)" }, + { on = [ ",", "a" ], run = "sort alphabetical --reverse=no", desc = "Sort alphabetically" }, + { on = [ ",", "A" ], run = "sort alphabetical --reverse", desc = "Sort alphabetically (reverse)" }, + { on = [ ",", "n" ], run = "sort natural --reverse=no", desc = "Sort naturally" }, + { on = [ ",", "N" ], run = "sort natural --reverse", desc = "Sort naturally (reverse)" }, + { on = [ ",", "s" ], run = "sort size --reverse=no", desc = "Sort by size" }, + { on = [ ",", "S" ], run = "sort size --reverse", desc = "Sort by size (reverse)" }, + # Tabs + { on = [ "t" ], run = "tab_create --current", desc = "Create a new tab using the current path" }, + + { on = [ "1" ], run = "tab_switch 0", desc = "Switch to the first tab" }, + { on = [ "2" ], run = "tab_switch 1", desc = "Switch to the second tab" }, + { on = [ "3" ], run = "tab_switch 2", desc = "Switch to the third tab" }, + { on = [ "4" ], run = "tab_switch 3", desc = "Switch to the fourth tab" }, + { on = [ "5" ], run = "tab_switch 4", desc = "Switch to the fifth tab" }, + { on = [ "6" ], run = "tab_switch 5", desc = "Switch to the sixth tab" }, + { on = [ "7" ], run = "tab_switch 6", desc = "Switch to the seventh tab" }, + { on = [ "8" ], run = "tab_switch 7", desc = "Switch to the eighth tab" }, + { on = [ "9" ], run = "tab_switch 8", desc = "Switch to the ninth tab" }, + + { on = [ "[" ], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" }, + { on = [ "]" ], run = "tab_switch 1 --relative", desc = "Switch to the next tab" }, + + { on = [ "{" ], run = "tab_swap -1", desc = "Swap the current tab with the previous tab" }, + { on = [ "}" ], run = "tab_swap 1", desc = "Swap the current tab with the next tab" }, + + # Tasks + { on = [ "w" ], run = "tasks_show", desc = "Show the tasks manager" }, + + # Goto + { on = [ "g", "h" ], run = "cd ~", desc = "Go to the home directory" }, + { on = [ "g", "c" ], run = "cd ~/.config", desc = "Go to the config directory" }, + { on = [ "g", "d" ], run = "cd ~/Downloads", desc = "Go to the downloads directory" }, + { on = [ "g", "t" ], run = "cd /tmp", desc = "Go to the temporary directory" }, + { on = [ "g", "" ], run = "cd --interactive", desc = "Go to a directory interactively" }, + + # Help + { on = [ "~" ], run = "help", desc = "Open help" }, +] + +[tasks] + +keymap = [ + { on = [ "" ], run = "close", desc = "Hide the task manager" }, + { on = [ "" ], run = "close", desc = "Hide the task manager" }, + { on = [ "w" ], run = "close", desc = "Hide the task manager" }, + + { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "inspect", desc = "Inspect the task" }, + { on = [ "x" ], run = "cancel", desc = "Cancel the task" }, + + { on = [ "~" ], run = "help", desc = "Open help" } +] + +[select] + +keymap = [ + { on = [ "" ], run = "close", desc = "Cancel selection" }, + { on = [ "" ], run = "close", desc = "Cancel selection" }, + { on = [ "" ], run = "close --submit", desc = "Submit the selection" }, + + { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], run = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "" ], run = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "~" ], run = "help", desc = "Open help" } +] + +[input] + +keymap = [ + { on = [ "" ], run = "close", desc = "Cancel input" }, + { on = [ "" ], run = "close --submit", desc = "Submit the input" }, + { on = [ "" ], run = "close", desc = "Go back the normal mode, or cancel input" }, + + # Mode + { on = [ "i" ], run = "insert", desc = "Enter insert mode" }, + { on = [ "a" ], run = "insert --append", desc = "Enter append mode" }, + { on = [ "I" ], run = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" }, + { on = [ "A" ], run = [ "move 999", "insert --append" ], desc = "Move to the EOL, and enter append mode" }, + { on = [ "v" ], run = "visual", desc = "Enter visual mode" }, + { on = [ "V" ], run = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" }, + + # Character-wise movement + { on = [ "h" ], run = "move -1", desc = "Move back a character" }, + { on = [ "l" ], run = "move 1", desc = "Move forward a character" }, + { on = [ "" ], run = "move -1", desc = "Move back a character" }, + { on = [ "" ], run = "move 1", desc = "Move forward a character" }, + { on = [ "" ], run = "move -1", desc = "Move back a character" }, + { on = [ "" ], run = "move 1", desc = "Move forward a character" }, + + # Word-wise movement + { on = [ "b" ], run = "backward", desc = "Move back to the start of the current or previous word" }, + { on = [ "w" ], run = "forward", desc = "Move forward to the start of the next word" }, + { on = [ "e" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, + { on = [ "" ], run = "backward", desc = "Move back to the start of the current or previous word" }, + { on = [ "" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, + + # Line-wise movement + { on = [ "0" ], run = "move -999", desc = "Move to the BOL" }, + { on = [ "$" ], run = "move 999", desc = "Move to the EOL" }, + { on = [ "" ], run = "move -999", desc = "Move to the BOL" }, + { on = [ "" ], run = "move 999", desc = "Move to the EOL" }, + { on = [ "" ], run = "move -999", desc = "Move to the BOL" }, + { on = [ "" ], run = "move 999", desc = "Move to the EOL" }, + + # Delete + { on = [ "" ], run = "backspace", desc = "Delete the character before the cursor" }, + { on = [ "" ], run = "backspace --under", desc = "Delete the character under the cursor" }, + { on = [ "" ], run = "backspace", desc = "Delete the character before the cursor" }, + { on = [ "" ], run = "backspace --under", desc = "Delete the character under the cursor" }, + + # Kill + { on = [ "" ], run = "kill bol", desc = "Kill backwards to the BOL" }, + { on = [ "" ], run = "kill eol", desc = "Kill forwards to the EOL" }, + { on = [ "" ], run = "kill backward", desc = "Kill backwards to the start of the current word" }, + { on = [ "" ], run = "kill forward", desc = "Kill forwards to the end of the current word" }, + + # Cut/Yank/Paste + { on = [ "d" ], run = "delete --cut", desc = "Cut the selected characters" }, + { on = [ "D" ], run = [ "delete --cut", "move 999" ], desc = "Cut until the EOL" }, + { on = [ "c" ], run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" }, + { on = [ "C" ], run = [ "delete --cut --insert", "move 999" ], desc = "Cut until the EOL, and enter insert mode" }, + { on = [ "x" ], run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" }, + { on = [ "y" ], run = "yank", desc = "Copy the selected characters" }, + { on = [ "p" ], run = "paste", desc = "Paste the copied characters after the cursor" }, + { on = [ "P" ], run = "paste --before", desc = "Paste the copied characters before the cursor" }, + + # Undo/Redo + { on = [ "u" ], run = "undo", desc = "Undo the last operation" }, + { on = [ "" ], run = "redo", desc = "Redo the last operation" }, + + # Help + { on = [ "~" ], run = "help", desc = "Open help" } +] + +[completion] + +keymap = [ + { on = [ "" ], run = "close", desc = "Cancel completion" }, + { on = [ "" ], run = "close --submit", desc = "Submit the completion" }, + { on = [ "" ], run = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" }, + + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "~" ], run = "help", desc = "Open help" } +] + +[help] + +keymap = [ + { on = [ "" ], run = "escape", desc = "Clear the filter, or hide the help" }, + { on = [ "q" ], run = "close", desc = "Exit the process" }, + { on = [ "" ], run = "close", desc = "Hide the help" }, + + # Navigation + { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], run = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "" ], run = "arrow 5", desc = "Move cursor down 5 lines" }, + + # Filtering + { on = [ "/" ], run = "filter", desc = "Apply a filter for the help items" }, +] diff --git a/chezmoi/dot_config/yazi/original_package.toml b/chezmoi/dot_config/yazi/original_package.toml new file mode 100644 index 0000000..7e34c3a --- /dev/null +++ b/chezmoi/dot_config/yazi/original_package.toml @@ -0,0 +1,5 @@ +[plugin] +deps = [{ use = "yazi-rs/plugins#full-border", commit = "39f2753" }] + +[flavor] +deps = [{ use = "yazi-rs/flavors#catppuccin-macchiato", commit = "2d7dd2a" }] diff --git a/chezmoi/dot_config/yazi/symlink_package.toml.tmpl b/chezmoi/dot_config/yazi/symlink_package.toml.tmpl new file mode 100644 index 0000000..716b5a9 --- /dev/null +++ b/chezmoi/dot_config/yazi/symlink_package.toml.tmpl @@ -0,0 +1,2 @@ +{{ .chezmoi.sourceDir }}/dot_config/yazi/original_package.toml + diff --git a/chezmoi/dot_config/yazi/theme.toml b/chezmoi/dot_config/yazi/theme.toml new file mode 100644 index 0000000..000a93b --- /dev/null +++ b/chezmoi/dot_config/yazi/theme.toml @@ -0,0 +1,2 @@ +[flavor] +use = "catppuccin-macchiato" diff --git a/chezmoi/dot_config/yazi/yazi.toml b/chezmoi/dot_config/yazi/yazi.toml new file mode 100644 index 0000000..8eb7d53 --- /dev/null +++ b/chezmoi/dot_config/yazi/yazi.toml @@ -0,0 +1,203 @@ +# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. +# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. +"$schema" = "https://yazi-rs.github.io/schemas/yazi.json" + +[manager] +ratio = [ 1, 3, 4 ] +sort_by = "alphabetical" +sort_sensitive = false +sort_reverse = false +sort_dir_first = true +linemode = "mtime" +show_hidden = true +show_symlink = true +scrolloff = 5 +mouse_events = [ "click", "scroll" ] +title_format = "Yazi: {cwd}" + +[preview] +tab_size = 2 +max_width = 1920 +max_height = 1080 +cache_dir = "" +image_filter = "triangle" +image_quality = 75 +sixel_fraction = 15 +ueberzug_scale = 1 +ueberzug_offset = [ 0, 0, 0, 0 ] + +[opener] +edit = [ + { run = '[ -n "$EDITOR" ] && $EDITOR "$@"', desc = "$EDITOR", block = true, for = "unix" }, + { run = 'code "%*"', orphan = true, for = "windows" }, +] +open = [ + { run = 'xdg-open "$@"', desc = "Open", for = "linux" }, + { run = 'open "$@"', desc = "Open", for = "macos" }, + { run = 'start "" "%1"', orphan = true, desc = "Open", for = "windows" } +] +reveal = [ + { run = 'open -R "$1"', desc = "Reveal", for = "macos" }, + { run = 'explorer /select, "%1"', orphan = true, desc = "Reveal", for = "windows" }, + { run = '''exiftool "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show EXIF", for = "unix" }, +] +extract = [ + { run = 'ya pub extract --list "$@"', desc = "Extract here", for = "unix" }, + { run = 'ya pub extract --list %*', desc = "Extract here", for = "windows" },] +play = [ + { run = 'mpv "$@"', orphan = true, for = "unix" }, + { run = 'mpv "%1"', orphan = true, for = "windows" }, + { run = '''mediainfo "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show media info", for = "unix" }, +] + +[open] +rules = [ + # Folder + { name = "*/", use = [ "edit", "open", "reveal" ] }, + + # Text + { mime = "text/*", use = [ "edit", "reveal" ] }, + + # Archive + { mime = "application/{,g}zip", use = [ "extract", "reveal" ] }, + { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] }, + + # Image + { mime = "image/*", use = [ "open", "reveal" ] }, + + # Media + { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, + { mime = "inode/x-empty", use = [ "edit", "reveal" ] }, + + # JSON + { mime = "application/json", use = [ "edit", "reveal" ] }, + { mime = "*/javascript", use = [ "edit", "reveal" ] }, + + # Empty file + { mime = "inode/x-empty", use = [ "edit", "reveal" ] }, + + # Fallback + { mime = "*", use = [ "open", "reveal" ] }, +] + +[tasks] +micro_workers = 10 +macro_workers = 25 +bizarre_retry = 5 +image_alloc = 536870912 # 512MB +image_bound = [ 0, 0 ] +suppress_preload = false + +[plugin] + +fetchers = [ + # Mimetype + { id = "mime", name = "*", run = "mime", if = "!mime", prio = "high" }, +] +preloaders = [ + # example + { mime = "image/{avif,heic,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, + # Video + { mime = "video/*", run = "video" }, + # PDF + { mime = "application/pdf", run = "pdf" }, + # Font + { mime = "font/*", run = "font" }, + { mime = "application/vnd.ms-opentype", run = "font" }, +] +previewers = [ + { name = "*/", run = "folder", sync = true }, + # Code + { mime = "text/*", run = "code" }, + { mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" }, + # JSON + { mime = "application/{json,x-ndjson}", run = "json" }, + # Image + { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, + # Video + { mime = "video/*", run = "video" }, + # PDF + { mime = "application/pdf", run = "pdf" }, + # Archive + { mime = "application/{,g}zip", run = "archive" }, + { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" }, + # Font + { mime = "font/*", run = "font" }, + { mime = "application/vnd.ms-opentype", run = "font" }, + # Fallback + { name = "*", run = "file" }, +] + +[input] +cursor_blink = false + +# cd +cd_title = "Change directory:" +cd_origin = "top-center" +cd_offset = [ 0, 2, 50, 3 ] + +# create +create_title = "Create:" +create_origin = "hovered" +create_offset = [ 0, 1, 50, 3 ] + +# rename +rename_title = "Rename:" +rename_origin = "hovered" +rename_offset = [ 0, 1, 50, 3 ] + +# trash +trash_title = "Move {n} selected file{s} to trash? (y/N)" +trash_origin = "hovered" +trash_offset = [ 0, 2, 50, 3 ] + +# delete +delete_title = "Delete {n} selected file{s} permanently? (y/N)" +delete_origin = "hovered" +delete_offset = [ 0, 2, 50, 3 ] + +# filter +filter_title = "Filter:" +filter_origin = "hovered" +filter_offset = [ 0, 2, 50, 3 ] + +# find +find_title = [ "Find next:", "Find previous:" ] +find_origin = "hovered" +find_offset = [ 0, 2, 50, 3 ] + +# search +search_title = "Search via {n}:" +search_origin = "hovered" +search_offset = [ 0, 2, 50, 3 ] + +# shell +shell_title = [ "Shell:", "Shell (block):" ] +shell_origin = "center" +shell_offset = [ 0, 2, 50, 3 ] + +# overwrite +overwrite_title = "Overwrite an existing file? (y/N)" +overwrite_origin = "center" +overwrite_offset = [ 0, 2, 50, 3 ] + +# quit +quit_title = "{n} task{s} running, sure to quit? (y/N)" +quit_origin = "center" +quit_offset = [ 0, 2, 50, 3 ] + +[select] +open_title = "Open with:" +open_origin = "hovered" +open_offset = [ 0, 1, 50, 7 ] + +[which] +sort_by = "none" +sort_sensitive = false +sort_reverse = false +sort_translit = false + +[log] +enabled = false diff --git a/chezmoi/dot_config/zsh/aliases/aliases.zsh b/chezmoi/dot_config/zsh/aliases/aliases.zsh new file mode 100644 index 0000000..d0b7088 --- /dev/null +++ b/chezmoi/dot_config/zsh/aliases/aliases.zsh @@ -0,0 +1,61 @@ +#--------------------------------------------------------------------# +# Aliases # +#--------------------------------------------------------------------# + +#fix obvious typo's +alias pdw="pwd" + +# File Managment +alias \ + cp='cp -iv' \ + mv='mv -iv' \ + cpr='rsync -za --partial -hh --info=progress2' \ + mvr='rsync -za --remove-source-files --partial -hh --info=progress2' \ + sync='rsync -zau --delete --partial -hh --info=progress2' \ + del='trash -i' \ + rmf='rm -rfI' \ + md='mkdir -pv' \ + ls='eza -lh --color=always --icons --git ' \ + la='eza -alh --color=always --icons --git ' \ + ld='eza -la --no-permissions --no-filesize --no-time --no-time --no-user' \ + mkexec='chmod +x' + +# Search and Query Files +alias grep="rg --sort path --context 3" + +# Quicly update Stuff +alias vi-ssh="vi ~/.ssh/config" + +# Query Stuff +alias \ + ip='ip -human -color -brief addr' \ + df="duf --hide special --hide-mp '/boot,/boot/*'" \ + du='dust --reverse' \ + du1='dust --reverse --min-size 1M --depth 1' \ + du2='dust --reverse --min-size 1M --depth 2' \ + du3='dust --reverse --min-size 1M --depth 3' \ + cat='bat' + +alias \ + dco='docker compose' \ + dps="docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.State}}\t{{.Status}}\t{{.RunningFor}}'" + +alias \ + pco='podman compose' \ + pps="podman ps --format 'table {{.ID}}\t{{.Names}}\t{{.State}}\t{{.Status}}\t{{.RunningFor}}'" + +alias tm="fzf-tmux-sessions" + +# Misc +alias \ + reload='exec $SHELL -l' + +# Specific Mac overrides +if [[ "$OSTYPE" != 'linux-gnu' ]]; then +fi + +#--------------------------------------------------------------------# +# Global # +#--------------------------------------------------------------------# + +alias -g NULL='> /dev/null 2>&1' diff --git a/chezmoi/dot_config/zsh/aliases/configs.zsh b/chezmoi/dot_config/zsh/aliases/configs.zsh new file mode 100644 index 0000000..8221cf5 --- /dev/null +++ b/chezmoi/dot_config/zsh/aliases/configs.zsh @@ -0,0 +1,4 @@ +alias \ + ckb='cd ~/qmk_firmware && $EDITOR keyboards/sofle/keymaps/aleee-idk' \ + cz='chezmoi' \ + dots='chezmoi edit' diff --git a/chezmoi/dot_config/zsh/aliases/fzf.zsh b/chezmoi/dot_config/zsh/aliases/fzf.zsh new file mode 100644 index 0000000..0cda652 --- /dev/null +++ b/chezmoi/dot_config/zsh/aliases/fzf.zsh @@ -0,0 +1 @@ +alias fzf-fp='fzf-flatpak-install-widget' diff --git a/chezmoi/dot_config/zsh/aliases/nvim.zsh b/chezmoi/dot_config/zsh/aliases/nvim.zsh new file mode 100644 index 0000000..5259ff9 --- /dev/null +++ b/chezmoi/dot_config/zsh/aliases/nvim.zsh @@ -0,0 +1,22 @@ +alias \ + vi='nvim' \ + vi-astro='NVIM_APPNAME=Distro-AstroNvim nvim' \ + vi-lazy='NVIM_APPNAME=LazyVim nvim' + +vis() { + items=( + default + AstroNvim + LazyVim + ) + config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0) + + if [[ -z $config ]]; then + echo "Nothing selected" + return 0 + elif [[ $config == "default" ]]; then + config="" + fi + + NVIM_APPNAME=$config nvim $@ +} diff --git a/chezmoi/dot_config/zsh/aliases/pnpm.zsh b/chezmoi/dot_config/zsh/aliases/pnpm.zsh new file mode 100644 index 0000000..d785927 --- /dev/null +++ b/chezmoi/dot_config/zsh/aliases/pnpm.zsh @@ -0,0 +1,47 @@ +alias p='pnpm' + +# Dependencies +alias pa='pnpm add' +alias pad='pnpm add --save-dev' +alias pap='pnpm add --save-peer' +alias prm='pnpm remove' +alias pin='pnpm install' +alias pls='pnpm list' +alias pu='pnpm update' +alias puil='pnpm update --interactive --latest' + +# Global dependencies +alias pga='pnpm add --global' +alias pgls='pnpm list --global' +alias pgrm='pnpm remove --global' +alias pgu='pnpm update --global' + +# WorkSpace +alias pwa='pnpm add --workspace' +alias pwls='pnpm list --workspace' +alias pwrm='pnpm remove --workspace' +alias pwu='pnpm update --workspace' + +# Run scripts +alias prun='pnpm run' +alias pd='pnpm run dev' +alias pb='pnpm run build' +alias psv='pnpm run serve' +alias pst='pnpm start' +alias pt='pnpm test' +alias ptc='pnpm test --coverage' +alias pln='pnpm run lint' +alias pdocs='pnpm run docs' +alias pex='pnpm exec' +alias pdx='pnpm dlx' + +# Misc +alias pi='pnpm init' +alias ppub='pnpm publish' +alias pc='pnpm create' + +# Monorepo +alias pf='pnpm -r --filter' + +# qwik +alias pre='pnpm run preview' diff --git a/chezmoi/dot_config/zsh/completions/_cargo b/chezmoi/dot_config/zsh/completions/_cargo new file mode 100644 index 0000000..5b0f881 --- /dev/null +++ b/chezmoi/dot_config/zsh/completions/_cargo @@ -0,0 +1,447 @@ +#compdef cargo + +autoload -U regexp-replace + +_cargo() { + local curcontext="$curcontext" ret=1 + local -a command_scope_spec common parallel features msgfmt triple target registry + local -a state line state_descr # These are set by _arguments + typeset -A opt_args + + common=( + '(-q --quiet)*'{-v,--verbose}'[use verbose output]' + '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]' + '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags' + '--frozen[require that Cargo.lock and cache are up-to-date]' + '--locked[require that Cargo.lock is up-to-date]' + '--color=[specify colorization option]:coloring:(auto always never)' + '(- 1 *)'{-h,--help}'[show help message]' + ) + + # leading items in parentheses are an exclusion list for the arguments following that arg + # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions + # - => exclude all other options + # 1 => exclude positional arg 1 + # * => exclude all other args + # +blah => exclude +blah + _arguments -s -S -C $common \ + '(- 1 *)--list[list installed commands]' \ + '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(+beta +nightly)+stable[use the stable toolchain]' \ + '(+stable +nightly)+beta[use the beta toolchain]' \ + '(+stable +beta)+nightly[use the nightly toolchain]' \ + '1: :_cargo_cmds' \ + '*:: :->args' + + # These flags are mutually exclusive specifiers for the scope of a command; as + # they are used in multiple places without change, they are expanded into the + # appropriate command's `_arguments` where appropriate. + command_scope_spec=( + '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names' + '(--bench --bin --test --lib)--example=[specify example name]:example name:_cargo_example_names' + '(--bench --example --test --lib)--bin=[specify binary name]:binary name' + '(--bench --bin --example --test)--lib=[specify library name]:library name' + '(--bench --bin --example --lib)--test=[specify test name]:test name' + ) + + parallel=( + '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]' + '--keep-going[do not abort build on first error]' + ) + + features=( + '(--all-features)'{-F+,--features=}'[specify features to activate]:feature' + '(--features -F)--all-features[activate all available features]' + "--no-default-features[don't build the default features]" + ) + + msgfmt='--message-format=[specify error format]:error format [human]:(human json short)' + triple='--target=[specify target triple]:target triple:_cargo_target_triple' + target='--target-dir=[specify directory for all generated artifacts]:directory:_directories' + manifest='--manifest-path=[specify path to manifest]:path:_directories' + registry='--registry=[specify registry to use]:registry' + + case $state in + args) + curcontext="${curcontext%:*}-${words[1]}:" + case ${words[1]} in + add) + _arguments -s -A "^--" $common $manifest $registry \ + {-F+,--features=}'[specify features to activate]:feature' \ + "--default-features[enable the default features]" \ + "--no-default-features[don't enable the default features]" \ + "--optional[mark the dependency as optional]" \ + "--no-optional[mark the dependency as required]" \ + "--dev[add as a dev dependency]" \ + "--build[add as a build dependency]" \ + "--target=[add as a dependency to the given target platform]" \ + "--rename=[rename the dependency]" \ + "--dry-run[don't actually write the manifest]" \ + '--branch=[branch to use when adding from git]:branch' \ + '--git=[specify URL from which to add the crate]:url:_urls' \ + '--path=[local filesystem path to crate to add]: :_directories' \ + '--rev=[specific commit to use when adding from git]:commit' \ + '--tag=[tag to use when adding from git]:tag' \ + '1: :_guard "^-*" "crate name"' \ + '*:args:_default' + ;; + bench) + _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \ + "${command_scope_spec[@]}" \ + '--all-targets[benchmark all targets]' \ + "--no-run[compile but don't run]" \ + '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \ + '--exclude=[exclude packages from the benchmark]:spec' \ + '--no-fail-fast[run all benchmarks regardless of failure]' \ + '1: :_guard "^-*" "bench name"' \ + '*:args:_default' + ;; + + build | b) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ + "${command_scope_spec[@]}" \ + '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ + '--release[build in release mode]' \ + '--build-plan[output the build plan in JSON]' \ + ;; + + check | c) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ + "${command_scope_spec[@]}" \ + '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \ + '--release[check in release mode]' \ + ;; + + clean) + _arguments -s -S $common $triple $target $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \ + '--release[clean release artifacts]' \ + '--doc[clean just the documentation directory]' + ;; + + doc | d) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--no-deps[do not build docs for dependencies]' \ + '--document-private-items[include non-public items in the documentation]' \ + '--open[open docs in browser after the build]' \ + '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ + '--release[build artifacts in release mode, with optimizations]' \ + ;; + + fetch) + _arguments -s -S $common $triple $manifest + ;; + + fix) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + "${command_scope_spec[@]}" \ + '--broken-code[fix code even if it already has compiler errors]' \ + '--edition[fix in preparation for the next edition]' \ + '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \ + '--allow-no-vcs[fix code even if a VCS was not detected]' \ + '--allow-dirty[fix code even if the working directory is dirty]' \ + '--allow-staged[fix code even if the working directory has staged changes]' + ;; + + generate-lockfile) + _arguments -s -S $common $manifest + ;; + + help) + _cargo_cmds + ;; + + init) + _arguments -s -S $common $registry \ + '--lib[use library template]' \ + '--edition=[specify edition to set for the crate generated]:edition:(2015 2018 2021)' \ + '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \ + '--name=[set the resulting package name]:name' \ + '1:path:_directories' + ;; + + install) + _arguments -s -S $common $parallel $features $triple $registry \ + '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \ + '--bin=[only install the specified binary]:binary' \ + '--branch=[branch to use when installing from git]:branch' \ + '--debug[Build in debug mode (with the "dev" profile) instead of release mode]' \ + '--example=[install the specified example instead of binaries]:example:_cargo_example_names' \ + '--git=[specify URL from which to install the crate]:url:_urls' \ + '--path=[local filesystem path to crate to install]: :_directories' \ + '--rev=[specific commit to use when installing from git]:commit' \ + '--root=[directory to install packages into]: :_directories' \ + '--tag=[tag to use when installing from git]:tag' \ + '--version=[version to install from crates.io]:version' \ + '--list[list all installed packages and their versions]' \ + '*: :_guard "^-*" "crate"' + ;; + + locate-project) + _arguments -s -S $common $manifest \ + '--message-format=[specify output representation]:output representation [json]:(json plain)' \ + '--workspace[locate Cargo.toml of the workspace root]' + ;; + + login) + _arguments -s -S $common $registry \ + '*: :_guard "^-*" "token"' + ;; + + metadata) + _arguments -s -S $common $features $manifest \ + "--no-deps[output information only about the root package and don't fetch dependencies]" \ + '--format-version=[specify format version]:version [1]:(1)' + ;; + + new) + _arguments -s -S $common $registry \ + '--lib[use library template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '--name=[set the resulting package name]' + ;; + + owner) + _arguments -s -S $common $registry \ + '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \ + '--index=[specify registry index]:index' \ + '(-l --list)'{-l,--list}'[list owners of a crate]' \ + '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \ + '--token=[specify API token to use when authenticating]:token' \ + '*: :_guard "^-*" "crate"' + ;; + + package) + _arguments -s -S $common $parallel $features $triple $target $manifest \ + '(-l --list)'{-l,--list}'[print files included in a package without making one]' \ + '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ + '--allow-dirty[allow dirty working directories to be packaged]' \ + "--no-verify[don't build to verify contents]" + ;; + + pkgid) + _arguments -s -S $common $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \ + '*: :_guard "^-*" "spec"' + ;; + + publish) + _arguments -s -S $common $parallel $features $triple $target $manifest $registry \ + '--index=[specify registry index]:index' \ + '--allow-dirty[allow dirty working directories to be packaged]' \ + "--no-verify[don't verify the contents by building them]" \ + '--token=[specify token to use when uploading]:token' \ + '--dry-run[perform all checks without uploading]' + ;; + + read-manifest) + _arguments -s -S $common $manifest + ;; + + run | r) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--example=[name of the bin target]:name:_cargo_example_names' \ + '--bin=[name of the bin target]:name' \ + '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \ + '--release[build in release mode]' \ + '*: :_default' + ;; + + rustc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ + '--profile=[specify profile to build the selected target for]:profile' \ + '--release[build artifacts in release mode, with optimizations]' \ + "${command_scope_spec[@]}" \ + '*: : _dispatch rustc rustc -default-' + ;; + + rustdoc) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--document-private-items[include non-public items in the documentation]' \ + '--open[open the docs in a browser after the operation]' \ + '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ + '--release[build artifacts in release mode, with optimizations]' \ + "${command_scope_spec[@]}" \ + '*: : _dispatch rustdoc rustdoc -default-' + ;; + + search) + _arguments -s -S $common $registry \ + '--index=[specify registry index]:index' \ + '--limit=[limit the number of results]:results [10]' \ + '*: :_guard "^-*" "query"' + ;; + + test | t) + _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ + '--test=[test name]: :_cargo_test_names' \ + '--no-fail-fast[run all tests regardless of failure]' \ + '--no-run[compile but do not run]' \ + '(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \ + '--all[test all packages in the workspace]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '1: :_cargo_test_names' \ + '(--doc --bin --example --test --bench)--lib[only test library]' \ + '(--lib --bin --example --test --bench)--doc[only test documentation]' \ + '(--lib --doc --example --test --bench)--bin=[binary name]' \ + '(--lib --doc --bin --test --bench)--example=[example name]:_cargo_example_names' \ + '(--lib --doc --bin --example --bench)--test=[test name]' \ + '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ + '*: :_default' + ;; + + tree) + _arguments -s -S $common $features $triple $manifest \ + '(-p --package)'{-p+,--package=}'[package to use as the root]:package:_cargo_package_names' \ + '(-i --invert)'{-i+,--invert=}'[invert the tree for the given package]:package:_cargo_package_names' \ + '--prefix=[line prefix]:prefix:(depth indent none)' \ + '--no-dedupe[repeat shared dependencies]' \ + '(-d --duplicates)'{-d,--duplicates}'[packages with multiple versions]' \ + '--charset=[utf8 or ascii]:charset:(utf8 ascii)' \ + '(-f --format)'{-f,--format=}'[format string]:format' \ + '(-e --edges)'{-e,--edges=}'[edge kinds]:kind:(features normal build dev all no-dev no-build no-normal)' \ + ;; + + uninstall) + _arguments -s -S $common \ + '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \ + '--bin=[only uninstall the specified binary]:name' \ + '--root=[directory to uninstall packages from]: :_files -/' \ + '*:crate:_cargo_installed_crates -F line' + ;; + + update) + _arguments -s -S $common $manifest \ + '--aggressive=[force dependency update]' \ + "--dry-run[don't actually write the lockfile]" \ + '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \ + '--precise=[update single dependency to precise release]:release' + ;; + + verify-project) + _arguments -s -S $common $manifest + ;; + + version) + _arguments -s -S $common + ;; + + yank) + _arguments -s -S $common $registry \ + '--version=[specify yank version]:version' \ + '--undo[undo a yank, putting a version back into the index]' \ + '--index=[specify registry index to yank from]:registry index' \ + '--token=[specify API token to use when authenticating]:token' \ + '*: :_guard "^-*" "crate"' + ;; + *) + # allow plugins to define their own functions + if ! _call_function ret _cargo-${words[1]}; then + # fallback on default completion for unknown commands + _default && ret=0 + fi + (( ! ret )) + ;; + esac + ;; + esac +} + +_cargo_unstable_flags() { + local flags + flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } ) + _describe -t flags 'unstable flag' flags +} + +_cargo_installed_crates() { + local expl + _description crates expl 'crate' + compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *} +} + +_cargo_cmds() { + local -a commands + # This uses Parameter Expansion Flags, which are a built-in Zsh feature. + # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags + # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion + # + # # How this work? + # + # First it splits the result of `cargo --list` at newline, then it removes the first line. + # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]). + # Then it replaces those spaces between item and description with a `:` + # + # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns + commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} ) + _describe -t commands 'command' commands +} + +_cargo_target_triple() { + local -a targets + targets=( ${(f)"$(rustc --print target-list)"} ) + _describe 'target triple' targets +} + +#FIXME: Disabled until fixed +#gets package names from the manifest file +_cargo_package_names() { + _message -e packages package +} + +# Extracts the values of "name" from the array given in $1 and shows them as +# command line options for completion +_cargo_names_from_array() { + local manifest=$(cargo locate-project --message-format plain) + if [[ -z $manifest ]]; then + return 0 + fi + + local last_line + local -a names; + local in_block=false + local block_name=$1 + names=() + while read -r line; do + if [[ $last_line == "[[$block_name]]" ]]; then + in_block=true + else + if [[ $last_line =~ '\s*\[\[.*' ]]; then + in_block=false + fi + fi + + if [[ $in_block == true ]]; then + if [[ $line =~ '\s*name\s*=' ]]; then + regexp-replace line '^\s*name\s*=\s*|"' '' + names+=( "$line" ) + fi + fi + + last_line=$line + done < "$manifest" + _describe "$block_name" names + +} + +#Gets the test names from the manifest file +_cargo_test_names() { + _cargo_names_from_array "test" +} + +#Gets the bench names from the manifest file +_cargo_benchmark_names() { + _cargo_names_from_array "bench" +} + +_cargo_example_names() { + if [[ -d examples ]]; then + local -a files=(${(@f)$(echo examples/*.rs(:t:r))}) + _values 'example' "${files[@]}" + fi +} + +_cargo diff --git a/chezmoi/dot_config/zsh/completions/_chezmoi b/chezmoi/dot_config/zsh/completions/_chezmoi new file mode 100644 index 0000000..46af48d --- /dev/null +++ b/chezmoi/dot_config/zsh/completions/_chezmoi @@ -0,0 +1,212 @@ +#compdef chezmoi +compdef _chezmoi chezmoi + +# zsh completion for chezmoi -*- shell-script -*- + +__chezmoi_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_chezmoi() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + local shellCompDirectiveKeepOrder=32 + + local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder + local -a completions + + __chezmoi_debug "\n========= starting completion logic ==========" + __chezmoi_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __chezmoi_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __chezmoi_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., chezmoi -n=) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __chezmoi_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __chezmoi_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __chezmoi_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __chezmoi_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __chezmoi_debug "No directive found. Setting do default" + directive=0 + fi + + __chezmoi_debug "directive: ${directive}" + __chezmoi_debug "completions: ${out}" + __chezmoi_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __chezmoi_debug "Completion received error. Ignoring completions." + return + fi + + local activeHelpMarker="_activeHelp_ " + local endIndex=${#activeHelpMarker} + local startIndex=$((${#activeHelpMarker}+1)) + local hasActiveHelp=0 + while IFS='\n' read -r comp; do + # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) + if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then + __chezmoi_debug "ActiveHelp found: $comp" + comp="${comp[$startIndex,-1]}" + if [ -n "$comp" ]; then + compadd -x "${comp}" + __chezmoi_debug "ActiveHelp will need delimiter" + hasActiveHelp=1 + fi + + continue + fi + + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab="$(printf '\t')" + comp=${comp//$tab/:} + + __chezmoi_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + # Add a delimiter after the activeHelp statements, but only if: + # - there are completions following the activeHelp statements, or + # - file completion will be performed (so there will be choices after the activeHelp) + if [ $hasActiveHelp -eq 1 ]; then + if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then + __chezmoi_debug "Adding activeHelp delimiter" + compadd -x "--" + hasActiveHelp=0 + fi + fi + + if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then + __chezmoi_debug "Activating nospace." + noSpace="-S ''" + fi + + if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then + __chezmoi_debug "Activating keep order." + keepOrder="-V" + fi + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __chezmoi_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subdir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __chezmoi_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __chezmoi_debug "Listing directories in ." + fi + + local result + _arguments '*:dirname:_files -/'" ${flagPrefix}" + result=$? + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + return $result + else + __chezmoi_debug "Calling _describe" + if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then + __chezmoi_debug "_describe found some completions" + + # Return the success of having called _describe + return 0 + else + __chezmoi_debug "_describe did not find completions." + __chezmoi_debug "Checking if we should do file completion." + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __chezmoi_debug "deactivating file completion" + + # We must return an error code here to let zsh know that there were no + # completions found by _describe; this is what will trigger other + # matching algorithms to attempt to find completions. + # For example zsh can match letters in the middle of words. + return 1 + else + # Perform file completion + __chezmoi_debug "Activating file completion" + + # We must return the result of this command, so it must be the + # last command, or else we must store its result to return it. + _arguments '*:filename:_files'" ${flagPrefix}" + fi + fi + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_chezmoi" ]; then + _chezmoi +fi diff --git a/chezmoi/dot_config/zsh/completions/_cht b/chezmoi/dot_config/zsh/completions/_cht new file mode 100644 index 0000000..8e395d8 --- /dev/null +++ b/chezmoi/dot_config/zsh/completions/_cht @@ -0,0 +1,20 @@ +#compdef cht.sh +__CHTSH_LANGS=($(curl -s cheat.sh/:list)) +_arguments -C \ + '--help[show this help message and exit]: :->noargs' \ + '--shell[enter shell repl]: :->noargs' \ + '1:Cheat Sheet:->lang' \ + '*::: :->noargs' && return 0 + +if [[ CURRENT -ge 1 ]]; then + case $state in + noargs) + _message "nothing to complete";; + lang) + compadd -X "Cheat Sheets" ${__CHTSH_LANGS[@]};; + *) + _message "Unknown state, error in autocomplete";; + esac + + return +fi diff --git a/chezmoi/dot_config/zsh/completions/_globdots b/chezmoi/dot_config/zsh/completions/_globdots new file mode 100644 index 0000000..9b0d4f4 --- /dev/null +++ b/chezmoi/dot_config/zsh/completions/_globdots @@ -0,0 +1 @@ +_comp_options+=(globdots) # With hidden files diff --git a/chezmoi/dot_config/zsh/completions/_lsd b/chezmoi/dot_config/zsh/completions/_lsd new file mode 100644 index 0000000..2cdb4ae --- /dev/null +++ b/chezmoi/dot_config/zsh/completions/_lsd @@ -0,0 +1,86 @@ +#compdef lsd + +autoload -U is-at-least + +_lsd() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'*--color=[When to use terminal colours]: :(always auto never)' \ +'*--icon=[When to print the icons]: :(always auto never)' \ +'*--icon-theme=[Whether to use fancy or unicode icons]: :(fancy unicode)' \ +'--config-file=[Provide a custom lsd configuration file]:config-file: ' \ +'*--depth=[Stop recursing into directories after reaching specified depth]:num: ' \ +'*--permission=[How to display permissions]: :(rwx octal)' \ +'*--size=[How to display size]: :(default short bytes)' \ +'*--date=[How to display date \[possible values: date, relative, +date-time-format\]]: : ' \ +'*--sort=[sort by WORD instead of name]:WORD:(size time version extension none)' \ +'*--group-dirs=[Sort the directories then the files]: :(none first last)' \ +'*--blocks=[Specify the blocks that will be displayed and in what order]: :(permission user group context size date name inode links)' \ +'*-I+[Do not display files/directories with names matching the glob pattern(s). More than one can be specified by repeating the argument]:pattern: ' \ +'*--ignore-glob=[Do not display files/directories with names matching the glob pattern(s). More than one can be specified by repeating the argument]:pattern: ' \ +'*--hyperlink=[Attach hyperlink to filenames]: :(always auto never)' \ +'--help[Print help information]' \ +'-V[Print version information]' \ +'--version[Print version information]' \ +'*-a[Do not ignore entries starting with .]' \ +'*--all[Do not ignore entries starting with .]' \ +'*-A[Do not list implied . and ..]' \ +'*--almost-all[Do not list implied . and ..]' \ +'*-F[Append indicator (one of */=>@|) at the end of the file names]' \ +'*--classify[Append indicator (one of */=>@|) at the end of the file names]' \ +'*-l[Display extended file metadata as a table]' \ +'*--long[Display extended file metadata as a table]' \ +'--ignore-config[Ignore the configuration file]' \ +'*-1[Display one entry per line]' \ +'*--oneline[Display one entry per line]' \ +'(--tree)*-R[Recurse into directories]' \ +'(--tree)*--recursive[Recurse into directories]' \ +'*-h[For ls compatibility purposes ONLY, currently set by default]' \ +'*--human-readable[For ls compatibility purposes ONLY, currently set by default]' \ +'(-R --recursive)*--tree[Recurse into directories and present the result as a tree]' \ +'(--depth -R --recursive)-d[Display directories themselves, and not their contents (recursively when used with --tree)]' \ +'(--depth -R --recursive)--directory-only[Display directories themselves, and not their contents (recursively when used with --tree)]' \ +'*--total-size[Display the total size of directories]' \ +'*-t[Sort by time modified]' \ +'*--timesort[Sort by time modified]' \ +'*-S[Sort by size]' \ +'*--sizesort[Sort by size]' \ +'*-X[Sort by file extension]' \ +'*--extensionsort[Sort by file extension]' \ +'*-v[Natural sort of (version) numbers within text]' \ +'*--versionsort[Natural sort of (version) numbers within text]' \ +'*-U[Do not sort. List entries in directory order]' \ +'*--no-sort[Do not sort. List entries in directory order]' \ +'*-r[Reverse the order of the sort]' \ +'*--reverse[Reverse the order of the sort]' \ +'--group-directories-first[Groups the directories at the top before the files. Same as --group-dirs=first]' \ +'--classic[Enable classic mode (display output similar to ls)]' \ +'*--no-symlink[Do not display symlink target]' \ +'*-i[Display the index number of each file]' \ +'*--inode[Display the index number of each file]' \ +'*-L[When showing file information for a symbolic link, show information for the file the link references rather than for the link itself]' \ +'*--dereference[When showing file information for a symbolic link, show information for the file the link references rather than for the link itself]' \ +'-Z[Print security context (label) of each file]' \ +'--context[Print security context (label) of each file]' \ +'--header[Display block headers]' \ +'*::FILE:_files' \ +&& ret=0 +} + +(( $+functions[_lsd_commands] )) || +_lsd_commands() { + local commands; commands=() + _describe -t commands 'lsd commands' commands "$@" +} + +_lsd "$@" diff --git a/chezmoi/dot_config/zsh/completions/_rg b/chezmoi/dot_config/zsh/completions/_rg new file mode 100644 index 0000000..a1d7acd --- /dev/null +++ b/chezmoi/dot_config/zsh/completions/_rg @@ -0,0 +1,665 @@ +#compdef rg + +## +# zsh completion function for ripgrep +# +# Run ci/test-complete after building to ensure that the options supported by +# this function stay in synch with the `rg` binary. +# +# For convenience, a completion reference guide is included at the bottom of +# this file. +# +# Originally based on code from the zsh-users project — see copyright notice +# below. + +_rg() { + local curcontext=$curcontext no='!' descr ret=1 + local -a context line state state_descr args tmp suf + local -A opt_args + + # ripgrep has many options which negate the effect of a more common one — for + # example, `--no-column` to negate `--column`, and `--messages` to negate + # `--no-messages`. There are so many of these, and they're so infrequently + # used, that some users will probably find it irritating if they're completed + # indiscriminately, so let's not do that unless either the current prefix + # matches one of those negation options or the user has the `complete-all` + # style set. Note that this prefix check has to be updated manually to account + # for all of the potential negation options listed below! + if + # We also want to list all of these options during testing + [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] || + # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode) + [[ $PREFIX$SUFFIX == --[imnp]* ]] || + zstyle -t ":completion:${curcontext}:" complete-all + then + no= + fi + + # We make heavy use of argument groups here to prevent the option specs from + # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip + # them out below if necessary. This makes the exclusions inaccurate on those + # older versions, but oh well — it's not that big a deal + args=( + + '(exclusive)' # Misc. fully exclusive options + '(: * -)'{-h,--help}'[display help information]' + '(: * -)'{-V,--version}'[display version information]' + '(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]' + + + '(buffered)' # buffering options + '--line-buffered[force line buffering]' + $no"--no-line-buffered[don't force line buffering]" + '--block-buffered[force block buffering]' + $no"--no-block-buffered[don't force block buffering]" + + + '(case)' # Case-sensitivity options + {-i,--ignore-case}'[search case-insensitively]' + {-s,--case-sensitive}'[search case-sensitively]' + {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]' + + + '(context-a)' # Context (after) options + '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines' + + + '(context-b)' # Context (before) options + '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines' + + + '(context-c)' # Context (combined) options + '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines' + + + '(column)' # Column options + '--column[show column numbers for matches]' + $no"--no-column[don't show column numbers for matches]" + + + '(count)' # Counting options + {-c,--count}'[only show count of matching lines for each file]' + '--count-matches[only show count of individual matches for each file]' + '--include-zero[include files with zero matches in summary]' + $no"--no-include-zero[don't include files with zero matches in summary]" + + + '(encoding)' # Encoding options + {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings' + $no'--no-encoding[use default text encoding]' + + + '(engine)' # Engine choice options + '--engine=[select which regex engine to use]:when:(( + default\:"use default engine" + pcre2\:"identical to --pcre2" + auto\:"identical to --auto-hybrid-regex" + ))' + + + file # File-input options + '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files' + + + '(file-match)' # Files with/without match options + '(stats)'{-l,--files-with-matches}'[only show names of files with matches]' + '(stats)--files-without-match[only show names of files without matches]' + + + '(file-name)' # File-name options + {-H,--with-filename}'[show file name for matches]' + {-I,--no-filename}"[don't show file name for matches]" + + + '(file-system)' # File system options + "--one-file-system[don't descend into directories on other file systems]" + $no'--no-one-file-system[descend into directories on other file systems]' + + + '(fixed)' # Fixed-string options + {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]' + $no"--no-fixed-strings[don't treat pattern as literal string]" + + + '(follow)' # Symlink-following options + {-L,--follow}'[follow symlinks]' + $no"--no-follow[don't follow symlinks]" + + + '(generate)' # Options for generating ancillary data + '--generate=[generate man page or completion scripts]:when:(( + man\:"man page" + complete-bash\:"shell completions for bash" + complete-zsh\:"shell completions for zsh" + complete-fish\:"shell completions for fish" + complete-powershell\:"shell completions for PowerShell" + ))' + + + glob # File-glob options + '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob' + '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob' + + + '(glob-case-insensitive)' # File-glob case sensitivity options + '--glob-case-insensitive[treat -g/--glob patterns case insensitively]' + $no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]' + + + '(heading)' # Heading options + '(pretty-vimgrep)--heading[show matches grouped by file name]' + "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]" + + + '(hidden)' # Hidden-file options + {-.,--hidden}'[search hidden files and directories]' + $no"--no-hidden[don't search hidden files and directories]" + + + '(hybrid)' # hybrid regex options + '--auto-hybrid-regex[DEPRECATED: dynamically use PCRE2 if necessary]' + $no"--no-auto-hybrid-regex[DEPRECATED: don't dynamically use PCRE2 if necessary]" + + + '(ignore)' # Ignore-file options + "(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]" + $no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]' + + + '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options + '--ignore-file-case-insensitive[process ignore files case insensitively]' + $no'--no-ignore-file-case-insensitive[process ignore files case sensitively]' + + + '(ignore-exclude)' # Local exclude (ignore)-file options + "--no-ignore-exclude[don't respect local exclude (ignore) files]" + $no'--ignore-exclude[respect local exclude (ignore) files]' + + + '(ignore-global)' # Global ignore-file options + "--no-ignore-global[don't respect global ignore files]" + $no'--ignore-global[respect global ignore files]' + + + '(ignore-parent)' # Parent ignore-file options + "--no-ignore-parent[don't respect ignore files in parent directories]" + $no'--ignore-parent[respect ignore files in parent directories]' + + + '(ignore-vcs)' # VCS ignore-file options + "--no-ignore-vcs[don't respect version control ignore files]" + $no'--ignore-vcs[respect version control ignore files]' + + + '(require-git)' # git specific settings + "--no-require-git[don't require git repository to respect gitignore rules]" + $no'--require-git[require git repository to respect gitignore rules]' + + + '(ignore-dot)' # .ignore options + "--no-ignore-dot[don't respect .ignore files]" + $no'--ignore-dot[respect .ignore files]' + + + '(ignore-files)' # custom global ignore file options + "--no-ignore-files[don't respect --ignore-file flags]" + $no'--ignore-files[respect --ignore-file files]' + + + '(json)' # JSON options + '--json[output results in JSON Lines format]' + $no"--no-json[don't output results in JSON Lines format]" + + + '(line-number)' # Line-number options + {-n,--line-number}'[show line numbers for matches]' + {-N,--no-line-number}"[don't show line numbers for matches]" + + + '(line-terminator)' # Line-terminator options + '--crlf[use CRLF as line terminator]' + $no"--no-crlf[don't use CRLF as line terminator]" + '(text)--null-data[use NUL as line terminator]' + + + '(max-columns-preview)' # max column preview options + '--max-columns-preview[show preview for long lines (with -M)]' + $no"--no-max-columns-preview[don't show preview for long lines (with -M)]" + + + '(max-depth)' # Directory-depth options + {-d,--max-depth}'[specify max number of directories to descend]:number of directories' + '--maxdepth=[alias for --max-depth]:number of directories' + '!--maxdepth=:number of directories' + + + '(messages)' # Error-message options + '(--no-ignore-messages)--no-messages[suppress some error messages]' + $no"--messages[don't suppress error messages affected by --no-messages]" + + + '(messages-ignore)' # Ignore-error message options + "--no-ignore-messages[don't show ignore-file parse error messages]" + $no'--ignore-messages[show ignore-file parse error messages]' + + + '(mmap)' # mmap options + '--mmap[search using memory maps when possible]' + "--no-mmap[don't search using memory maps]" + + + '(multiline)' # Multiline options + {-U,--multiline}'[permit matching across multiple lines]' + $no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]' + + + '(multiline-dotall)' # Multiline DOTALL options + '(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]' + $no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]" + + + '(only)' # Only-match options + {-o,--only-matching}'[show only matching part of each line]' + + + '(passthru)' # Pass-through options + '(--vimgrep)--passthru[show both matching and non-matching lines]' + '(--vimgrep)--passthrough[alias for --passthru]' + + + '(pcre2)' # PCRE2 options + {-P,--pcre2}'[enable matching with PCRE2]' + $no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]' + + + '(pcre2-unicode)' # PCRE2 Unicode options + $no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[DEPRECATED: enable PCRE2 Unicode mode (with -P)]' + '(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[DEPRECATED: disable PCRE2 Unicode mode (with -P)]' + + + '(pre)' # Preprocessing options + '(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e' + $no'--no-pre[disable preprocessor utility]' + + + pre-glob # Preprocessing glob options + '*--pre-glob[include/exclude files for preprocessing with --pre]' + + + '(pretty-vimgrep)' # Pretty/vimgrep display options + '(heading)'{-p,--pretty}'[alias for --color=always --heading -n]' + '(heading passthru)--vimgrep[show results in vim-compatible format]' + + + regexp # Explicit pattern options + '(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern' + + + '(replace)' # Replacement options + {-r+,--replace=}'[specify string used to replace matches]:replace string' + + + '(sort)' # File-sorting options + '(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:(( + none\:"no sorting" + path\:"sort by file path" + modified\:"sort by last modified time" + accessed\:"sort by last accessed time" + created\:"sort by creation time" + ))' + '(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:(( + none\:"no sorting" + path\:"sort by file path" + modified\:"sort by last modified time" + accessed\:"sort by last accessed time" + created\:"sort by creation time" + ))' + '(threads)--sort-files[DEPRECATED: sort results by file path (disables parallelism)]' + $no"--no-sort-files[DEPRECATED: do not sort results]" + + + '(stats)' # Statistics options + '(--files file-match)--stats[show search statistics]' + $no"--no-stats[don't show search statistics]" + + + '(text)' # Binary-search options + {-a,--text}'[search binary files as if they were text]' + "--binary[search binary files, don't print binary data]" + $no"--no-binary[don't search binary files]" + $no"(--null-data)--no-text[don't search binary files as if they were text]" + + + '(threads)' # Thread-count options + '(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads' + + + '(trim)' # Trim options + '--trim[trim any ASCII whitespace prefix from each line]' + $no"--no-trim[don't trim ASCII whitespace prefix from each line]" + + + type # Type options + '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types' + '*--type-add=[add new glob for specified file type]: :->typespec' + '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types' + # This should actually be exclusive with everything but other type options + '(: *)--type-list[show all supported file types and their associated globs]' + '*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types" + + + '(word-line)' # Whole-word/line match options + {-w,--word-regexp}'[only show matches surrounded by word boundaries]' + {-x,--line-regexp}'[only show matches surrounded by line boundaries]' + + + '(unicode)' # Unicode options + $no'--unicode[enable Unicode mode]' + '--no-unicode[disable Unicode mode]' + + + '(zip)' # Compression options + '(--pre)'{-z,--search-zip}'[search in compressed files]' + $no"--no-search-zip[don't search in compressed files]" + + + misc # Other options — no need to separate these at the moment + '(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]' + $no"--no-byte-offset[don't show byte offsets for each matching line]" + '--color=[specify when to use colors in output]:when:(( + never\:"never use colors" + auto\:"use colors or not based on stdout, TERM, etc." + always\:"always use colors" + ansi\:"always use ANSI colors (even on Windows)" + ))' + '*--colors=[specify color and style settings]: :->colorspec' + '--context-separator=[specify string used to separate non-continuous context lines in output]:separator' + $no"--no-context-separator[don't print context separators]" + '--debug[show debug messages]' + '--field-context-separator[set string to delimit fields in context lines]' + '--field-match-separator[set string to delimit fields in matching lines]' + '--hostname-bin=[executable for getting system hostname]:hostname executable:_command_names -e' + '--hyperlink-format=[specify pattern for hyperlinks]:pattern' + '--trace[show more verbose debug messages]' + '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)' + "(1 stats)--files[show each file that would be searched (but don't search)]" + '*--ignore-file=[specify additional ignore file]:ignore file:_files' + '(-v --invert-match)'{-v,--invert-match}'[invert matching]' + $no"--no-invert-match[do not invert matching]" + '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes' + '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches' + '--max-filesize=[specify size above which files should be ignored]:file size (bytes)' + "--no-config[don't load configuration files]" + '(-0 --null)'{-0,--null}'[print NUL byte after file names]' + '--path-separator=[specify path separator to use when printing file names]:separator' + '(-q --quiet)'{-q,--quiet}'[suppress normal output]' + '--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)' + '*'{-u,--unrestricted}'[reduce level of "smart" searching]' + '--stop-on-nonmatch[stop on first non-matching line after a matching one]' + + + operand # Operands + '(--files --type-list file regexp)1: :_guard "^-*" pattern' + '(--type-list)*: :_files' + ) + + # This is used with test-complete to verify that there are no options + # listed in the help output that aren't also defined here + [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && { + print -rl - $args + return 0 + } + + # Strip out argument groups where unsupported (see above) + [[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] && + args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} ) + + _arguments -C -s -S : $args && ret=0 + + case $state in + colorspec) + if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then + suf=( -qS: ) + tmp=( + 'column:specify coloring for column numbers' + 'line:specify coloring for line numbers' + 'match:specify coloring for match text' + 'path:specify coloring for file names' + ) + descr='color/style type' + elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then + suf=( -qS: ) + tmp=( + 'none:clear color/style for type' + 'bg:specify background color' + 'fg:specify foreground color' + 'style:specify text style' + ) + descr='color/style attribute' + elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then + tmp=( black blue green red cyan magenta yellow white ) + descr='color name or r,g,b' + elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then + tmp=( {,no}bold {,no}intense {,no}underline ) + descr='style name' + else + _message -e colorspec 'no more arguments' + fi + + (( $#tmp )) && { + compset -P '*:' + _describe -t colorspec $descr tmp $suf && ret=0 + } + ;; + + typespec) + if compset -P '[^:]##:include:'; then + _sequence -s , _rg_types && ret=0 + # @todo This bit in particular could be better, but it's a little + # complex, and attempting to solve it seems to run us up against a crash + # bug — zsh # 40362 + elif compset -P '[^:]##:'; then + _message 'glob or include directive' && ret=1 + elif [[ ! -prefix *:* ]]; then + _rg_types -qS : && ret=0 + fi + ;; + esac + + return ret +} + +# Complete encodings +_rg_encodings() { + local -a expl + local -aU _encodings + + _encodings=( +# This is impossible to read, but these encodings rarely if ever change, so +# it probably does not matter. They are derived from the list given here: +# https://encoding.spec.whatwg.org/#concept-encoding-get +# +# The globbing here works in both fish and zsh (though they expand it in +# different orders). It may work in other shells too. + +{{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean} +logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian} +866 ibm{819,866} csibm866 +big5{,-hkscs} {cn-,cs}big5 x-x-big5 +cp{819,866,125{0,1,2,3,4,5,6,7,8}} x-cp125{0,1,2,3,4,5,6,7,8} +csiso2022{jp,kr} csiso8859{6,8}{e,i} +csisolatin{1,2,3,4,5,6,9} csisolatin{arabic,cyrillic,greek,hebrew} +ecma-{114,118} asmo-708 elot_928 sun_eu_greek +euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese +{,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312 +iso-2022-{cn,cn-ext,jp,kr} +iso8859{,-}{1,2,3,4,5,6,7,8,9,10,11,13,14,15} +iso-8859-{1,2,3,4,5,6,7,8,9,10,11,{6,8}-{e,i},13,14,15,16} iso_8859-{1,2,3,4,5,6,7,8,9,15} +iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989 +iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157} +koi{,8,8-r,8-ru,8-u,8_r} cskoi8r +ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987 +latin{1,2,3,4,5,6} l{1,2,3,4,5,6,9} +shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932 +utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8 +windows-{31j,874,949,125{0,1,2,3,4,5,6,7,8}} dos-874 tis-620 ansi_x3.4-1968 +x-user-defined auto none + ) + + _wanted encodings expl encoding compadd -a "$@" - _encodings +} + +# Complete file types +_rg_types() { + local -a expl + local -aU _types + + _types=( ${(@)${(f)"$( _call_program types $words[1] --type-list )"}//:[[:space:]]##/:} ) + + if zstyle -t ":completion:${curcontext}:types" extra-verbose; then + _describe -t types 'file type' _types + else + _wanted types expl 'file type' compadd "$@" - ${(@)_types%%:*} + fi +} + +_rg "$@" + +################################################################################ +# ZSH COMPLETION REFERENCE +# +# For the convenience of developers who aren't especially familiar with zsh +# completion functions, a brief reference guide follows. This is in no way +# comprehensive; it covers just enough of the basic structure, syntax, and +# conventions to help someone make simple changes like adding new options. For +# more complete documentation regarding zsh completion functions, please see the +# following: +# +# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html +# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide +# +# OVERVIEW +# +# Most zsh completion functions are defined in terms of `_arguments`, which is a +# shell function that takes a series of argument specifications. The specs for +# `rg` are stored in an array, which is common for more complex functions; the +# elements of the array are passed to `_arguments` on invocation. +# +# ARGUMENT-SPECIFICATION SYNTAX +# +# The following is a contrived example of the argument specs for a simple tool: +# +# '(: * -)'{-h,--help}'[display help information]' +# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]' +# '!(-q -v --quiet --verbose)--silent' +# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]' +# '--color=[specify when to use colors]:when:(always never auto)' +# '*:example file:_files' +# +# Although there may appear to be six specs here, there are actually nine; we +# use brace expansion to combine specs for options that go by multiple names, +# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh +# merges completion possibilities together when they have the same description. +# +# The first line defines the option `-h`/`--help`. With most tools, it isn't +# useful to complete anything after `--help` because it effectively overrides +# all others; the `(: * -)` at the beginning of the spec tells zsh not to +# complete any other operands (`:` and `*`) or options (`-`) after this one has +# been used. The `[...]` at the end associates a description with `-h`/`--help`; +# as mentioned, zsh will see the identical descriptions and merge these options +# together when offering completion possibilities. +# +# The next line defines `-q`/`--quiet`. Here we don't want to suppress further +# completions entirely, but we don't want to offer `-q` if `--quiet` has been +# given (since they do the same thing), nor do we want to offer `-v` (since it +# doesn't make sense to be quiet and verbose at the same time). We don't need to +# tell zsh not to offer `--quiet` a second time, since that's the default +# behaviour, but since this line expands to two specs describing `-q` *and* +# `--quiet` we do need to explicitly list all of them here. +# +# The next line defines a hidden option `--silent` — maybe it's a deprecated +# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this +# option during completion. The benefit of providing a spec for an option that +# shouldn't be completed is that, if someone *does* use it, we can correctly +# suppress completion of other options afterwards. +# +# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`. +# +# The next line defines `--color`. In this example, `--color` doesn't have a +# corresponding short option, so we don't need to use brace expansion. Further, +# there are no other options it's exclusive with (just itself), so we don't need +# to define those at the beginning. However, it does take a mandatory argument. +# The `=` at the end of `--color=` indicates that the argument may appear either +# like `--color always` or like `--color=always`; this is how most GNU-style +# command-line tools work. The corresponding short option would normally use `+` +# — for example, `-c+` would allow either `-c always` or `-calways`. For this +# option, the arguments are known ahead of time, so we can simply list them in +# parentheses at the end (`when` is used as the description for the argument). +# +# The last line defines an operand (a non-option argument). In this example, the +# operand can be used any number of times (the leading `*`), and it should be a +# file path, so we tell zsh to call the `_files` function to complete it. The +# `example file` in the middle is the description to use for this operand; we +# could use a space instead to accept the default provided by `_files`. +# +# GROUPING ARGUMENT SPECIFICATIONS +# +# Newer versions of zsh support grouping argument specs together. All specs +# following a `+` and then a group name are considered to be members of the +# named group. Grouping is useful mostly for organisational purposes; it makes +# the relationship between different options more obvious, and makes it easier +# to specify exclusions. +# +# We could rewrite our example above using grouping as follows: +# +# '(: * -)'{-h,--help}'[display help information]' +# '--color=[specify when to use colors]:when:(always never auto)' +# '*:example file:_files' +# + '(verbosity)' +# {-q,--quiet}'[decrease output verbosity]' +# '!--silent' +# {-v,--verbose}'[increase output verbosity]' +# +# Here we take advantage of a useful feature of spec grouping — when the group +# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all +# of the options in that group are exclusive with each other. As a result, we +# don't need to manually list out the exclusions at the beginning of each +# option. +# +# Groups can also be referred to by name in other argument specs; for example: +# +# '(xyz)--aaa' '*: :_files' +# + xyz --xxx --yyy --zzz +# +# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and +# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list +# much more compact and reusable. +# +# CONVENTIONS +# +# zsh completion functions generally adhere to the following conventions: +# +# * Use two spaces for indentation +# * Combine specs for options with different names using brace expansion +# * In combined specs, list the short option first (as in `{-a,--text}`) +# * Use `+` or `=` as described above for options that take arguments +# * Provide a description for all options, option-arguments, and operands +# * Capitalise/punctuate argument descriptions as phrases, not complete +# sentences — 'display help information', never 'Display help information.' +# (but still capitalise acronyms and proper names) +# * Write argument descriptions as verb phrases — 'display x', 'enable y', +# 'use z' +# * Word descriptions to make it clear when an option expects an argument; +# usually this is done with the word 'specify', as in 'specify x' or +# 'use specified x') +# * Write argument descriptions as tersely as possible — for example, articles +# like 'a' and 'the' should be omitted unless it would be confusing +# +# Other conventions currently used by this function: +# +# * Order argument specs alphabetically by group name, then option name +# * Group options that are directly related, mutually exclusive, or frequently +# referenced by other argument specs +# * Use only characters in the set [a-z0-9_-] in group names +# * Order exclusion lists as follows: short options, long options, groups +# * Use American English in descriptions +# * Use 'don't' in descriptions instead of 'do not' +# * Word descriptions for related options as similarly as possible. For example, +# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and +# `--no-foo[don't use foo]` +# * Word descriptions to make it clear when an option only makes sense with +# another option, usually by adding '(with -x)' to the end +# * Don't quote strings or variables unnecessarily. When quotes are required, +# prefer single-quotes to double-quotes +# * Prefix option specs with `$no` when the option serves only to negate the +# behaviour of another option that must be provided explicitly by the user. +# This prevents rarely used options from cluttering up the completion menu +################################################################################ + +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for ripgrep +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * arcizan +# * MaskRay +# +# ------------------------------------------------------------------------------ + +# Local Variables: +# mode: shell-script +# coding: utf-8-unix +# indent-tabs-mode: nil +# sh-indentation: 2 +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/chezmoi/dot_config/zsh/functions/fedora.zsh b/chezmoi/dot_config/zsh/functions/fedora.zsh new file mode 100644 index 0000000..bad34af --- /dev/null +++ b/chezmoi/dot_config/zsh/functions/fedora.zsh @@ -0,0 +1,32 @@ +dnf-save-install() { + file="$DOTS/exports/dnf.txt" + echo "$*" >> "$file" + sort -u -o "$file" "$file" + sudo dnf install -y $(cat "$DOTS/exports/dnf.txt") +} + +dnf-load-export() { + while read -r line; do + sudo dnf copr enable -y "$line" + done <"$DOTS/exports/copr.txt" + + sudo dnf install -y $(cat "$DOTS/exports/dnf.txt") +} + +upgrade() { + sudo dnf upgrade --refresh -y +} + +# where did I get this? +mayor-upgrade() { + if [[ $(dnf check-update -q) ]]; then + echo "There are updates pending, update and reboot? [y/N]" + read -r answer + + if [[ $answer == 'y' || $answer == 'Y' ]]; then + upgrade + sc-reboot + + fi + fi +} diff --git a/chezmoi/dot_config/zsh/functions/functions.zsh b/chezmoi/dot_config/zsh/functions/functions.zsh new file mode 100644 index 0000000..97254f3 --- /dev/null +++ b/chezmoi/dot_config/zsh/functions/functions.zsh @@ -0,0 +1,68 @@ +# SSH tunnel +ssh-tunnel() { + + local_port=$1 && shift + remote_port=$1 && shift + server=$1 && shift + + echo "Starting SSH Tunnel for $server" + + ssh -N -L "$local_port":localhost:"$remote_port" "$server" +} + +# quick wordpress in docker +dwps() { + image_name="wordpress-development" + container_build_path="$HOME/Repos/Private/docker-services/wordpress" + original_path="$PWD" + + if [[ "$(docker images -q $image_name 2>/dev/null)" == "" ]]; then + cd "$container_build_path" + docker build --tag "$image_name" . + cd "$original_path" + fi + + docker run -d --rm -p 3000:80 --user 1000:1000 -v "$PWD":/var/www/html --name "$image_name" "$image_name" +} + +## Create python venv +pvenv() { + [[ -n $VIRTAUL_ENV ]] && echo "Virtual enviroment already sourced" && return + + dir=${1:-venv} + + [[ ! -d $dir ]] && echo "Creating virtual enviroment..." && python -m venv $dir + + source "$dir/bin/activate" +} + +# Print bottlenecks +profzsh() { + shell=${1-$SHELL} + ZPROF=true $shell -i -c exit +} + +# Pretty Help +alias bathelp='bat --plain --language=help' +help() { + "$@" --help 2>&1 | bathelp +} + +fzf-jq() { + echo '' | fzf --print-query --preview="jq -r {q} <$@" +} + +function ya() { + local tmp="$(mktemp -t "yazi-cwd.XXXXX")" + yazi "$@" --cwd-file="$tmp" + if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + cd -- "$cwd" + fi + rm -f -- "$tmp" +} + +# Zellij +function zr() { zellij run --name "$*" -- zsh -ic "$*"; } +function zrf() { zellij run --name "$*" --floating -- zsh -ic "$*"; } +function ze() { zellij edit "$*"; } +function zef() { zellij edit --floating "$*"; } diff --git a/chezmoi/executable_dot_zprofile.tmpl b/chezmoi/executable_dot_zprofile.tmpl new file mode 100644 index 0000000..325dd44 --- /dev/null +++ b/chezmoi/executable_dot_zprofile.tmpl @@ -0,0 +1,32 @@ +#!/usr/bin/zsh + +update_path() { + export PATH="$PATH:$1" +} + +# Set manually +export DOTS="$(dirname $(chezmoi source-path))" +export EDITOR=nvim +export VISUAL="$EDITOR" + +# Dev Stuff +export NPM_PACKAGES="$HOME/.npm-packages" +export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}" +export PNPM_HOME="$HOME/.local/share/pnpm" +export ESLINT_USE_FLAT_CONFIG=true +. "$HOME/.cargo/env" + +# Unset manpath so we can inherit from /etc/manpath via the `manpath` +# command +unset MANPATH # delete if you already modified MANPATH elsewhere in your config +export MANPATH="$NPM_PACKAGES/share/man:$(manpath)" + +# PATH +update_path "/usr/local/bin" +update_path "$HOME/.local/bin" +update_path "$HOME/.cargo/bin/" +update_path "$DOTS/scripts" +update_path "$HOME/bin" +update_path "$NPM_PACKAGES/bin" +update_path "$PNPM_HOME" +update_path "$HOME/.local/share/rtx/shims" diff --git a/chezmoi/executable_dot_zshrc b/chezmoi/executable_dot_zshrc new file mode 100644 index 0000000..503d5c8 --- /dev/null +++ b/chezmoi/executable_dot_zshrc @@ -0,0 +1,142 @@ + +# ╭──────────────────────────────────────────────────────────╮ +# │ ZSH Config │ +# ╰──────────────────────────────────────────────────────────╯ + +# ╭──────────────────────────────────────────────────────────╮ +# │ Preoload stuff │ +# ╰──────────────────────────────────────────────────────────╯ +# Set the directory we want to store zinit and plugins +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit" + +# Source/Load zinit, installation is handle by chezmoi external script +source "${ZINIT_HOME}/zinit.zsh" + +# source catppuccin theme for zsh-syntax-highlighting +zinit snippet "https://raw.githubusercontent.com/catppuccin/zsh-syntax-highlighting/main/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh" + +# ╭──────────────────────────────────────────────────────────╮ +# │ ZSH plugins │ +# ╰──────────────────────────────────────────────────────────╯ + +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light zsh-users/zsh-autosuggestions +zinit light Aloxaf/fzf-tab + +# ╭──────────────────────────────────────────────────────────╮ +# │ Oh My Zsh snippets │ +# ╰──────────────────────────────────────────────────────────╯ +zinit ice as"completion"; zinit snippet "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd" +zinit ice as"completion"; zinit snippet OMZP::gh + +# svn is deprecated, zinit is working in replacing in favor of git: https://github.com/zdharma-continuum/zinit/issues/504 +# In the meantime, this plugins will not work +# zinit ice svn; zinit snippet OMZ::plugins/aliases +# zinit ice svn; zinit snippet OMZ::plugins/rust + +zinit snippet OMZP::alias-finder +zinit snippet OMZP::colored-man-pages +zinit snippet OMZP::dnf +zinit snippet OMZP::docker +zinit snippet OMZP::docker-compose +zinit snippet OMZP::git +zinit snippet OMZP::systemd + + +# ╭──────────────────────────────────────────────────────────╮ +# │ Plugins options │ +# ╰──────────────────────────────────────────────────────────╯ +zstyle ':completion:*:*:docker:*' option-stacking yes +zstyle ':completion:*:*:docker-*:*' option-stacking yes + +# ╭──────────────────────────────────────────────────────────╮ +# │ Load completions │ +# ╰──────────────────────────────────────────────────────────╯ +# Custom completions +fpath+=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions +autoload -Uz ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions/* + +autoload -Uz compinit && compinit +zinit cdreplay -q + +# ╭──────────────────────────────────────────────────────────╮ +# │ Keybindings │ +# ╰──────────────────────────────────────────────────────────╯ +bindkey -e +bindkey '^f' auto-suggest-accept +bindkey '^p' history-search-backward +bindkey '^n' history-search-forward +bindkey '^[w' kill-region + +# Set VIM keybindings +bindkey -v +export KEYTIMEOUT=1 +autoload -Uz edit-command-line +zle -N edit-command-line +bindkey -M vicmd V edit-command-line # Edits files in vim, hit Shift+v in normal mode + +# Add vim text objects +autoload -Uz select-bracketed select-quoted +zle -N select-quoted +zle -N select-bracketed +for km in viopp visual; do + bindkey -M $km -- '-' vi-up-line-or-history + for c in {a,i}${(s..)^:-\'\"\`\|,./:;=+@}; do + bindkey -M $km $c select-quoted + done + for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do + bindkey -M $km $c select-bracketed + done +done + +# ╭──────────────────────────────────────────────────────────╮ +# │ History │ +# ╰──────────────────────────────────────────────────────────╯ +HISTSIZE=5000 +HISTFILE=~/.zsh_history +SAVEHIST=$HISTSIZE +HISTDUP=erase +setopt appendhistory +setopt sharehistory +setopt hist_ignore_space +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt hist_ignore_dups +setopt hist_find_no_dups + +# ╭──────────────────────────────────────────────────────────╮ +# │ Completion styling │ +# ╰──────────────────────────────────────────────────────────╯ +# case insensitive completion +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" +zstyle ':completion:*' menu no +zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' +zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' + + +# ╭──────────────────────────────────────────────────────────╮ +# │ ZSH Options │ +# ╰──────────────────────────────────────────────────────────╯ +setopt EXTENDED_GLOB +setopt DOT_GLOB +setopt GLOB_DOTS + +# ╭──────────────────────────────────────────────────────────╮ +# │ Source other files │ +# ╰──────────────────────────────────────────────────────────╯ +source $HOME/.config/fzf/fzfrc + +# this prevents errors and not loading some files +for file in $HOME/.config/zsh/**/*.zsh; do + source $file +done + +# ╭──────────────────────────────────────────────────────────╮ +# │ Init external programs │ +# ╰──────────────────────────────────────────────────────────╯ +eval "$(fzf --zsh)" +eval "$(zoxide init --cmd cd zsh)" +eval "$(starship init zsh)" +eval "$(mise activate zsh)"