diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index d8bf33e..39d44b1 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,7 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, - "blame.nvim": { "branch": "main", "commit": "562661972085a273914c8f702b11924f8aa573ea" }, "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" }, "catppuccin": { "branch": "main", "commit": "f288876c6d05d3bb91b0e72b8031fe9e26ef05b8" }, "cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" }, @@ -20,7 +19,6 @@ "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "bf0f4f8062d3acbe0afcc61db01a4d19d96310e4" }, "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, @@ -28,10 +26,11 @@ "nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" }, "nvim-tmux-navigation": { "branch": "main", "commit": "d9efffa413a530bdea3783af4fea86be84940283" }, "nvim-treesitter": { "branch": "master", "commit": "4a4dbe1cb1da34d87fc42a40aaf8e218af4cfe0f" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" }, - "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" } + "vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" } } \ No newline at end of file diff --git a/nvim/lua/lilJ/core/remap.lua b/nvim/lua/lilJ/core/remap.lua index ac18419..7a4800d 100644 --- a/nvim/lua/lilJ/core/remap.lua +++ b/nvim/lua/lilJ/core/remap.lua @@ -6,61 +6,29 @@ vim.keymap.set("n", "n", vim.cmd.Ex) vim.keymap.set("x", "p", [["_dP]]) vim.keymap.set('n', 'P', '"+p') - -- some next greatest remaps vim.keymap.set({"n", "v"}, "y", [["+y]]) -vim.keymap.set("n", "Y", [["+Y]]) - vim.keymap.set({"n", "v"}, "d", [["_d]]) --- move lines smooth butter smooth vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") -vim.keymap.set('n', 'h', vim.cmd.split) -vim.keymap.set('n', 'v', vim.cmd.vsplit) + +-- stay in indent mode only +vim.keymap.set("v", "<", "", ">gv") + + +vim.keymap.set('n', 'vp', vim.cmd.split) +vim.keymap.set('n', 'hp', vim.cmd.vsplit) + -- Keep ya head straight vim.keymap.set("n", "J", "mzJ`z") vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') --- stay in indent mode only -vim.keymap.set("v", "<", "", ">gv") vim.keymap.set("n", "", vim.cmd.bnext) vim.keymap.set("n", "", vim.cmd.bprev) vim.keymap.set('n', 'q', vim.cmd.bdelete) - -vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - - callback = function(e) - vim.bo[e.buf].omnifunc = "v:lua.vim.lsp.omnifunc" - - local opts = { buffer = e.buf } - - local keymap = vim.keymap - - keymap.set("n", "K", vim.lsp.buf.hover, opts) - - keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - - keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) - - keymap.set("n", "gi", function() vim.lsp.buf.implementation() end, opts) - - keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - - keymap.set("n", "rn", vim.lsp.buf.rename, opts) - - keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - - keymap.set("n", "rr", function() vim.lsp.buf.references() end, opts) - - keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) - - keymap.set("n", "ws", function() vim.lsp.buf.workspace_symbol() end, opts) - end, -}) diff --git a/nvim/lua/lilJ/core/set.lua b/nvim/lua/lilJ/core/set.lua index 7453bc8..5058a84 100644 --- a/nvim/lua/lilJ/core/set.lua +++ b/nvim/lua/lilJ/core/set.lua @@ -8,6 +8,7 @@ vim.api.nvim_create_autocmd( "FileType", { pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] } ) +vim.opt.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*" vim.opt.tabstop = 4 vim.opt.softtabstop = 4 diff --git a/nvim/lua/lilJ/lazy/bufferline.lua b/nvim/lua/lilJ/lazy/bufferline.lua index 1276987..68bc3e0 100644 --- a/nvim/lua/lilJ/lazy/bufferline.lua +++ b/nvim/lua/lilJ/lazy/bufferline.lua @@ -1,8 +1,11 @@ -return{ +return { { "akinsho/bufferline.nvim", + version = "*", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() require("bufferline").setup{ options={ diff --git a/nvim/lua/lilJ/lazy/conform.lua b/nvim/lua/lilJ/lazy/conform.lua.bak similarity index 78% rename from nvim/lua/lilJ/lazy/conform.lua rename to nvim/lua/lilJ/lazy/conform.lua.bak index d1c6507..7c1ea7d 100644 --- a/nvim/lua/lilJ/lazy/conform.lua +++ b/nvim/lua/lilJ/lazy/conform.lua.bak @@ -1,32 +1,37 @@ -return { +--[[ return { "stevearc/conform.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() local conform = require("conform") conform.setup({ formatters_by_ft = { lua = { "stylua" }, + html = { "htmlbeautifier" }, + css = { { "prettierd", "prettier" } }, javascript = { { "prettierd", "prettier" } }, typescript = { { "prettierd", "prettier" } }, javascriptreact = { { "prettierd", "prettier" } }, typescriptreact = { { "prettierd", "prettier" } }, json = { { "prettierd", "prettier" } }, markdown = { { "prettierd", "prettier" } }, - html = { "htmlbeautifier" }, - css = { { "prettierd", "prettier" } }, - go = { "gofmt" }, - cpp = { "clangformat" }, - c = { "clangformat" }, }, }) - vim.keymap.set({ "n", "v" }, "l", function() + vim.keymap.set({ "n", "v" }, "ll", function() conform.format({ lsp_fallback = true, async = false, timeout_ms = 500, + + -- Format on save + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, }) end, { desc = "Format file or range (in visual mode)" }) end, -} +} ]] diff --git a/nvim/lua/lilJ/lazy/indentblankline.lua b/nvim/lua/lilJ/lazy/indentblankline.lua index 80e5b55..b7a4f0b 100644 --- a/nvim/lua/lilJ/lazy/indentblankline.lua +++ b/nvim/lua/lilJ/lazy/indentblankline.lua @@ -1,5 +1,6 @@ return{ "lukas-reineke/indent-blankline.nvim", + config = function() local highlight = { "RainbowRed", @@ -24,8 +25,13 @@ return{ end) vim.g.rainbow_delimiters = { highlight = highlight } - require("ibl").setup { scope = { highlight = highlight } } + require("ibl").setup { + scope = { + highlight = highlight, + char = '┊', + }, + } -hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) - end, + hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) + end } diff --git a/nvim/lua/lilJ/lazy/init.lua b/nvim/lua/lilJ/lazy/init.lua index a25f4e0..3374127 100644 --- a/nvim/lua/lilJ/lazy/init.lua +++ b/nvim/lua/lilJ/lazy/init.lua @@ -1,39 +1,10 @@ return { - "nvim-lua/plenary.nvim", "github/copilot.vim", "nvim-tree/nvim-web-devicons", - { - "RRethy/vim-illuminate", - config = function() - require("illuminate") - end, - }, - - { - "FabijanZulj/blame.nvim", - config = function() - require("blame").setup{} - end - }, - - { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - ft = { "markdown" }, - build = function() vim.fn["mkdp#util#install"]() end, - }, - - { - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup() - end - }, - { "numToStr/Comment.nvim", config = function() @@ -50,6 +21,21 @@ return { end }, + { + "folke/todo-comments.nvim", + dependencies = { + "nvim-lua/plenary.nvim" + }, + -- TODO: this is not working + opts = {}, + }, + + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + end + }, { "NvChad/nvim-colorizer.lua", @@ -59,4 +45,11 @@ return { }, }, }, + + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() vim.fn["mkdp#util#install"]() end, + }, } diff --git a/nvim/lua/lilJ/lazy/lint.lua b/nvim/lua/lilJ/lazy/lint.lua index 9bf3972..e6a83a7 100644 --- a/nvim/lua/lilJ/lazy/lint.lua +++ b/nvim/lua/lilJ/lazy/lint.lua @@ -1,9 +1,11 @@ return { "mfussenegger/nvim-lint", + event = { "BufReadPre", "BufNewFile", }, + config = function() local lint = require("lint") @@ -12,25 +14,13 @@ return { typescript = { "eslint_d" }, javascriptreact = { "eslint_d" }, typescriptreact = { "eslint_d" }, - go = { "golangci_lint" }, - html = { "htmlhint" }, - css = { "stylelint" }, python = { "flake8" }, - cpp = { "clangtidy" }, - c = { "clangtidy" }, } - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { - group = lint_augroup, callback = function() lint.try_lint() end, }) - - vim.keymap.set("n", "ll", function() - lint.try_lint() - end, { desc = "Trigger linting for current file" }) end, } diff --git a/nvim/lua/lilJ/lazy/lsp/completions.lua b/nvim/lua/lilJ/lazy/lsp/completions.lua index 867940f..4ab979c 100644 --- a/nvim/lua/lilJ/lazy/lsp/completions.lua +++ b/nvim/lua/lilJ/lazy/lsp/completions.lua @@ -1,25 +1,27 @@ -return{ +return { "hrsh7th/nvim-cmp", event = "InsertEnter", dependencies = { - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", "rafamadriz/friendly-snippets", "onsails/lspkind.nvim", + "hrsh7th/cmp-buffer", }, config = function() local cmp = require("cmp") local luasnip = require("luasnip") - local lspkind = require("lspkind") - local cmp_select = {behavior = cmp.SelectBehavior.Select} + local lspkind = require("lspkind") + require("luasnip.loaders.from_vscode").lazy_load() + luasnip.config.setup({}) cmp.setup({ snippet = { @@ -28,24 +30,34 @@ return{ end, }, + completion = { + completeopt = "menu,menuone,noselect", + }, + mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.complete(), - [""] = cmp.mapping.select_prev_item(cmp_select), [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.select_prev_item(cmp_select), [""] = cmp.mapping.confirm({ select = true }), + ["CR"] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), }), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, { name = "path" }, + { name = "treesitter" }, + { name = "tmux" }, }, { - { name = 'buffer' }, + { name = "buffer" }, }), formatting = { format = lspkind.cmp_format({ - maxwidth = 50, + maxwidth = 25, ellipses_char = "", }), }, diff --git a/nvim/lua/lilJ/lazy/lsp/mason.lua b/nvim/lua/lilJ/lazy/lsp/mason.lua index b5868a2..422c3d4 100644 --- a/nvim/lua/lilJ/lazy/lsp/mason.lua +++ b/nvim/lua/lilJ/lazy/lsp/mason.lua @@ -1,30 +1,27 @@ return { - "neovim/nvim-lspconfig", + "williamboman/mason.nvim", event = { "BufReadPre", "BufNewFile" }, dependencies = { "j-hui/fidget.nvim", - "hrsh7th/cmp-nvim-lsp", - "williamboman/mason.nvim", + "neovim/nvim-lspconfig", "williamboman/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", }, config = function() - require("fidget").setup({}) + require("fidget").setup({ + progress = { + display = { + render_limit = 3, + }, + }, + }) local mason = require("mason") local mason_lspconfig = require("mason-lspconfig") - local mason_tool_installer = require("mason-tool-installer") - local cmp_lsp = require("cmp_nvim_lsp") - - local capabilities = vim.tbl_deep_extend( - "force", - {}, - vim.lsp.protocol.make_client_capabilities(), - cmp_lsp.default_capabilities()) + local lspconfig = require("lspconfig") mason.setup({ ui = { @@ -36,68 +33,84 @@ return { }, }) + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = cmp_lsp.default_capabilities(capabilities) + + vim.api.nvim_buf_create_user_command(0, 'Format', function(_) + if vim.lsp.buf.format then + vim.lsp.buf.format() + elseif vim.lsp.buf.formatting then + vim.lsp.buf.formatting() + end + end, {}) + + local on_attach = function(_, bufnr) + local buf_map = vim.api.nvim_buf_set_keymap + + local opts = { noremap = true, silent = true } + + buf_map(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) + + buf_map(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) + + buf_map(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) + + buf_map(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) + + buf_map(bufnr, { "n", "v" }, "ca", "lua vim.lsp.buf.code_action()", opts) + + buf_map(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opts) + + buf_map(bufnr, "n", "vd", "lua vim.diagnostic.open_float()", opts) + + buf_map(bufnr, "n", "rr", "lua vim.lsp.buf.references()", opts) + + buf_map(bufnr, "i", "", "lua vim.lsp.buf.signature_help()", opts) + + buf_map(bufnr, "n", "ws", "lua vim.lsp.buf.workspace_symbol()", opts) + end + mason_lspconfig.setup({ ensure_installed = { - "tsserver", - "html", - "cssls", "clangd", - "tailwindcss", + "cssls", + "gopls", + "html", "prismals", "pyright", + "tailwindcss", + "tsserver", }, + automatic_installation = true, handlers = { function(server_name) - require("lspconfig")[server_name].setup { + lspconfig[server_name].setup { capabilities = capabilities, + on_attach = on_attach, + settings = { + [server_name] = { + analyses = { + unusedparams = true, + }, + usePlaceholders = true, + }, + }, } end, ["lua_ls"] = function() - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup({ capabilities = capabilities, settings = { Lua = { - diagnostics = { - globals = {"vim"}, - }, + diagnostics = { globals = {"vim"} }, }, }, }) end, - - ["tsserver"] = function() - local lspconfig = require("lspconfig") - - lspconfig.tsserver.setup({ - capabilities = capabilities, - on_attach = function(client) - client.resolved_capabilities.document_formatting = true - end, - }) - end, - }, - }) - - mason_tool_installer.setup({ - ensure_installed = { - "prettier", - "prettierd", - "stylua", - "pylint", - "eslint_d", - "htmlbeautifier", }, }) end, - - opts = { - servers = { - tailwindcss = {}, - }, - }, } diff --git a/nvim/lua/lilJ/lazy/lualine.lua b/nvim/lua/lilJ/lazy/lualine.lua index e902dd6..cc125be 100644 --- a/nvim/lua/lilJ/lazy/lualine.lua +++ b/nvim/lua/lilJ/lazy/lualine.lua @@ -1,6 +1,10 @@ return { "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, + + dependencies = { + "nvim-tree/nvim-web-devicons" + }, + config = function() require('lualine').setup { options = { diff --git a/nvim/lua/lilJ/lazy/treesitter.lua b/nvim/lua/lilJ/lazy/treesitter.lua index e2620a9..66be8de 100644 --- a/nvim/lua/lilJ/lazy/treesitter.lua +++ b/nvim/lua/lilJ/lazy/treesitter.lua @@ -1,10 +1,16 @@ return { { "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() require("nvim-treesitter.configs").setup ({ - ensure_installed = { "cpp", "typescript", "tsx", "c", "python", "go", "html" }, + ensure_installed = { "typescript", "tsx", "python", "go", "c", "cpp", "lua", "markdown" }, sync_install = false, diff --git a/nvim/lua/lilJ/lazy/trouble.lua b/nvim/lua/lilJ/lazy/trouble.lua index ad0f600..00e8def 100644 --- a/nvim/lua/lilJ/lazy/trouble.lua +++ b/nvim/lua/lilJ/lazy/trouble.lua @@ -1,6 +1,7 @@ -return{ +return { { "folke/trouble.nvim", + config = function() require("trouble").setup { icons=true, diff --git a/nvim/lua/lilJ/lazy_init.lua b/nvim/lua/lilJ/lazy_init.lua index 09e70a2..9cafe56 100644 --- a/nvim/lua/lilJ/lazy_init.lua +++ b/nvim/lua/lilJ/lazy_init.lua @@ -16,6 +16,7 @@ require("lazy").setup({ { import = "lilJ.lazy.lsp" } }, { change_detection = { + enabled = true, notify = false, }, })