diff --git a/_backup/nvim/init.lua b/_backup/nvim/init.lua new file mode 100644 index 0000000..5b28f6c --- /dev/null +++ b/_backup/nvim/init.lua @@ -0,0 +1 @@ +require("crthaze") diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/airline.lua b/_backup/nvim/lua/crthaze/_lazy_deact/airline.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/airline.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/airline.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/cloak.lua b/_backup/nvim/lua/crthaze/_lazy_deact/cloak.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/cloak.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/cloak.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/fugitive.lua b/_backup/nvim/lua/crthaze/_lazy_deact/fugitive.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/fugitive.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/fugitive.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/local.lua b/_backup/nvim/lua/crthaze/_lazy_deact/local.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/local.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/local.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/neotest.lua b/_backup/nvim/lua/crthaze/_lazy_deact/neotest.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/neotest.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/neotest.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/nerdtree.lua b/_backup/nvim/lua/crthaze/_lazy_deact/nerdtree.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/nerdtree.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/nerdtree.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/trouble.lua b/_backup/nvim/lua/crthaze/_lazy_deact/trouble.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/trouble.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/trouble.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/vimbegood.lua b/_backup/nvim/lua/crthaze/_lazy_deact/vimbegood.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/vimbegood.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/vimbegood.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/zenmode.lua b/_backup/nvim/lua/crthaze/_lazy_deact/zenmode.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/_lazy_deact/zenmode.lua rename to _backup/nvim/lua/crthaze/_lazy_deact/zenmode.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/diagnostics.lua b/_backup/nvim/lua/crthaze/diagnostics.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/diagnostics.lua rename to _backup/nvim/lua/crthaze/diagnostics.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/init.lua b/_backup/nvim/lua/crthaze/init.lua similarity index 98% rename from home/any/neovim/.config/nvim/lua/crthaze/init.lua rename to _backup/nvim/lua/crthaze/init.lua index e3ac67c..070b639 100644 --- a/home/any/neovim/.config/nvim/lua/crthaze/init.lua +++ b/_backup/nvim/lua/crthaze/init.lua @@ -2,6 +2,7 @@ require("crthaze.set") require("crthaze.remap") require("crthaze.lazy_init") require("crthaze.langs") +require("crthaze.diagnostics") local augroup = vim.api.nvim_create_augroup local autocmd = vim.api.nvim_create_autocmd diff --git a/home/any/neovim/.config/nvim/lua/crthaze/langs.lua b/_backup/nvim/lua/crthaze/langs.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/langs.lua rename to _backup/nvim/lua/crthaze/langs.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/autopairs.lua b/_backup/nvim/lua/crthaze/lazy/autopairs.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/autopairs.lua rename to _backup/nvim/lua/crthaze/lazy/autopairs.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/colors.lua b/_backup/nvim/lua/crthaze/lazy/colors.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/colors.lua rename to _backup/nvim/lua/crthaze/lazy/colors.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/copilot.lua b/_backup/nvim/lua/crthaze/lazy/copilot.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/copilot.lua rename to _backup/nvim/lua/crthaze/lazy/copilot.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/gitgutter.lua b/_backup/nvim/lua/crthaze/lazy/gitgutter.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/gitgutter.lua rename to _backup/nvim/lua/crthaze/lazy/gitgutter.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/indentline.lua b/_backup/nvim/lua/crthaze/lazy/indentline.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/indentline.lua rename to _backup/nvim/lua/crthaze/lazy/indentline.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/init.lua b/_backup/nvim/lua/crthaze/lazy/init.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/init.lua rename to _backup/nvim/lua/crthaze/lazy/init.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/lazygit.lua b/_backup/nvim/lua/crthaze/lazy/lazygit.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/lazygit.lua rename to _backup/nvim/lua/crthaze/lazy/lazygit.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/lsp.lua b/_backup/nvim/lua/crthaze/lazy/lsp.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/lsp.lua rename to _backup/nvim/lua/crthaze/lazy/lsp.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/lualine.lua b/_backup/nvim/lua/crthaze/lazy/lualine.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/lualine.lua rename to _backup/nvim/lua/crthaze/lazy/lualine.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/nvim-tree.lua b/_backup/nvim/lua/crthaze/lazy/nvim-tree.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/nvim-tree.lua rename to _backup/nvim/lua/crthaze/lazy/nvim-tree.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/rooter.lua b/_backup/nvim/lua/crthaze/lazy/rooter.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/rooter.lua rename to _backup/nvim/lua/crthaze/lazy/rooter.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/snippets.lua b/_backup/nvim/lua/crthaze/lazy/snippets.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/snippets.lua rename to _backup/nvim/lua/crthaze/lazy/snippets.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/tagbar.lua b/_backup/nvim/lua/crthaze/lazy/tagbar.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/tagbar.lua rename to _backup/nvim/lua/crthaze/lazy/tagbar.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/telescope.lua b/_backup/nvim/lua/crthaze/lazy/telescope.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/telescope.lua rename to _backup/nvim/lua/crthaze/lazy/telescope.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/toggleterm.lua b/_backup/nvim/lua/crthaze/lazy/toggleterm.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/toggleterm.lua rename to _backup/nvim/lua/crthaze/lazy/toggleterm.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/treesitter.lua b/_backup/nvim/lua/crthaze/lazy/treesitter.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/treesitter.lua rename to _backup/nvim/lua/crthaze/lazy/treesitter.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy/undotree.lua b/_backup/nvim/lua/crthaze/lazy/undotree.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy/undotree.lua rename to _backup/nvim/lua/crthaze/lazy/undotree.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/lazy_init.lua b/_backup/nvim/lua/crthaze/lazy_init.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/lazy_init.lua rename to _backup/nvim/lua/crthaze/lazy_init.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/remap.lua b/_backup/nvim/lua/crthaze/remap.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/remap.lua rename to _backup/nvim/lua/crthaze/remap.lua diff --git a/home/any/neovim/.config/nvim/lua/crthaze/set.lua b/_backup/nvim/lua/crthaze/set.lua similarity index 100% rename from home/any/neovim/.config/nvim/lua/crthaze/set.lua rename to _backup/nvim/lua/crthaze/set.lua diff --git a/home/any/neovim/.config/nvim/.stylua.toml b/home/any/neovim/.config/nvim/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/home/any/neovim/.config/nvim/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/home/any/neovim/.config/nvim/init.lua b/home/any/neovim/.config/nvim/init.lua index 5b28f6c..0fda20c 100644 --- a/home/any/neovim/.config/nvim/init.lua +++ b/home/any/neovim/.config/nvim/init.lua @@ -1 +1,37 @@ -require("crthaze") +vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" +vim.g.mapleader = " " + +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not vim.uv.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +end + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "options" +require "nvchad.autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/home/any/neovim/.config/nvim/lazy-lock.json b/home/any/neovim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..7279c6a --- /dev/null +++ b/home/any/neovim/.config/nvim/lazy-lock.json @@ -0,0 +1,44 @@ +{ + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "NvChad": { "branch": "v2.5", "commit": "09dd13e9c6df98fe5609829a7a0fbccea2f515ae" }, + "base46": { "branch": "v2.5", "commit": "fec9fa583025e69e0c4f902bd61990e8d13d1975" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "f5bd8419f8a29451e20bdb1061a54fe13d5c8de3" }, + "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "gitsigns.nvim": { "branch": "main", "commit": "ee7634ab4f0a6606438fe13e16cbf2065589a5ed" }, + "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, + "indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "menu": { "branch": "main", "commit": "ee85b2e394fde354bd24e35ff7a688d10c9212fa" }, + "minty": { "branch": "main", "commit": "157e91c04cce2f01643519338d6b854275a77547" }, + "none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" }, + "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, + "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" }, + "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, + "nvim-dap-python": { "branch": "master", "commit": "03fe9592409236b9121c03b66a682dfca15a5cac" }, + "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, + "nvim-lspconfig": { "branch": "master", "commit": "84f867753f659bfd9319f75bd5eb273a315f2da5" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-tree.lua": { "branch": "master", "commit": "2a268f631da85e83b7a95291be589bcddfc785d8" }, + "nvim-treesitter": { "branch": "master", "commit": "df20c049694474021cffb2cc8687c809adc1cbba" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "tagbar": { "branch": "master", "commit": "d55d454bd3d5b027ebf0e8c75b8f88e4eddad8d8" }, + "telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "ui": { "branch": "v3.0", "commit": "81f5ff0fb2ce60cc3b2cfc9df928751c2ac4f7e9" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "venv-selector.nvim": { "branch": "regexp", "commit": "e82594274bf7b54387f9a2abe65f74909ac66e97" }, + "vim-rooter": { "branch": "master", "commit": "51402fb77c4d6ae94994e37dc7ca13bec8f4afcc" }, + "vim-smoothie": { "branch": "master", "commit": "df1e324e9f3395c630c1c523d0555a01d2eb1b7e" }, + "volt": { "branch": "main", "commit": "229b4f1bc865c866227dd0e2ecda11ab6ec2c8cc" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } +} diff --git a/home/any/neovim/.config/nvim/lua/chadrc.lua b/home/any/neovim/.config/nvim/lua/chadrc.lua new file mode 100644 index 0000000..989bcd7 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/chadrc.lua @@ -0,0 +1,53 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua +-- Please read that file to know all available options :( + +---@class ChadrcConfig +local M = {} + +M.base46 = { + theme = "gruvbox", + + hl_override = { + LineNr = { fg = "#FBB829" }, + String = { fg = "#EF2F27" }, + Keyword = { fg = "#2C78BF" }, + Type = { fg = "#FF5F00" }, + Comment = { fg = "#519F50" }, + ["@comment"] = { fg = "#519F50" }, + -- Normal = { bg = "none" }, + -- NormalFloat = { bg = "none" }, + }, + transparency = true, +} + +M.ui = { + statusline = { + separator_style = "arrow" + } +} + +M.mason = { + pkgs = { + "delve", + "debugpy", + "black", + "mypy", + "ruff", + } +} + +M.term = { + winopts = { number = false, relativenumber = false }, + sizes = { sp = 0.3, vsp = 0.2, ["bo sp"] = 0.3, ["bo vsp"] = 0.2 }, + float = { + relative = "editor", + row = 0.05, + col = 0.1, + width = 0.8, + height = 0.8, + border = "single", + }, +} + +return M diff --git a/home/any/neovim/.config/nvim/lua/configs/conform.lua b/home/any/neovim/.config/nvim/lua/configs/conform.lua new file mode 100644 index 0000000..35ba6cf --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +return options diff --git a/home/any/neovim/.config/nvim/lua/configs/lazy.lua b/home/any/neovim/.config/nvim/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/home/any/neovim/.config/nvim/lua/configs/lspconfig.lua b/home/any/neovim/.config/nvim/lua/configs/lspconfig.lua new file mode 100644 index 0000000..107a137 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/configs/lspconfig.lua @@ -0,0 +1,181 @@ +-- load defaults i.e lua_lsp +-- require("nvchad.configs.lspconfig").defaults() +dofile(vim.g.base46_cache .. "lsp") + +local x = vim.diagnostic.severity + +vim.diagnostic.config { + -- virtual_text = { prefix = "" }, + virtual_text = false, + signs = { text = { [x.ERROR] = "󰅙", [x.WARN] = "", [x.INFO] = "󰋼", [x.HINT] = "󰌵" } }, + underline = true, + float = { border = "single" }, +} + +-- Default border style +local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview +function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.border = "rounded" + return orig_util_open_floating_preview(contents, syntax, opts, ...) +end + + +-- Function to check if a floating dialog exists and if not +-- then check for diagnostics under the cursor +function OpenDiagnosticIfNoFloat() + for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do + if vim.api.nvim_win_get_config(winid).zindex then + return + end + end + -- THIS IS FOR BUILTIN LSP + vim.diagnostic.open_float(0, { + scope = "cursor", + focusable = false, + close_events = { + "CursorMoved", + "CursorMovedI", + "BufHidden", + "InsertCharPre", + "WinLeave", + }, + }) +end +-- Show diagnostics under the cursor when holding position +vim.api.nvim_create_augroup("lsp_diagnostics_hold", { clear = true }) +vim.api.nvim_create_autocmd({ "CursorHold" }, { + pattern = "*", + command = "lua OpenDiagnosticIfNoFloat()", + group = "lsp_diagnostics_hold", +}) + +-- Setup LSPs +------------- + +local lspconfig = require "lspconfig" +local util = require "lspconfig/util" + +local servers = { + html = {}, + cssls = {}, + lua_ls = { + settings = { + Lua = { + runtime = { version = "Lua 5.1" }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + } + } + } + }, + rust_analyzer = {}, + gopls = { + cmd = {"gopls"}, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_dir = util.root_pattern("go.mod", "git"), + settings = { + completeUnimported = true, + usPlaceholders = true, + analyses = { + unusedparams = true, + } + } + }, + cobol_ls = {}, + fortls = {}, + helm_ls = { + settings = { + ['helm-ls'] = { + yamlls = { + enabled = false, + } + } + } + }, + htmx = {}, + -- pylsp = { + -- settings = { + -- pylsp = { + -- plugins = { + -- autopep8 = { enabled = false }, + -- mccabe = { enabled = false }, + -- pycodestyle = { enabled = false }, + -- pyflakes = { enabled = false }, + -- rope = { enabled = false }, + -- black = { + -- enabled = true, + -- }, + -- flake8 = { + -- enabled = true, + -- maxComplexity = 15, + -- }, + -- jedi_completion = { + -- fuzzy = true, + -- }, + -- pydocstyle = { + -- enabled = true, + -- convention = "google", + -- }, + -- pylint = { + -- enabled = true, + -- executable = "pylint", + -- args = { + -- "--disable=line-too-long,import-error,too-many-arguments,too-many-locals,too-many-branches,too-many-lines,too-many-return-statements,fixme,too-few-public-methods,too-many-instance-attributes,too-many-statements,too-many-public-methods", + -- }, + -- }, + -- pylsp_isort = { + -- enabled = true, + -- }, + -- pylsp_mypy = { + -- enabled = true, + -- }, + -- yapf = { + -- enabled = true, + -- }, + -- } + -- } + -- } + -- }, + pyright = { + filetypes = {"python"}, + }, + solargraph = {}, + gitlab_ci_ls = {}, + zls = { + root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), + settings = { + zls = { + enable_inlay_hints = true, + enable_snippets = true, + warn_style = true, + }, + }, + }, +} +local nvlsp = require "nvchad.configs.lspconfig" + + +for name, opts in pairs(servers) do + opts.on_init = nvlsp.on_init + opts.on_attach = nvlsp.on_attach + opts.capabilities = nvlsp.capabilities + + lspconfig[name].setup(opts) +end + +-- -- lsps with default config +-- for _, lsp in ipairs(servers) do +-- lspconfig[lsp].setup { +-- on_attach = nvlsp.on_attach, +-- on_init = nvlsp.on_init, +-- capabilities = nvlsp.capabilities, +-- } +-- end + +-- configuring single server, example: typescript +-- lspconfig.ts_ls.setup { +-- on_attach = nvlsp.on_attach, +-- on_init = nvlsp.on_init, +-- capabilities = nvlsp.capabilities, +-- } diff --git a/home/any/neovim/.config/nvim/lua/mappings.lua b/home/any/neovim/.config/nvim/lua/mappings.lua new file mode 100644 index 0000000..c78a390 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/mappings.lua @@ -0,0 +1,66 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +-- map({ "n", "i", "v" }, "", " w ") +map("n", "pv", vim.cmd.Ex) + +map("v", "J", ":m '>+1gv=gv") +map("v", "K", ":m '<-2gv=gv") + +map("n", "J", "mzJ`z") +-- vim.keymap.set("n", "", "zz") +-- vim.keymap.set("n", "", "zz") +map("n", "n", "nzzzv") +map("n", "N", "Nzzzv") +map("n", "zig", "LspRestart") + +-- greatest remap ever +map("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +map({"n", "v"}, "y", [["+y]]) +map("n", "Y", [["+Y]]) + +map({"n", "v"}, "d", [["_d]]) + +-- This is going to get me cancelled +-- vim.keymap.set("i", "", "") + +map("n", "Q", "") +-- vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") +map("n", "f", vim.lsp.buf.format) + +map("n", "", "cnextzz") +map("n", "", "cprevzz") +map("n", "k", "lnextzz") +map("n", "j", "lprevzz") + +map("n", "s", [[:%s/\<\>//gI]]) +map("n", "x", "!chmod +x %", { silent = true }) + +-- vim.keymap.set( +-- "n", +-- "ee", +-- "oif err != nil {}Oreturn err" +-- ) + +-- vim.keymap.set("n", "vpp", "e ~/.config/nvim/lua/crthaze/packer.lua"); +map("n", "mr", "CellularAutomaton make_it_rain"); + +map("n", "", function() + vim.cmd("so") +end) + +map("n", "nn", function() + vim.cmd("set relativenumber!") +end) + +map("n", "t", function() + require("nvchad.term").toggle { pos = "float", id = "floatTerm" } +end, { desc = "terminal toggle floating term" }) diff --git a/home/any/neovim/.config/nvim/lua/options.lua b/home/any/neovim/.config/nvim/lua/options.lua new file mode 100644 index 0000000..94588c6 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/options.lua @@ -0,0 +1,41 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! +local o = vim.opt +o.nu = true +o.relativenumber = true + +o.tabstop = 2 +o.softtabstop = 2 +o.shiftwidth = 2 +o.expandtab = false + +o.smartindent = true + +o.wrap = true + +o.swapfile = false +o.backup = false +o.undofile = true + +o.hlsearch = false +o.incsearch = true + +o.termguicolors = true + +o.scrolloff = 8 +o.signcolumn = "yes" +o.isfname:append("@-@") + +o.updatetime = 50 + +o.colorcolumn = "80" + +o.backupdir = os.getenv("HOME") .. "/.var/tmp/nvim/backup/" +o.directory = os.getenv("HOME") .. "/.var/tmp/nvim/swap/" +o.undodir = os.getenv("HOME") .. "/.var/tmp/nvim/undo/" +o.listchars = {tab = '⇥ ', trail = '▓'} +o.list = true diff --git a/home/any/neovim/.config/nvim/lua/plugins/copilot.lua b/home/any/neovim/.config/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..236ce6c --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,5 @@ +return { + { + "github/copilot.vim", + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/gopher.lua b/home/any/neovim/.config/nvim/lua/plugins/gopher.lua new file mode 100644 index 0000000..a03a478 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/gopher.lua @@ -0,0 +1,20 @@ +return { + { + "olexsmir/gopher.nvim", + ft = "go", + config = function(_, opts) + require("gopher").setup(opts) + vim.keymap.set( + "n", "gsj", "GoTagAdd json", + { desc = "Add json struct tags" } + ) + vim.keymap.set( + "n", "gsy", "GoTagAdd yaml", + { desc = "Add yaml struct tags" } + ) + end, + build = function() + vim.cmd [[silent! GoInstallDeps]] + end, + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/init.lua b/home/any/neovim/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..6474776 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,25 @@ +return { + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + opts = require "configs.conform", + }, + + -- These are some examples, uncomment them if you want to see them work! + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + }, + + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "vim", "lua", "vimdoc", + -- "html", "css" + -- }, + -- }, + -- }, +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/lazygit.lua b/home/any/neovim/.config/nvim/lua/plugins/lazygit.lua new file mode 100644 index 0000000..5c77df0 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/lazygit.lua @@ -0,0 +1,20 @@ +return { + "kdheepak/lazygit.nvim", + lazy = true, + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "lg", "LazyGit", desc = "LazyGit" } + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/misc.lua b/home/any/neovim/.config/nvim/lua/plugins/misc.lua new file mode 100644 index 0000000..7114b6e --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/misc.lua @@ -0,0 +1,10 @@ +return { + { + "folke/todo-comments.nvim", + lazy = false + }, + { + "psliwka/vim-smoothie", + lazy = false + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/null-ls.lua b/home/any/neovim/.config/nvim/lua/plugins/null-ls.lua new file mode 100644 index 0000000..9b8bda7 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/null-ls.lua @@ -0,0 +1,42 @@ +return { + { + "nvimtools/none-ls.nvim", + ft = "go", + opts = function() + local null_ls = require("null-ls") + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + local srcs = {} + if vim.bo.filetype == "go" then + srcs = { + null_ls.builtins.formatting.gofmt, + null_ls.builtins.formatting.goimports_reviser, + null_ls.builtins.formatting.golines, + } + elseif vim.bo.filetype == "python" then + srcs = { + null_ls.builtins.formatting.black, + null_ls.builtins.diagnostics.mypy, + null_ls.builtins.diagnostics.ruff, + } + end + return { + sources = srcs, + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ + group = augroup, + buffer = bufnr, + }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end, + }) + end + end + } + end + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/nvim-dap.lua b/home/any/neovim/.config/nvim/lua/plugins/nvim-dap.lua new file mode 100644 index 0000000..0695930 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/nvim-dap.lua @@ -0,0 +1,84 @@ +return { + { + "mfussenegger/nvim-dap", + init = function() + vim.keymap.set( + "n", "db", "DapToggleBreakpoint", + { desc = "Add breakpoint at line" } + ) + -- vim.keymap.set( + -- "n", "dus", function() + -- local widgets = require('dap.ui.widgets'); + -- local sidebar = widgets.sidebar(widgets.scopes); + -- sidebar.open(); + -- end, + -- { desc = "Open debugging sidebar" } + -- ) + end + }, + { + "nvim-neotest/nvim-nio", + }, + { + "rcarriga/nvim-dap-ui", + dependencies = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio", + }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + dapui.setup() + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end + end + }, + { + "leoluz/nvim-dap-go", + ft = "go", + dependencies = { + "mfussenegger/nvim-dap", + "rcarriga/nvim-dap-ui", + }, + config = function(_, opts) + require("dap-go").setup(opts) + vim.keymap.set( + "n", "dgt", function() + require('dap-go').debug_test() + end, + { desc = "Debug go test" } + ) + vim.keymap.set( + "n", "dgl", function() + require('dap-go').debug_last() + end, + { desc = "Debug last go test" } + ) + end + }, + { + "mfussenegger/nvim-dap-python", + ft = "python", + dependencies = { + "mfussenegger/nvim-dap", + "rcarriga/nvim-dap-ui", + }, + config = function(_, _) + local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" + require('dap-python').setup(path) + vim.keymap.set( + "n", "dpr", function() + require('dap-python').test_method() + end, + { desc = "Debug python method" } + ) + end + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/nvim-tree.lua b/home/any/neovim/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..6cb04c6 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,59 @@ +local HEIGHT_RATIO = 0.8 +local WIDTH_RATIO = 0.5 + +return { + { + "nvim-tree/nvim-tree.lua", + init = function() + -- disable netrw at the very start of your init.lua + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + -- optionally enable 24-bit colour + vim.opt.termguicolors = true + + -- OR setup with some options + require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + float = { + enable = true, + open_win_config = function() + local screen_w = vim.opt.columns:get() + local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + local window_w = screen_w * WIDTH_RATIO + local window_h = screen_h * HEIGHT_RATIO + local window_w_int = math.floor(window_w) + local window_h_int = math.floor(window_h) + local center_x = (screen_w - window_w) / 2 + local center_y = ((vim.opt.lines:get() - window_h) / 2) + - vim.opt.cmdheight:get() + return { + border = 'rounded', + relative = 'editor', + row = center_y, + col = center_x, + width = window_w_int, + height = window_h_int, + } + end, + }, + width = function() + return math.floor(vim.opt.columns:get() * WIDTH_RATIO) + end, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + }) + + vim.keymap.set("n", "e", "NvimTreeToggle") + vim.keymap.set("n", "o", "NvimTreeFindFileToggle") + end + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/rooter.lua b/home/any/neovim/.config/nvim/lua/plugins/rooter.lua new file mode 100644 index 0000000..def8045 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/rooter.lua @@ -0,0 +1,10 @@ +return { + { + "airblade/vim-rooter", + init = function() + vim.g.rooter_cd_cmd = "lcd" + vim.g.rooter_silent_chdir = 1 + vim.g.rooter_resolve_links = 1 + end + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/tagbar.lua b/home/any/neovim/.config/nvim/lua/plugins/tagbar.lua new file mode 100644 index 0000000..3b959f3 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/tagbar.lua @@ -0,0 +1,8 @@ +return { + { + "majutsushi/tagbar", + init = function() + vim.keymap.set("n", "b", "TagbarToggle") + end + } +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/treesitter.lua b/home/any/neovim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..150d3e2 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,22 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "html", + "css", + "bash", + "vimdoc", + "javascript", + "typescript", + "c", + "lua", + "rust", + "python", + "go", + "zig", + "fortran", + } + }, + }, +} diff --git a/home/any/neovim/.config/nvim/lua/plugins/undotree.lua b/home/any/neovim/.config/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..f76ae05 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,9 @@ + +return { + "mbbill/undotree", + + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end +} + diff --git a/home/any/neovim/.config/nvim/lua/plugins/venv-selector.lua b/home/any/neovim/.config/nvim/lua/plugins/venv-selector.lua new file mode 100644 index 0000000..c6d9d20 --- /dev/null +++ b/home/any/neovim/.config/nvim/lua/plugins/venv-selector.lua @@ -0,0 +1,18 @@ +return { + { + "linux-cultist/venv-selector.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "mfussenegger/nvim-dap", "mfussenegger/nvim-dap-python", --optional + { "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } }, + }, + ft = "python", + branch = "regexp", -- This is the regexp branch, use this for the new version + config = function() + require("venv-selector").setup() + end, + keys = { + { ",v", "VenvSelect" }, + }, + }, +}