From d870d23e797ee2bac2fc86706124b8666f597518 Mon Sep 17 00:00:00 2001 From: aleidk Date: Tue, 26 Mar 2024 13:14:48 -0300 Subject: [PATCH] add nvim plugins Added: - flash.nvim for better movement - debugprint.nvim for insert print debug statements --- .../dot_config/nvim/lua/aleidk/keymaps.lua | 14 +++--- .../nvim/lua/aleidk/plugins/debugprint.lua | 7 +++ .../nvim/lua/aleidk/plugins/flash.lua | 25 ++++++++++ .../nvim/lua/aleidk/plugins/surround.lua | 1 + .../dot_config/nvim/original_lazy-lock.json | 2 + .../dot_config/zsh/functions/functions.zsh | 50 +++++++++++-------- chezmoi/executable_dot_zshrc | 4 +- 7 files changed, 72 insertions(+), 31 deletions(-) create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/debugprint.lua create mode 100644 chezmoi/dot_config/nvim/lua/aleidk/plugins/flash.lua diff --git a/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua b/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua index 36f220d..29b50aa 100644 --- a/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua +++ b/chezmoi/dot_config/nvim/lua/aleidk/keymaps.lua @@ -11,7 +11,7 @@ local function default(desc) } end -local function fixIdentation() +local function fixIndentation() local indent = 2 vim.opt.tabstop = indent vim.opt.shiftwidth = indent @@ -24,7 +24,7 @@ end -- See `:help vim.keymap.set()` vim.keymap.set({ "n", "v" }, "", "", { silent = true }) -vim.keymap.set("n", "", "w", default("Keep cursor centered while junping")) +-- 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 }) @@ -50,14 +50,14 @@ vim.keymap.set( 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("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 whitout lossing yanked text")) +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", fixIdentation, default("Fix identation")) +vim.keymap.set("n", "uI", fixIndentation, default("Fix indentation")) vim.keymap.set("n", "uh", ":nohl", default("Remove search highlight")) diff --git a/chezmoi/dot_config/nvim/lua/aleidk/plugins/debugprint.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/debugprint.lua new file mode 100644 index 0000000..757dbb1 --- /dev/null +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/debugprint.lua @@ -0,0 +1,7 @@ +return { + "andrewferrier/debugprint.nvim", + opts = {}, + -- Remove the following line to use development versions, + -- not just the formal releases + version = "*", +} 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/surround.lua b/chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua index 977d689..2cbb1d3 100644 --- a/chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua +++ b/chezmoi/dot_config/nvim/lua/aleidk/plugins/surround.lua @@ -1,5 +1,6 @@ return { "echasnovski/mini.surround", + disabled = true, version = "*", opts = {}, } diff --git a/chezmoi/dot_config/nvim/original_lazy-lock.json b/chezmoi/dot_config/nvim/original_lazy-lock.json index b8506ef..976323e 100644 --- a/chezmoi/dot_config/nvim/original_lazy-lock.json +++ b/chezmoi/dot_config/nvim/original_lazy-lock.json @@ -15,8 +15,10 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "comment-box.nvim": { "branch": "main", "commit": "dd1a48f8d06102e9b87ae1e0069bc365c006979b" }, "conform.nvim": { "branch": "master", "commit": "e4ecb6e8ed3163c86d7e647f1dc3d94de77ca687" }, + "debugprint.nvim": { "branch": "main", "commit": "159c7522438c6cf53540fb588fcf5bdad692d1bc" }, "diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" }, "dressing.nvim": { "branch": "master", "commit": "1f2d1206a03bd3add8aedf6251e4534611de577f" }, + "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "gitsigns.nvim": { "branch": "main", "commit": "5a9a6ac29a7805c4783cda21b80a1e361964b3f2" }, "indent-blankline.nvim": { "branch": "master", "commit": "046e2cf04e08ece927bacbfb87c5b35c0b636546" }, diff --git a/chezmoi/dot_config/zsh/functions/functions.zsh b/chezmoi/dot_config/zsh/functions/functions.zsh index dd55fb6..97254f3 100644 --- a/chezmoi/dot_config/zsh/functions/functions.zsh +++ b/chezmoi/dot_config/zsh/functions/functions.zsh @@ -1,55 +1,55 @@ # SSH tunnel ssh-tunnel() { - local_port=$1 && shift - remote_port=$1 && shift - server=$1 && shift + local_port=$1 && shift + remote_port=$1 && shift + server=$1 && shift - echo "Starting SSH Tunnel for $server" + echo "Starting SSH Tunnel for $server" - ssh -N -L "$local_port":localhost:"$remote_port" "$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" + 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 + 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" + 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 + [[ -n $VIRTAUL_ENV ]] && echo "Virtual enviroment already sourced" && return - dir=${1:-venv} + dir=${1:-venv} - [[ ! -d $dir ]] && echo "Creating virtual enviroment..." && python -m venv $dir + [[ ! -d $dir ]] && echo "Creating virtual enviroment..." && python -m venv $dir - source "$dir/bin/activate" + source "$dir/bin/activate" } # Print bottlenecks profzsh() { - shell=${1-$SHELL} - ZPROF=true $shell -i -c exit + shell=${1-$SHELL} + ZPROF=true $shell -i -c exit } # Pretty Help alias bathelp='bat --plain --language=help' help() { - "$@" --help 2>&1 | bathelp + "$@" --help 2>&1 | bathelp } fzf-jq() { - echo '' | fzf --print-query --preview="jq -r {q} <$@" + echo '' | fzf --print-query --preview="jq -r {q} <$@" } function ya() { @@ -60,3 +60,9 @@ function ya() { 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_zshrc b/chezmoi/executable_dot_zshrc index 86b60d0..1b685e1 100644 --- a/chezmoi/executable_dot_zshrc +++ b/chezmoi/executable_dot_zshrc @@ -48,7 +48,8 @@ setopt GLOB_COMPLETE # Show autocompletion menu with globs setopt MENU_COMPLETE # Automatically highlight first element of completion menu # fpath+=${ZSH_CUSTOM:-${ZSH:-$XDG_DATA_HOME/oh-my-zsh}/custom}/plugins/zsh-completions/src -fpath+=${XDG_CONFIG_HOME:-$DOTS/config}/zsh/completions +fpath+=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions +autoload -Uz ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions/* zstyle ':completion:*:descriptions' format '%U%B%d%b%u' zstyle ':completion:*:warnings' format '%F{cyan}%BSorry, no matches for: %d%b%f' @@ -108,7 +109,6 @@ if [[ "$ZPROF" = true ]]; then fi eval "$(starship init zsh)" -# eval "$(zellij setup --generate-auto-start zsh)" eval "$(zoxide init zsh)" eval "$(mise activate zsh)"