diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..0fda20c --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,37 @@ +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/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..931e34a --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,38 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "NvChad": { "branch": "v2.5", "commit": "46b15ef1b9d10a83ab7df26b14f474d15c01e770" }, + "base46": { "branch": "v3.0", "commit": "80358ecdb5779b199130ed03031c34c0c2bca3fc" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, + "conform.nvim": { "branch": "master", "commit": "eebc724d12c5579d733d1f801386e0ceb909d001" }, + "crates.nvim": { "branch": "main", "commit": "73d2c590c74a0c582144987a4decb4a642755859" }, + "friendly-snippets": { "branch": "main", "commit": "31f2a2657b6261724313281fe0d8ba6f43f4a4fa" }, + "gitsigns.nvim": { "branch": "main", "commit": "fcfa7a989cd6fed10abf02d9880dc76d7a38167d" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "menu": { "branch": "main", "commit": "8adb036ec34c679050913864cbc98cc64eb91f6c" }, + "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-dap": { "branch": "master", "commit": "7aade9e99bef5f0735cf966e715b3ce45515d786" }, + "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, + "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, + "nvim-dap-ui": { "branch": "master", "commit": "881a69e25bd6658864fab47450025490b74be878" }, + "nvim-lspconfig": { "branch": "master", "commit": "e39da6a820d2a700904117d29f0dd476d64262cf" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-tree.lua": { "branch": "master", "commit": "5bea2b37523a31288e0fcab42f3be5c1bd4516bb" }, + "nvim-treesitter": { "branch": "master", "commit": "7bbed4b548d9a81c14351bda93d16336edefd067" }, + "nvim-web-devicons": { "branch": "master", "commit": "c90dee4e930ab9f49fa6d77f289bff335b49e972" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, + "rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" }, + "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, + "ui": { "branch": "v3.0", "commit": "cf498b0c3f75cc65ea809cc3f3cd9bbfa937b042" }, + "volt": { "branch": "main", "commit": "c45d5f48da8e802e608b5c6da471ca4d84276dfb" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/nvim/.config/nvim/lua/chadrc.lua b/nvim/.config/nvim/lua/chadrc.lua new file mode 100644 index 0000000..d75318f --- /dev/null +++ b/nvim/.config/nvim/lua/chadrc.lua @@ -0,0 +1,24 @@ +-- 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 :( + +---@type ChadrcConfig +local M = {} + +M.base46 = { + theme = "chadracula-evondev", + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +-- M.nvdash = { load_on_startup = true } +-- M.ui = { +-- tabufline = { +-- lazyload = false +-- } +--} + +return M diff --git a/nvim/.config/nvim/lua/configs/conform.lua b/nvim/.config/nvim/lua/configs/conform.lua new file mode 100644 index 0000000..928cbc6 --- /dev/null +++ b/nvim/.config/nvim/lua/configs/conform.lua @@ -0,0 +1,20 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + css = { "prettier" }, + html = { "prettier" }, + go = { "gopls" }, + ts = { "prettier" }, + tsx = { "prettier" }, + js = { "prettier" }, + jsx = { "prettier" } + }, + + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_fallback = true, + }, +} + +return options diff --git a/nvim/.config/nvim/lua/configs/lazy.lua b/nvim/.config/nvim/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/nvim/.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/nvim/.config/nvim/lua/configs/lspconfig.lua b/nvim/.config/nvim/lua/configs/lspconfig.lua new file mode 100644 index 0000000..244e23d --- /dev/null +++ b/nvim/.config/nvim/lua/configs/lspconfig.lua @@ -0,0 +1,78 @@ +-- load defaults i.e lua_lsp +require("nvchad.configs.lspconfig").defaults() + +local lspconfig = require "lspconfig" + +-- EXAMPLE +local servers = { "html", "cssls" } +local nvlsp = require "nvchad.configs.lspconfig" + +-- 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 + +lspconfig.gopls.setup { + on_attach = nvlsp.on_attach, + capabilities = nvlsp.capabilities, + cmd = { "gopls" }, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + settings = { + completeUnimported = true, + usePlaceholders = true, + analyses = { + unusedparams = true, + }, + }, +} + +lspconfig.ts_ls.setup { + on_attach = nvlsp.on_attach, + capabilities = nvlsp.capabilities, + init_options = { + preferences = { + disableSuggestions = true, + }, + }, +} + +lspconfig.tailwindcss.setup { + on_attach = nvlsp.on_attach, + capabilities = nvlsp.capabilities, +} + +lspconfig.pyright.setup { + on_attach = nvlsp.on_attach, + capabilities = nvlsp.capabilities, + filetypes = { "python" }, +} + +lspconfig.eslint.setup { + on_attach = nvlsp.on_attach, + capabilities = nvlsp.capabilities, +} + +lspconfig.golangcilsp = { + default_config = { + cmd = { "golangci-lint-langserver" }, + root_dir = lspconfig.util.root_pattern(".git", "go.mod"), + init_options = { + command = { + "golangci-lint", + "run", + "--output.json.path", + "stdout", + "--show-stats=false", + "--issues-exit-code=1", + }, + }, + }, +} + +lspconfig.golangci_lint_ls.setup { + filetypes = { "go", "gomod" }, +} diff --git a/nvim/.config/nvim/lua/custom/chadrc.lua b/nvim/.config/nvim/lua/custom/chadrc.lua deleted file mode 100644 index d8b1654..0000000 --- a/nvim/.config/nvim/lua/custom/chadrc.lua +++ /dev/null @@ -1,9 +0,0 @@ -local M = {} - -M.ui = { theme = 'bearded-arc', tabufline= {enabled= false} } -M.plugins = "custom.plugins" -M.mappings = require "custom.configs.mappings" -vim.opt.spelllang = 'en_gb' -vim.opt.spell = true - -return M diff --git a/nvim/.config/nvim/lua/custom/configs/lspconfig.lua b/nvim/.config/nvim/lua/custom/configs/lspconfig.lua deleted file mode 100644 index 5c61a8d..0000000 --- a/nvim/.config/nvim/lua/custom/configs/lspconfig.lua +++ /dev/null @@ -1,60 +0,0 @@ -local on_attach = require("plugins.configs.lspconfig").on_attach -local capabilities = require("plugins.configs.lspconfig").capabilities - -local lspconfig = require("lspconfig") -local util = require "lspconfig/util" - -lspconfig.gopls.setup { - on_attach = on_attach, - capabilities = capabilities, - cmd= {"gopls"}, - filetypes = { "go", "gomod", "gowork", "gotmpl" }, - root_dir = util.root_pattern("go.work", "go.mod", ".git"), - settings = { - completeUnimported = true, - usePlaceholders = true, - analyses = { - unusedparams = true, - } - } -} - -lspconfig.ts_ls.setup{ - on_attach=on_attach, - capabilities=capabilities, - init_options = { - preferences = { - disableSuggestions = true, - } - } -} - -lspconfig.tailwindcss.setup({ - on_attach = on_attach, - capabilities = capabilities, -}) - -lspconfig.pyright.setup({ - on_attach = on_attach, - capabilities = capabilities, - filetypes= {"python"}, -}) - -lspconfig.eslint.setup({ - on_attach = on_attach, - capabilities = capabilities, -}) - -lspconfig.golangcilsp = { - default_config = { - cmd = {'golangci-lint-langserver'}, - root_dir = lspconfig.util.root_pattern('.git', 'go.mod'), - init_options = { - command = { "golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1" }; - } - }; -} - -lspconfig.golangci_lint_ls.setup { - filetypes = {'go','gomod'} -} diff --git a/nvim/.config/nvim/lua/custom/configs/mappings.lua b/nvim/.config/nvim/lua/custom/configs/mappings.lua deleted file mode 100644 index f83ac5b..0000000 --- a/nvim/.config/nvim/lua/custom/configs/mappings.lua +++ /dev/null @@ -1,68 +0,0 @@ -local M = {} - -vim.keymap.set("n", "]g", function () - vim.diagnostic.goto_next() -end) -vim.keymap.set("n", "[g", function () - vim.diagnostic.goto_prev() -end) - -M.dap = { - plugin = true, - n = { - ["db"] = { - " DapToggleBreakpoint ", - "Add breakpoint at line" - }, - ["dus"] = { - function () - local widgets = require("dap.ui.widgets"); - local sidebar = widgets.sidebar(widgets.scopes); - sidebar.open(); - end, - "open debugging sidebar" - } - } -} - -M.dap_go = { - plugin=true, - n = { - ["gdt"] = { - function() - require("dap-go").debug_test() - end, - "Debug go test" - }, - ["gdl"] = { - function() - require("dap-go").debug_last() - end, - "Debug last go test" - } - } -} - -M.dapui = { - n = { - ["dui"] = { - function() - require("dapui").toggle() - end, - "Open debuging ui" - } - } -} - -M.lsp = { - n = { - ["ww"] = { - function() - vim.diagnostic.open_float() - end, - "What's wrong with this line?" - } - } -} - -return M diff --git a/nvim/.config/nvim/lua/custom/configs/null-ls.lua b/nvim/.config/nvim/lua/custom/configs/null-ls.lua deleted file mode 100644 index 39c9df1..0000000 --- a/nvim/.config/nvim/lua/custom/configs/null-ls.lua +++ /dev/null @@ -1,29 +0,0 @@ -local null_ls = require("null-ls") -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - -local opts = { - sources = { - null_ls.builtins.formatting.gofmt, - null_ls.builtins.formatting.goimports, - null_ls.builtins.diagnostics.mypy, - null_ls.builtins.diagnostics.ruff, - null_ls.builtins.formatting.eslint, - null_ls.builtins.formatting.prettier, - }, - 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, -} -return opts diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua new file mode 100644 index 0000000..a704bc2 --- /dev/null +++ b/nvim/.config/nvim/lua/mappings.lua @@ -0,0 +1,17 @@ +require "nvchad.mappings" + + +local map = vim.keymap.set + +local M = {} + +map("n", "]g", function () + vim.diagnostic.goto_next() +end) +map("n", "[g", function () + vim.diagnostic.goto_prev() +end) + +map("n", "ww", function() + vim.diagnostic.open_float() +end) diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua new file mode 100644 index 0000000..292dee1 --- /dev/null +++ b/nvim/.config/nvim/lua/options.lua @@ -0,0 +1 @@ +require "nvchad.options" diff --git a/nvim/.config/nvim/lua/custom/plugins.lua b/nvim/.config/nvim/lua/plugins/init.lua similarity index 64% rename from nvim/.config/nvim/lua/custom/plugins.lua rename to nvim/.config/nvim/lua/plugins/init.lua index 8460f0a..b4b6fc6 100644 --- a/nvim/.config/nvim/lua/custom/plugins.lua +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -1,4 +1,16 @@ -local plugins = { +return { + { + "stevearc/conform.nvim", + event = "BufWritePre", -- uncomment for format on save + opts = require "configs.conform", + }, + + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + }, { "williamboman/mason.nvim", opts = { @@ -17,12 +29,15 @@ local plugins = { "codelldb", "tailwindcss-language-server", "golangci-lint-langserver", - } - } + "sonarlint-language-server", + "lua-language-server", + }, + }, }, { "nvim-neotest/nvim-nio" }, { - "mistricky/codesnap.nvim", build = "make build_generator", + "mistricky/codesnap.nvim", + build = "make build_generator", keys = { { "cc", "CodeSnap", mode = "x", desc = "Save selected code snapshot into clipboard" }, { "cs", "CodeSnapSave", mode = "x", desc = "Save selected code snapshot in ~/Pictures" }, @@ -36,80 +51,59 @@ local plugins = { }, }, { - "neovim/nvim-lspconfig", - config=function () - require "plugins.configs.lspconfig" - require "custom.configs.lspconfig" - end, - },{ - "jose-elias-alvarez/null-ls.nvim", - ft = "go", - opts = function() - return require "custom.configs.null-ls" - end, - }, { "mfussenegger/nvim-dap", - init = function() - require("core.utils").load_mappings("dap") - end - }, { + }, + { "leoluz/nvim-dap-go", ft = "go", dependencies = "mfussenegger/nvim-dap", - config = function (_, opts) + config = function(_, opts) require("dap-go").setup(opts) - require("core.utils").load_mappings("dap_go") - require('dap.ext.vscode').load_launchjs(nil, {}) - end - },{ + -- require("core.utils").load_mappings("dap_go") + require("dap.ext.vscode").load_launchjs(nil, {}) + end, + }, + { "mfussenegger/nvim-dap-python", ft = "python", dependencies = "mfussenegger/nvim-dap", - config = function (_, _) + config = function(_, _) local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" require("dap-python").setup(path) - end + end, }, { "NVChad/nvim-autopairs", - enabled = false + enabled = false, }, { - 'mrcjkb/rustaceanvim', - version = '^5', -- Recommended + "mrcjkb/rustaceanvim", + version = "^5", -- Recommended lazy = false, -- This plugin is already lazy }, { "rust-lang/rust.vim", ft = "rust", - init = function () + init = function() vim.g.rustfmt_autosave = 1 - end + end, }, { "saecki/crates.nvim", - ft = {"rust", "toml"}, + ft = { "rust", "toml" }, config = function(_, opts) - local crates = require("crates") + local crates = require "crates" crates.setup(opts) crates.show() - end - }, - { - "hrsh7th/nvim-cmp", - opts = function () - local M = require "plugins.configs.cmp" - table.insert(M.sources, {name = "crates"}) - return M - end + end, }, { "rcarriga/nvim-dap-ui", init = function() require("dapui").setup() - vim.fn.sign_define('DapBreakpoint', { text = '🐞' }) - vim.fn.sign_define('DapBreakpointRejected', { text = '🐞' }) - local dap, dapui = require("dap"), require("dapui") + vim.fn.sign_define("DapBreakpoint", { text = "🐞" }) + vim.fn.sign_define("DapBreakpointRejected", { text = "🐞" }) + local dap, dapui = require "dap", require "dapui" dap.listeners.before.attach.dapui_config = function() dapui.open() end @@ -122,7 +116,18 @@ local plugins = { dap.listeners.before.event_exited.dapui_config = function() dapui.close() end - end - } + end, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "vim", + "lua", + "vimdoc", + "html", + "css", + }, + }, + }, } -return plugins diff --git a/nvim/.config/nvim/lua/custom/configs/rust-tools.lua b/nvim/.config/nvim/lua/rust-tools.lua similarity index 100% rename from nvim/.config/nvim/lua/custom/configs/rust-tools.lua rename to nvim/.config/nvim/lua/rust-tools.lua diff --git a/nvim/.config/nvim/spell/en.utf-8.add b/nvim/.config/nvim/spell/en.utf-8.add new file mode 100644 index 0000000..0f9c754 --- /dev/null +++ b/nvim/.config/nvim/spell/en.utf-8.add @@ -0,0 +1,3 @@ +feat +Errored +Dreamkiln diff --git a/nvim/.config/nvim/spell/en.utf-8.add.spl b/nvim/.config/nvim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..4ba117d Binary files /dev/null and b/nvim/.config/nvim/spell/en.utf-8.add.spl differ diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config index 0437257..cfd4bb6 100644 --- a/waybar/.config/waybar/config +++ b/waybar/.config/waybar/config @@ -4,7 +4,7 @@ "modules-left": [ "sway/workspaces" ], - "modules-right": ["pulseaudio", "custom/wireguard", "backlight", "network", "cpu", "memory", "disk", "temperature", "battery", "clock", "tray"], + "modules-right": ["cava", "pulseaudio", "custom/wireguard", "backlight", "network", "cpu", "memory", "disk", "temperature", "battery", "clock", "tray"], "cpu": { "format": "CPU: {usage}%" }, @@ -25,11 +25,33 @@ "format": "{free}" }, "clock": { - "format": "{:%Y:%m:%d %T}" + "format": "{:%Y:%m:%d %T}", + "interval": 1 }, "custom/wireguard": { "exec": "~/.config/waybar/scripts/wireguard.sh", "on-click": "~/.config/waybar/scripts/wireguard.sh --toggle", "interval": 2 - } + }, + "cava": { + "framerate": 30, + "autosens": 1, + "sensitivity": 100, + "bars": 14, + "lower_cutoff_freq": 50, + "higher_cutoff_freq": 10000, + "method": "pulse", + "source": "auto", + "stereo": true, + "reverse": false, + "bar_delimiter": 0, + "monstercat": false, + "waves": false, + "noise_reduction": 0.77, + "input_delay": 2, + "format-icons" : ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" ], + "actions": { + "on-click-right": "mode" + } + } }