commit 31eddd19e0937a26d3e2a67b901ccf0feadf255a Author: Baerspektivo Date: Tue Oct 29 12:47:40 2024 +0100 inital commit diff --git a/.zsh/aliases.zsh b/.zsh/aliases.zsh new file mode 100644 index 0000000..af57b93 --- /dev/null +++ b/.zsh/aliases.zsh @@ -0,0 +1,19 @@ +# Alias +# --- +# +# mac OS shortcuts +alias code="open -a 'Visual Studio Code'" +alias kubi="open -a 'Lens'" + + +# ALIAS COMMANDS +alias ld="ls -lisaGh" +alias g="goto" +alias grep='grep --color' +alias vim=nvim +alias update-system="brew update && brew upgrade && npm update -g" +alias do-st="docker compose" +alias do-re="docker compose down && docker compose up -d" +alias hetzi="ssh root@128.140.71.88" +alias kc1='export KUBECONFIG=~/.kube/config' +alias kc2='export KUBECONFIG=~/.kube/mobilistics' diff --git a/.zsh/functions.zsh b/.zsh/functions.zsh new file mode 100644 index 0000000..da72dc7 --- /dev/null +++ b/.zsh/functions.zsh @@ -0,0 +1,4 @@ +# Colormap +function colormap() { + for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done +} \ No newline at end of file diff --git a/.zsh/goto.zsh b/.zsh/goto.zsh new file mode 100644 index 0000000..efde85a --- /dev/null +++ b/.zsh/goto.zsh @@ -0,0 +1,4 @@ +autoload -Uz compinit +compinit + +source $(brew --prefix)/etc/bash_completion.d/goto.sh \ No newline at end of file diff --git a/.zsh/kubernetes.zsh b/.zsh/kubernetes.zsh new file mode 100644 index 0000000..5fce146 --- /dev/null +++ b/.zsh/kubernetes.zsh @@ -0,0 +1,2 @@ +export KUBECONFIG=~/.kube/config +export KUBECONFIG=~/.kube/mobilistics diff --git a/.zsh/nvm.zsh b/.zsh/nvm.zsh new file mode 100644 index 0000000..26d63b1 --- /dev/null +++ b/.zsh/nvm.zsh @@ -0,0 +1,25 @@ +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +# Automatisches Laden der Node.js-Version +autoload -U add-zsh-hook +load-nvmrc() { + local node_version="$(nvm version)" + local nvmrc_path="$(nvm_find_nvmrc)" + + if [ -n "$nvmrc_path" ]; then + local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") + + if [ "$nvmrc_node_version" = "N/A" ]; then + nvm install + elif [ "$nvmrc_node_version" != "$node_version" ]; then + nvm use + fi + elif [ "$node_version" != "$(nvm version default)" ]; then + echo "Reverting to nvm default version" + nvm use default + fi +} +add-zsh-hook chpwd load-nvmrc +load-nvmrc diff --git a/.zsh/ohmyzsh.zsh b/.zsh/ohmyzsh.zsh new file mode 100644 index 0000000..7d07faf --- /dev/null +++ b/.zsh/ohmyzsh.zsh @@ -0,0 +1,12 @@ +#Confi +export ZSH="$HOME/.oh-my-zsh" + +#Theme +ZSH_THEME="bira" + +#plugins +plugins=(git kubectl docker npm pip sudo macos zsh-autosuggestions command-not-found zsh-syntax-highlighting 1password) + +#Source +source $ZSH/oh-my-zsh.sh + diff --git a/.zsh/pnpm.zsh b/.zsh/pnpm.zsh new file mode 100644 index 0000000..87aa6c3 --- /dev/null +++ b/.zsh/pnpm.zsh @@ -0,0 +1,7 @@ +# pnpm +export PNPM_HOME="/Users/r.kallinich/.nvm/versions/node/v20.15.0/bin" +case ":$PATH:" in + *":$PNPM_HOME:"*) ;; + *) export PATH="$PNPM_HOME:$PATH" ;; +esac +# pnpm end diff --git a/.zsh/ssh.zsh b/.zsh/ssh.zsh new file mode 100644 index 0000000..a2ba90f --- /dev/null +++ b/.zsh/ssh.zsh @@ -0,0 +1,9 @@ +export "GPG_TTY=$(tty)" +export "SSH_AUTH_SOCK=${HOME}/.gnupg/S.gpg-agent.ssh" + +gpgconf --launch gpg-agent + +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then +export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi diff --git a/.zsh/starship.zsh b/.zsh/starship.zsh new file mode 100644 index 0000000..1445171 --- /dev/null +++ b/.zsh/starship.zsh @@ -0,0 +1,47 @@ +# find out which distribution we are running on +LFILE="/etc/*-release" +MFILE="/System/Library/CoreServices/SystemVersion.plist" +if [[ -f $LFILE ]]; then + _distro=$(awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }') +elif [[ -f $MFILE ]]; then + _distro="macos" + + # on mac os use the systemprofiler to determine the current model + _device=$(system_profiler SPHardwareDataType | awk '/Model Name/ {print $3,$4,$5,$6,$7}') + + case $_device in + *MacBook*) DEVICE="";; + *) DEVICE="";; + esac +fi + +# set an icon based on the distro +# make sure your font is compatible with https://github.com/lukas-w/font-logos +case $_distro in + *kali*) ICON="ﴣ";; + *arch*) ICON="";; + *debian*) ICON="";; + *raspbian*) ICON="";; + *ubuntu*) ICON="";; + *elementary*) ICON="";; + *fedora*) ICON="";; + *coreos*) ICON="";; + *gentoo*) ICON="";; + *mageia*) ICON="";; + *centos*) ICON="";; + *opensuse*|*tumbleweed*) ICON="";; + *sabayon*) ICON="";; + *slackware*) ICON="";; + *linuxmint*) ICON="";; + *alpine*) ICON="";; + *aosc*) ICON="";; + *nixos*) ICON="";; + *devuan*) ICON="";; + *manjaro*) ICON="";; + *rhel*) ICON="";; + *macos*) ICON="";; + *) ICON="";; +esac + +export STARSHIP_DISTRO="$ICON" +export STARSHIP_DEVICE="$DEVICE" \ No newline at end of file diff --git a/.zsh/zoxide.zsh b/.zsh/zoxide.zsh new file mode 100644 index 0000000..b420ac3 --- /dev/null +++ b/.zsh/zoxide.zsh @@ -0,0 +1 @@ +eval "$(zoxide init --cmd cd zsh)" diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..352b49d --- /dev/null +++ b/.zshrc @@ -0,0 +1,19 @@ +export PATH="/opt/homebrew/bin:$PATH" +export PATH="$HOME/.cargo/bin:$PATH" + +# config +PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" +export PATH +[[ -f ~/.zsh/goto.zsh ]] && source ~/.zsh/goto.zsh +[[ -f ~/.zsh/nvm.zsh ]] && source ~/.zsh/nvm.zsh +[[ -f ~/.zsh/pnpm.zsh ]] && source ~/.zsh/pnpm.zsh +[[ -f ~/.zsh/zoxide.zsh ]] && source ~/.zsh/zoxide.zsh +[[ -f ~/.zsh/aliases.zsh ]] && source ~/.zsh/aliases.zsh +[[ -f ~/.zsh/ssh.zsh ]] && source ~/.zsh/ssh.zsh +[[ -f ~/.zsh/ohmyzsh.zsh ]] && source ~/.zsh/ohmyzsh.zsh +[[ -f ~/.zsh/kubernetes.zsh ]] && source ~/.zsh/kubernetes.zsh +#export PATH="$HOME/.cargo/bin:$PATH" eval "$(starship init zsh)" + + +#loading neofetch +neofetch diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..60bab50 --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,54 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Docs: https://www.lazyvim.org/configuration/general +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here + +local function find_python_executable() + if vim.env.VIRTUAL_ENV then + local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/bin/python", true, true) + local executable_path = table.concat(paths, ", ") + if executable_path ~= "" then + vim.api.nvim_echo({ { "Using path for python: " .. executable_path, "None" } }, false, {}) + return executable_path + end + elseif vim.fn.filereadable(".venv/bin/python") == 1 then + local executable_path = vim.fn.expand(".venv/bin/python") + vim.api.nvim_echo({ { "Using path for python: " .. executable_path, "None" } }, false, {}) + return executable_path + end + vim.api.nvim_echo({ { "No python executable found (see autocmds.lua)", "WarningMsg" } }, false, {}) +end + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "python" }, + callback = function() + vim.g.python3_host_prog = find_python_executable() -- python executable + vim.opt_local.colorcolumn = "72,88" -- Ruler at column number + vim.opt_local.tabstop = 4 -- Number of spaces tabs count for + vim.opt_local.shiftwidth = 4 -- Size of an indent + end, +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "rust" }, + callback = function() + vim.opt_local.colorcolumn = "79" -- Ruler at column number + vim.opt_local.tabstop = 4 -- Number of spaces tabs count for + vim.opt_local.shiftwidth = 4 -- Size of an indent + end, +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = "typescript", + callback = function() + vim.opt_local.colorcolumn = "79" -- Ruler at column number + vim.opt_local.tabstop = 4 + vim.opt_local.shiftwidth = 4 + end, +}) +-- see lint.lua +-- vim.api.nvim_create_autocmd({ "InsertLeave", "BufWritePost" }, { +-- callback = function() +-- require("lint").try_lint() +-- end, +-- }) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..5c40677 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,22 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Docs: https://www.lazyvim.org/configuration/general +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +local Util = require("lazyvim.util") + +local function map(mode, lhs, rhs, opts) + local keys = require("lazy.core.handler").handlers.keys + ---@cast keys LazyKeysHandler + -- do not create the keymap if a lazy keys handler exists + if not keys.active[keys.parse({ lhs, mode = mode }).id] then + opts = opts or {} + opts.silent = opts.silent ~= false + if opts.remap and not vim.g.vscode then + opts.remap = nil + end + vim.keymap.set(mode, lhs, rhs, opts) + end +end + +map("n", "bo", "%bd|e#", { desc = "Close all buffers but the current one" }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..4bbae56 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,62 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + -- "git" + vim.fn.system({"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + + -- import any extras modules here + -- { import = "lazyvim.plugins.extras.lang.docker" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.rust" }, + -- { import = "lazyvim.plugins.extras.lang.tailwind" }, + { import = "lazyvim.plugins.extras.lang.terraform" }, + { import = "lazyvim.plugins.extras.lang.typescript" }, + -- { import = "lazyvim.plugins.extras.formatting.prettier" }, + { import = "lazyvim.plugins.extras.linting.eslint" }, + { import = "lazyvim.plugins.extras.test.core" }, + { import = "lazyvim.plugins.extras.dap.core" }, + { import = "lazyvim.plugins.extras.dap.nlua" }, + -- { import = "lazyvim.plugins.extras.coding.copilot" }, -- see ai.lua instead + { import = "lazyvim.plugins.extras.coding.yanky" }, + { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, + { import = "lazyvim.plugins.extras.vscode" }, + { import = "lazyvim.plugins.extras.editor.mini-files" }, + { import = "lazyvim.plugins.extras.coding.luasnip" }, + { import = "lazyvim.plugins.extras.lsp.none-ls" }, + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "catppuccin" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..9243e85 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,8 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Docs: https://www.lazyvim.org/configuration/general +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here + +vim.opt.listchars = "tab:▸ ,trail:·,nbsp:␣,extends:❯,precedes:❮" -- show symbols for whitespace +vim.opt.relativenumber = false -- relative line numbers +vim.opt.scrolloff = 10 -- keep 20 lines above and below the cursor diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua new file mode 100644 index 0000000..d152fd4 --- /dev/null +++ b/lua/plugins/ai.lua @@ -0,0 +1,180 @@ +return { + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function() + local icons = require("lazyvim.config").icons + local Util = require("lazyvim.util") + + return { + options = { + theme = "catppuccin", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + globalstatus = true, + disabled_filetypes = { statusline = { "dashboard", "alpha" } }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + lualine_c = { + { + "diagnostics", + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warn, + info = icons.diagnostics.Info, + hint = icons.diagnostics.Hint, + }, + }, + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { "filename", path = 1, symbols = { modified = "  ", readonly = "", unnamed = "" } }, + -- stylua: ignore + { + function() return require("nvim-navic").get_location() end, + cond = function() return package.loaded["nvim-navic"] and require("nvim-navic").is_available() end, + }, + }, + lualine_x = { + -- stylua: ignore + { + function() return require("noice").api.status.command.get() end, + cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, + color = Util.ui.fg("Statement"), + }, + -- stylua: ignore + { + function() return require("noice").api.status.mode.get() end, + cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, + color = Util.ui.fg("Constant"), + }, + -- stylua: ignore + { + function() return " " .. require("dap").status() end, + cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, + color = Util.ui.fg("Debug"), + }, + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + color = Util.ui.fg("Special"), + }, + { + "diff", + symbols = { + added = icons.git.added, + modified = icons.git.modified, + removed = icons.git.removed, + }, + }, + }, + lualine_y = { + { "progress", separator = " ", padding = { left = 1, right = 0 } }, + { "location", padding = { left = 0, right = 1 } }, + }, + lualine_z = { + function() + return " " .. os.date("%R") + end, + }, + }, + extensions = { "neo-tree", "lazy" }, + } + end, + }, + + -- custom config which piggybacks on the copilot extras in lazy.lua. + { + "zbirenbaum/copilot.lua", + enabled = false, + cmd = "Copilot", + build = ":Copilot auth", + event = "InsertEnter", + config = function() + require("copilot").setup({ + panel = { + enabled = true, + auto_refresh = true, + }, + suggestion = { + enabled = true, + auto_trigger = true, + accept = false, -- disable built-in keymapping + }, + }) + + -- hide copilot suggestions when cmp menu is open + -- to prevent odd behavior/garbled up suggestions + local cmp_status_ok, cmp = pcall(require, "cmp") + if cmp_status_ok then + cmp.event:on("menu_opened", function() + vim.b.copilot_suggestion_hidden = true + end) + + cmp.event:on("menu_closed", function() + vim.b.copilot_suggestion_hidden = false + end) + end + end, + }, + { + { + "jellydn/CopilotChat.nvim", + enabled = false, + dependencies = { "zbirenbaum/copilot.lua" }, -- Or { "github/copilot.vim" } + opts = { + mode = "split", -- newbuffer or split , default: newbuffer + debug = false, -- Enable or disable debug mode, the log file will be in ~/.local/state/nvim/CopilotChat.nvim.log + }, + build = function() + vim.defer_fn(function() + vim.cmd("UpdateRemotePlugins") + vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.") + end, 3000) + end, + event = "VeryLazy", + keys = { + { "cce", "CopilotChatExplain", desc = "CopilotChat - Explain code" }, + { "cct", "CopilotChatTests", desc = "CopilotChat - Generate tests" }, + }, + }, + }, + + -- copilot status in lualine + -- this is taken from the copilot lazyvim extras at: + -- https://www.lazyvim.org/plugins/extras/coding.copilot + { + "nvim-lualine/lualine.nvim", + enabled = false, + optional = true, + event = "VeryLazy", + opts = function(_, opts) + local Util = require("lazyvim.util").ui + local colors = { + [""] = Util.fg("Special"), + ["Normal"] = Util.fg("Special"), + ["Warning"] = Util.fg("DiagnosticError"), + ["InProgress"] = Util.fg("DiagnosticWarn"), + } + table.insert(opts.sections.lualine_x, 2, { + function() + local icon = require("lazyvim.config").icons.kinds.Copilot + local status = require("copilot.api").status.data + return icon .. (status.message or "") + end, + cond = function() + local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 }) + return ok and #clients > 0 + end, + color = function() + if not package.loaded["copilot"] then + return + end + local status = require("copilot.api").status.data + return colors[status.status] or colors[""] + end, + }) + end, + }, +} diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 0000000..7d73b93 --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,7 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = { + enable_check_bracket_line = true, + }, +} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..99e36e2 --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,52 @@ +return { + + -- nvim-cmp configuration so to not preselect completion and require tab to select + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + opts = nil, + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = vim.NIL, + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }) + elseif require("copilot.suggestion").is_visible() then + require("copilot.suggestion").accept() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + opts.preselect = cmp.PreselectMode.None + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + end, + }, +} diff --git a/lua/plugins/code_runner.lua b/lua/plugins/code_runner.lua new file mode 100644 index 0000000..56f3295 --- /dev/null +++ b/lua/plugins/code_runner.lua @@ -0,0 +1,17 @@ +return { + { + "CRAG666/code_runner.nvim", + config = function() + require("code_runner").setup({ + focus = false, + + filetype = { + go = { + "go run", + }, + }, + }) + end, + keys = { { "rf", "RunFile term", desc = "Run file" } }, + }, +} diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..46752d0 --- /dev/null +++ b/lua/plugins/colorscheme.lua @@ -0,0 +1,45 @@ +return { + + -- NOTE: also see treesitter.lua for languages with improved syntax highlighting + + -- NOTE: colorschemes already installed in LazyVim: https://www.lazyvim.org/plugins/colorscheme + + -- set the colorscheme + { + "LazyVim/LazyVim", + -- lazy = false, + opts = { + -- colorscheme = "tokyonight-storm", + -- colorscheme = "tokyonight-night", + -- colorscheme = "tokyonight-moon", + -- colorscheme = "tokyonight-day", + colorscheme = "catppuccin", + -- colorscheme = "catppuccin-macchiato", + -- colorscheme = "catppuccin-mocha", + -- colorscheme = "catppuccin-frappe", + -- colorscheme = "catppuccin-latte", + }, + }, + { + "catppuccin/nvim", + -- lazy = false, + name = "catppuccin", + priority = 1000, + opts = { + flavor = "mocha", + transparent_background = true, + integrations = { + gitsigns = true, + telescope = true, + neogit = true, + nvimtree = true, + indent_blankline = true, + dashboard = true, + which_key = true, + mini = true, + harpoon = true, + notify = true, + }, + }, + }, +} diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua new file mode 100644 index 0000000..4da95e3 --- /dev/null +++ b/lua/plugins/dashboard.lua @@ -0,0 +1,4 @@ +return { + + { "goolord/alpha-nvim", enabled = true }, +} diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua new file mode 100644 index 0000000..f00ca8f --- /dev/null +++ b/lua/plugins/debug.lua @@ -0,0 +1,66 @@ +-- See https://www.lazyvim.org/plugins/extras/dap.core +-- and test.lua for keymaps + +return { + { + "williamboman/mason.nvim", + opts = function(_, opts) + local ensure_installed = { + -- python + "debugpy", + + -- see lazy.lua for LazyVim extras + } + + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, ensure_installed) + end, + }, + + { + "mfussenegger/nvim-dap-python", + dependencies = { + "mfussenegger/nvim-dap", + }, + ft = { "python" }, + config = function() + local dap_python = require("dap-python") + + local function find_debugpy_python_path() + -- Return the path to the debugpy python executable if it is + -- installed in $VIRTUAL_ENV, otherwise get it from Mason + if vim.env.VIRTUAL_ENV then + local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/debugpy", true, true) + if table.concat(paths, ", ") ~= "" then + return vim.env.VIRTUAL_ENV .. "/bin/python" + end + end + + local mason_registry = require("mason-registry") + local path = mason_registry.get_package("debugpy"):get_install_path() .. "/venv/bin/python" + return path + end + + local dap_python_path = find_debugpy_python_path() + vim.api.nvim_echo({ { "Using path for dap-python: " .. dap_python_path, "None" } }, false, {}) + + dap_python.setup(dap_python_path) + end, + }, + + -- extend Go extras setup from lazy.lua, with DAP capability + -- also see https://github.com/LazyVim/LazyVim/pull/1115 + { + "leoluz/nvim-dap-go", + dependencies = { + { "mfussenegger/nvim-dap" }, + }, + ft = { "go" }, + config = true, + keys = { + -- workaround, as nvim-dap-go does not have a DAP strategy set up for neotest + -- see https://github.com/nvim-neotest/neotest-go/issues/12 + { "tg", "lua require('dap-go').debug_test()", desc = "Debug Nearest (Go)" }, + }, + }, +} diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua new file mode 100644 index 0000000..f0fdd5d --- /dev/null +++ b/lua/plugins/example.lua @@ -0,0 +1,267 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under config.plugins will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "help", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, "😄") + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/lua/plugins/filetree.lua b/lua/plugins/filetree.lua new file mode 100644 index 0000000..1b355e7 --- /dev/null +++ b/lua/plugins/filetree.lua @@ -0,0 +1,24 @@ +return { + + -- change neo-tree confi + { + "nvim-neo-tree/neo-tree.nvim", + -- opts will be merged with the parent spec + opts = { + filesystem = { + filtered_items = { + visible = true, -- when true, they will just be displayed differently than normal items + hide_dotfiles = false, + hide_gitignored = true, + }, + + -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + use_libuv_file_watcher = true, + }, + window = { + position = "right", + }, + }, + }, +} diff --git a/lua/plugins/format.lua b/lua/plugins/format.lua new file mode 100644 index 0000000..d962178 --- /dev/null +++ b/lua/plugins/format.lua @@ -0,0 +1,59 @@ +return { + + { + "williamboman/mason.nvim", + + opts = function(_, opts) + local ensure_installed = { + -- python + "black", + + -- lua + "stylua", + + -- shell + "shfmt", + + -- yaml + "yamlfix", + "yamlfmt", + + -- rust + -- rustfmt via rustup + + -- see lazy.lua for LazyVim extras + } + + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, ensure_installed) + end, + }, + + { + "mhartington/formatter.nvim", + enabled = false, -- let's see what happens with null-ls and LazyVim + config = function() + local formatter = require("formatter") + formatter.setup({ + filetype = { + lua = { + require("formatter.filetypes.lua").stylua, + }, + python = { + require("formatter.filetypes.python").black, + }, + sh = { + require("formatter.filetypes.sh").shfmt, + }, + yaml = { + require("formatter.filetypes.yaml").yamlfix, + require("formatter.filetypes.yaml").yamlfmt, + }, + }, + }) + end, + }, + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, -- this is equalent to setup({}) function +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..db1315a --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,77 @@ +return { + + { + "sindrets/diffview.nvim", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-tree/nvim-web-devicons" }, + }, + lazy = false, + config = function() + -- vim.opt.fillchars = "diff:╱" + vim.opt.fillchars = "diff:░" + + require("diffview").setup({ + enhanced_diff_hl = true, -- See ':h diffview-config-enhanced_diff_hl' + }) + end, + keys = { + -- use [c and [c to navigate diffs (vim built in), see :h jumpto-diffs + -- use ]x and [x to navigate conflicts + { "gdc", ":DiffviewOpen origin/main...HEAD", desc = "Compare commits" }, + { "gdd", ":DiffviewClose", desc = "Close Diffview tab" }, + { "gdh", ":DiffviewFileHistory %", desc = "File history" }, + { "gdH", ":DiffviewFileHistory", desc = "Repo history" }, + { "gdm", ":DiffviewOpen", desc = "Solve merge conflicts" }, + { "gdo", ":DiffviewOpen main", desc = "DiffviewOpen" }, + { "gdp", ":DiffviewOpen origin/main...HEAD --imply-local", desc = "Review current PR" }, + { + "gdP", + ":DiffviewFileHistory --range=origin/main...HEAD --right-only --no-merges", + desc = "Review current PR (per commit)", + }, + }, + }, + + { + "f-person/git-blame.nvim", + keys = { + -- toggle needs to be called twice; https://github.com/f-person/git-blame.nvim/issues/16 + { "gbe", ":GitBlameEnable", desc = "Blame line (enable)" }, + { "gbd", ":GitBlameDisable", desc = "Blame line (disable)" }, + { "gbs", ":GitBlameCopySHA", desc = "Copy SHA" }, + { "gbc", ":GitBlameCopyCommitURL", desc = "Copy commit URL" }, + { "gbf", ":GitBlameCopyFileURL", desc = "Copy file URL" }, + }, + }, + + { + "tpope/vim-fugitive", + }, + + { + "topaxi/gh-actions.nvim", + dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" }, + build = "make", + cmd = "GhActions", + keys = { + { "ga", "GhActions", desc = "Open Github Actions" }, + }, + -- optional, you can also install and use `yq` instead. + config = function(_, opts) + require("gh-actions").setup(opts) + end, + opts = {}, + }, + + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "nvim-telescope/telescope.nvim", -- optional + "sindrets/diffview.nvim", -- optional + "ibhagwan/fzf-lua", -- optional + }, + config = true, + }, +} diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 0000000..6314e67 --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,22 @@ +return { + + { + "ThePrimeagen/harpoon", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope.nvim" }, + }, + keys = { + { "hh", ":lua require('harpoon.ui').toggle_quick_menu()", desc = "Harpoon menu" }, + -- { "ht", ":Telescope harpoon marks", desc = "Telescope menu" }, + + { "ha", ":lua require('harpoon.mark').add_file()", desc = "Add file as marked" }, + { "hn", ":lua require('harpoon.ui').nav_next()", desc = "Next file" }, + { "hp", ":lua require('harpoon.ui').nav_prev()", desc = "Previous file" }, + { "ht", ":lua require('harpoon.term').gotoTerminal(1)", desc = "Terminal" }, + }, + config = function() + require("telescope").load_extension("harpoon") + end, + }, +} diff --git a/lua/plugins/lint.lua b/lua/plugins/lint.lua new file mode 100644 index 0000000..94ef0ef --- /dev/null +++ b/lua/plugins/lint.lua @@ -0,0 +1,50 @@ +return { + + { + "williamboman/mason.nvim", + + opts = function(_, opts) + local ensure_installed = { + -- python + "mypy", + + -- lua + "luacheck", + + -- shell + "shellcheck", + + -- yaml + "yamllint", + + -- sql + "sqlfluff", + + -- markdown + "vale", + + -- see lazy.lua for LazyVim extras + } + + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, ensure_installed) + end, + }, + + { + -- NOTE: autocmd is required, see autocmds.lua + "mfussenegger/nvim-lint", + enabled = false, -- let's see what happens with null-ls and LazyVim + config = function() + local lint = require("lint") + lint.linters_by_ft = { + python = { "mypy" }, + lua = { "luacheck" }, + yaml = { "yamllint" }, + sh = { "shellcheck" }, + sql = { "sqlfluff" }, + markdown = { "vale" }, + } + end, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..68d1c34 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,114 @@ +-- https://www.lazyvim.org/plugins/lsp + +return { + + -- change mason config + -- note: don't forget to update treesitter for languages + { + "williamboman/mason.nvim", + + opts = function(_, opts) + local ensure_installed = { + -- python + "ruff-lsp", + "pyright", + + -- lua + "lua-language-server", + + -- shell + "bash-language-server", + + -- docker + "dockerfile-language-server", + + -- rust + "rust-analyzer", + + --svelte + "svelte-language-server", + + -- vue + "vue-language-server", + + -- php + "intelephense", + -- see lazy.lua for LazyVim extras + } + + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, ensure_installed) + end, + }, + { + "nvimtools/none-ls.nvim", + dependencies = { "mason.nvim" }, + event = { "BufReadPre", "BufNewFile" }, + opts = function(_, opts) + local null_ls = require("null-ls") + local formatting = null_ls.builtins.formatting + local diagnostics = null_ls.builtins.diagnostics + local code_actions = null_ls.builtins.code_actions + + -- null_ls.setup({ + -- debug = false, -- Turn on debug for :NullLsLog + -- -- diagnostics_format = "#{m} #{s}[#{c}]", + -- }) + + local function prefer_bin_from_venv(executable_name) + -- Return the path to the executable if $VIRTUAL_ENV is set and the binary exists somewhere beneath the $VIRTUAL_ENV path, otherwise get it from Mason + if vim.env.VIRTUAL_ENV then + local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/bin/" .. executable_name, true, true) + local executable_path = table.concat(paths, ", ") + if executable_path ~= "" then + -- vim.api.nvim_echo( + -- { { "Using path for " .. executable_name .. ": " .. executable_path, "None" } }, + -- false, + -- {} + -- ) + return executable_path + end + end + + local mason_registry = require("mason-registry") + local mason_path = mason_registry.get_package(executable_name):get_install_path() + .. "/venv/bin/" + .. executable_name + -- vim.api.nvim_echo({ { "Using Mason for " .. executable_name .. ": " .. mason_path, "None" } }, false, {}) + return mason_path + end + + local sources = { + -- list of supported sources: + -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md + + diagnostics.mypy.with({ + filetypes = { "python" }, + command = prefer_bin_from_venv("mypy"), + }), + formatting.black.with({ + filetypes = { "python" }, + command = prefer_bin_from_venv("black"), + }), + + -- installed via Mason + formatting.stylua.with({ + extra_args = { "--indent-type", "Spaces", "--indent-width", "2" }, + }), + formatting.shfmt, + formatting.yamlfix, -- requires python + formatting.prettierd, + diagnostics.yamllint, + diagnostics.sqlfluff.with({ + extra_args = { "--dialect", "postgres" }, + }), + code_actions.gitsigns, + } + + -- extend opts.sources + for _, source in ipairs(sources) do + table.insert(opts.sources, source) + end + end, + }, +} diff --git a/lua/plugins/markdown.lua b/lua/plugins/markdown.lua new file mode 100644 index 0000000..df4d2dd --- /dev/null +++ b/lua/plugins/markdown.lua @@ -0,0 +1,9 @@ +return { + { + "iamcco/markdown-preview.nvim", + ft = "markdown", + build = function() + vim.fn["mkdp#util#install"]() + end, + }, +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..885c959 --- /dev/null +++ b/lua/plugins/neo-tree.lua @@ -0,0 +1,10 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + opts = { + filesystem = { + bind_to_cwd = false, + }, + }, + }, +} diff --git a/lua/plugins/projects.lua b/lua/plugins/projects.lua new file mode 100644 index 0000000..db1691a --- /dev/null +++ b/lua/plugins/projects.lua @@ -0,0 +1,32 @@ +return { + + { + + "ahmedkhalf/project.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + config = function() + require("project_nvim").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + -- + -- All the patterns used to detect root dir, when **"pattern"** is in + -- detection_methods + patterns = { + ".git", + "_darcs", + ".hg", + ".bzr", + ".svn", + "Makefile", + "package.json", + "pyproject.toml", + "poetry.lock", + }, + }) + require("telescope").load_extension("projects") + end, + }, +} diff --git a/lua/plugins/refactoring.lua b/lua/plugins/refactoring.lua new file mode 100644 index 0000000..1636887 --- /dev/null +++ b/lua/plugins/refactoring.lua @@ -0,0 +1,19 @@ +return { + + "ThePrimeagen/refactoring.nvim", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-treesitter/nvim-treesitter" }, + }, + config = function() + require("refactoring").setup() + end, + keys = { + { + "cR", + ":lua require('refactoring').select_refactor()", + mode = "v", + desc = "Refactor", + }, + }, +} diff --git a/lua/plugins/tabs.lua b/lua/plugins/tabs.lua new file mode 100644 index 0000000..76d22c9 --- /dev/null +++ b/lua/plugins/tabs.lua @@ -0,0 +1,5 @@ +return { + + -- disable tabs + { "akinsho/bufferline.nvim", enabled = false }, +} diff --git a/lua/plugins/tailwind.lua b/lua/plugins/tailwind.lua new file mode 100644 index 0000000..016f638 --- /dev/null +++ b/lua/plugins/tailwind.lua @@ -0,0 +1,5 @@ +-- tailwind-tools.lua +return { + "luckasRanarison/tailwind-tools.nvim", + opts = {}, -- your configuration +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..03ff847 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,63 @@ +return { + + -- change telescope config + { + "nvim-telescope/telescope.nvim", + + -- opts will be merged with the parent spec + opts = { + defaults = { + file_ignore_patterns = { "^.git/", "^node_modules/", "^poetry.lock" }, + }, + }, + }, + + -- https://github.com/nvim-telescope/telescope-live-grep-args.nvim + { + "nvim-telescope/telescope-live-grep-args.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + config = function() + -- https://github.com/nvim-telescope/telescope-live-grep-args.nvim + -- Uses ripgrep args (rg) for live_grep + -- Command examples: + -- -i "Data" # case insensitive + -- -g "!*.md" # ignore md files + -- -w # whole word + -- -e # regex + -- see 'man rg' for more + require("telescope").load_extension("live_grep_args") + end, + keys = { + { + "/", + ":lua require('telescope').extensions.live_grep_args.live_grep_args()", + desc = "Live Grep (Args)", + }, + }, + + -- opts will be merged with the parent spec + opts = { + pickers = { + live_grep = { + additional_args = function() + return { "--hidden" } + end, + }, + }, + }, + }, + + -- https://www.lazyvim.org/configuration/recipes#add-telescope-fzf-native + { + "nvim-telescope/telescope-fzf-native.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, +} diff --git a/lua/plugins/test.lua b/lua/plugins/test.lua new file mode 100644 index 0000000..d2b3084 --- /dev/null +++ b/lua/plugins/test.lua @@ -0,0 +1,64 @@ +return { + + { + "nvim-neotest/neotest", + + dependencies = { + { "nvim-lua/plenary.nvim" }, + { "nvim-treesitter/nvim-treesitter" }, + { "antoinemadec/FixCursorHold.nvim" }, + { "folke/neodev.nvim" }, + + -- adapters + { "nvim-neotest/neotest-vim-test" }, + { "nvim-neotest/neotest-python" }, + { "rouge8/neotest-rust" }, + { "nvim-neotest/neotest-go" }, + { "adrigzr/neotest-mocha" }, + { "vim-test/vim-test" }, + }, + + keys = { + { + "tS", + ":lua require('neotest').run.run({ suite = true })", + desc = "Run all tests in suite", + }, + }, + + opts = { + adapters = { + ["neotest-python"] = { + -- https://github.com/nvim-neotest/neotest-python + runner = "pytest", + args = { "--log-level", "INFO", "--color", "yes", "-vv", "-s" }, + -- dap = { justMyCode = false }, + }, + ["neotest-go"] = { + -- see lazy.lua + }, + -- ["neotest-rust"] = { + -- -- see lazy.lua + -- -- https://github.com/rouge8/neotest-rust + -- -- + -- -- requires nextest, which can be installed via "cargo binstall": + -- -- https://github.com/cargo-bins/cargo-binstall + -- -- https://nexte.st/book/pre-built-binaries.html + -- }, + ["neotest-mocha"] = { + -- https://github.com/adrigzr/neotest-mocha + filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" }, + command = "npm test --", + env = { CI = true }, + cwd = function(_) -- skipped arg is path + return vim.fn.getcwd() + end, + }, + ["neotest-vim-test"] = { + -- https://github.com/nvim-neotest/neotest-vim-test + ignore_file_types = { "python", "vim", "lua", "rust", "go" }, + }, + }, + }, + }, +} diff --git a/lua/plugins/tmux.lua b/lua/plugins/tmux.lua new file mode 100644 index 0000000..d1669e0 --- /dev/null +++ b/lua/plugins/tmux.lua @@ -0,0 +1,45 @@ +return { + -- { + -- "numToStr/Navigator.nvim", + -- config = true, + -- keys = { + -- { "", "NavigatorLeft", desc = "Move left" }, + -- { "NavigatorRight", desc = "Move right" }, + -- { "", "NavigatorDown", desc = "Move down" }, + -- { "", "NavigatorUp", desc = "Move up" }, + -- }, + -- }, + -- { + -- "alexghergh/nvim-tmux-navigation", + -- config = function() + -- require("nvim-tmux-navigation").setup({ + -- disable_when_zoomed = true, -- defaults to false + -- keybindings = { + -- left = "", + -- down = "", + -- up = "", + -- right = "", + -- last_active = "", + -- next = "", + -- }, + -- }) + -- end, + -- }, + { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d7097d5 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,59 @@ +return { + + -- add more treesitter parsers, used for e.g. theming and other plugins + -- https://github.com/nvim-treesitter/nvim-treesitter#supported-languages + { + "nvim-treesitter/nvim-treesitter", + -- opts will be merged with the parent spec + opts = { + ensure_installed = { + "bash", + "c", + "comment", + "css", + "diff", + "git_config", + "git_rebase", + "go", + "gomod", + "html", + "http", + "javascript", + "json", + "lua", + "make", + "markdown", + "markdown_inline", + "proto", + "python", + "query", + "graphql", + "regex", + "rst", + "rust", + "scss", + "svelte", + "swift", + "sql", + "terraform", + "tsx", + "typescript", + "vim", + "vue", + "yaml", + }, + autotag = { + enable = true, + }, + }, + }, + + -- https://github.com/nvim-treesitter/nvim-treesitter-context + { + "nvim-treesitter/nvim-treesitter-context", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + }, + { + "windwp/nvim-ts-autotag", + }, +} diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 0000000..3f76236 --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1,9 @@ +return { + { + "mbbill/undotree", + cmd = "UndotreeToggle", + keys = { + { "fu", "UndotreeToggle", desc = "Undo tree" }, + }, + }, +} diff --git a/lua/plugins/vue.lua b/lua/plugins/vue.lua new file mode 100644 index 0000000..5dc53d0 --- /dev/null +++ b/lua/plugins/vue.lua @@ -0,0 +1,50 @@ +local lsp_conficts, _ = pcall(vim.api.nvim_get_autocmds, { group = "LspAttach_conflicts" }) +if not lsp_conficts then + vim.api.nvim_create_augroup("LspAttach_conflicts", {}) +end +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_conflicts", + desc = "prevent tsserver and volar competing", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + local active_clients = vim.lsp.get_active_clients() + local client = vim.lsp.get_client_by_id(args.data.client_id) + -- prevent tsserver and volar competing + -- if client.name == "volar" or require("lspconfig").util.root_pattern("nuxt.config.ts")(vim.fn.getcwd()) then + -- OR + if client.name == "volar" then + for _, client_ in pairs(active_clients) do + -- stop tsserver if volar is already active + if client_.name == "tsserver" then + client_.stop() + end + end + elseif client.name == "tsserver" then + for _, client_ in pairs(active_clients) do + -- prevent tsserver from starting if volar is already active + if client_.name == "volar" then + client.stop() + end + end + end + end, +}) +return { + { + "neovim/nvim-lspconfig", + opts = { + servers = { + volar = { + filetypes = { + "javascript", + "typescript", + "vue", + }, + }, + }, + }, + }, + {}, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 0000000..476318d --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,25 @@ +return { + -- Modify which-key keys + { + "folke/which-key.nvim", + opts = function() + require("which-key").register({ + ["t"] = { + name = "+test", + }, + ["gb"] = { + name = "+blame", + }, + ["gd"] = { + name = "+diffview", + }, + ["h"] = { + name = "+harpoon", + }, + ["r"] = { + name = "+run", + }, + }) + end, + }, +} diff --git a/lua/plugins/zen.lua b/lua/plugins/zen.lua new file mode 100644 index 0000000..575135a --- /dev/null +++ b/lua/plugins/zen.lua @@ -0,0 +1,4 @@ +return { + + { "folke/zen-mode.nvim" }, +}