From c5fbb6c4b74cd5a6e47bbc23b26be8408f713989 Mon Sep 17 00:00:00 2001 From: Kulvir Singh Date: Sat, 20 Jan 2024 02:08:45 +0530 Subject: [PATCH] added new plugins --- nvim/lazy-lock.json | 35 ++++++++++++++++------------- nvim/lua/lilJ/core/remap.lua | 13 ++++++----- nvim/lua/lilJ/core/set.lua | 7 ++++-- nvim/lua/lilJ/lazy/blame.lua | 7 ------ nvim/lua/lilJ/lazy/conform.lua | 32 ++++++++++++++++++++++++++ nvim/lua/lilJ/lazy/init.lua | 37 ++++++++++++++++++++++++------- nvim/lua/lilJ/lazy/lint.lua | 36 ++++++++++++++++++++++++++++++ nvim/lua/lilJ/lazy/lsp/mason.lua | 4 +++- nvim/lua/lilJ/lazy/treesitter.lua | 2 +- 9 files changed, 132 insertions(+), 41 deletions(-) delete mode 100644 nvim/lua/lilJ/lazy/blame.lua create mode 100644 nvim/lua/lilJ/lazy/conform.lua create mode 100644 nvim/lua/lilJ/lazy/lint.lua diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0bf9af4..d8bf33e 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,34 +1,37 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "2f0db89fcb22d27b908b3609d2441c02798106ab" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, "blame.nvim": { "branch": "main", "commit": "562661972085a273914c8f702b11924f8aa573ea" }, "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" }, - "catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, + "catppuccin": { "branch": "main", "commit": "f288876c6d05d3bb91b0e72b8031fe9e26ef05b8" }, "cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "copilot.vim": { "branch": "release", "commit": "5b19fb001d7f31c4c7c5556d7a97b243bd29f45f" }, - "fidget.nvim": { "branch": "main", "commit": "a4a7edfea37e557dbff5509ee374ffb57051bba9" }, - "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, - "gitsigns.nvim": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3c8a185da4b8ab7aef487219f5e001b11d4b6aaf" }, - "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, - "lspkind.nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" }, + "conform.nvim": { "branch": "master", "commit": "cbc5745bf7519acaf3a5cbaaa677fd556aa813d7" }, + "copilot.vim": { "branch": "release", "commit": "49e0348bfb913fae63ca5ddb987a8bccd193da86" }, + "fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "747bb955c5bfb2dc5d51280132f00a56a53f9f6d" }, + "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "0989bdf4fdf7b5aa4c74131d7ffccc3f399ac788" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "8b70e7f1e0a4119c1234c3bde4a01c241cabcc74" }, + "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" }, - "nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" }, + "nvim-lint": { "branch": "master", "commit": "b32127ba52f3a1f7dc86773c2ca3f0029afa12c1" }, + "nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" }, "nvim-tmux-navigation": { "branch": "main", "commit": "d9efffa413a530bdea3783af4fea86be84940283" }, - "nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" }, - "nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" }, + "nvim-treesitter": { "branch": "master", "commit": "4a4dbe1cb1da34d87fc42a40aaf8e218af4cfe0f" }, + "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": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" } + "vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" }, + "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" } } \ No newline at end of file diff --git a/nvim/lua/lilJ/core/remap.lua b/nvim/lua/lilJ/core/remap.lua index 696c836..ac18419 100644 --- a/nvim/lua/lilJ/core/remap.lua +++ b/nvim/lua/lilJ/core/remap.lua @@ -1,8 +1,11 @@ vim.g.mapleader = " " + vim.keymap.set("n", "n", vim.cmd.Ex) -- Prime said this is greatest remap ever vim.keymap.set("x", "p", [["_dP]]) +vim.keymap.set('n', 'P', '"+p') + -- some next greatest remaps vim.keymap.set({"n", "v"}, "y", [["+y]]) @@ -14,12 +17,6 @@ vim.keymap.set({"n", "v"}, "d", [["_d]]) vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") --- Pasting from clipboard hurts in vim -vim.keymap.set('n', 'P', '"+p') - --- Copying to Clipboard ---vim.keymap.set('v', 'y', '"+y') - vim.keymap.set('n', 'h', vim.cmd.split) vim.keymap.set('n', 'v', vim.cmd.vsplit) @@ -28,6 +25,10 @@ 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) diff --git a/nvim/lua/lilJ/core/set.lua b/nvim/lua/lilJ/core/set.lua index 3baee97..7453bc8 100644 --- a/nvim/lua/lilJ/core/set.lua +++ b/nvim/lua/lilJ/core/set.lua @@ -12,12 +12,15 @@ vim.api.nvim_create_autocmd( vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 -vim.opt.shiftround = true vim.opt.expandtab = true vim.opt.smartindent = true +vim.opt.smartcase = true -vim.opt.wrap = true +vim.opt.wrap = false + +vim.opt.hlsearch = true +vim.opt.incsearch = true vim.opt.scrolloff = 8 vim.opt.signcolumn = 'yes' diff --git a/nvim/lua/lilJ/lazy/blame.lua b/nvim/lua/lilJ/lazy/blame.lua deleted file mode 100644 index 2ac23a1..0000000 --- a/nvim/lua/lilJ/lazy/blame.lua +++ /dev/null @@ -1,7 +0,0 @@ -return{ - "FabijanZulj/blame.nvim", - config = function() - require("blame").setup{} - end -} - diff --git a/nvim/lua/lilJ/lazy/conform.lua b/nvim/lua/lilJ/lazy/conform.lua new file mode 100644 index 0000000..d1c6507 --- /dev/null +++ b/nvim/lua/lilJ/lazy/conform.lua @@ -0,0 +1,32 @@ +return { + "stevearc/conform.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local conform = require("conform") + + conform.setup({ + formatters_by_ft = { + lua = { "stylua" }, + 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() + conform.format({ + lsp_fallback = true, + async = false, + timeout_ms = 500, + }) + end, { desc = "Format file or range (in visual mode)" }) + end, +} diff --git a/nvim/lua/lilJ/lazy/init.lua b/nvim/lua/lilJ/lazy/init.lua index 19bf44c..a25f4e0 100644 --- a/nvim/lua/lilJ/lazy/init.lua +++ b/nvim/lua/lilJ/lazy/init.lua @@ -1,9 +1,31 @@ -return{ +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", @@ -12,10 +34,10 @@ return{ end }, - { - "numToStr/Comment.nvim", - config = function() - require('Comment').setup({ + { + "numToStr/Comment.nvim", + config = function() + require('Comment').setup({ toggler = { line = "gcc", block = "gbc", @@ -25,10 +47,9 @@ return{ block = "gb", }, }) - end - }, + end + }, - "nvim-tree/nvim-web-devicons", { "NvChad/nvim-colorizer.lua", diff --git a/nvim/lua/lilJ/lazy/lint.lua b/nvim/lua/lilJ/lazy/lint.lua new file mode 100644 index 0000000..9bf3972 --- /dev/null +++ b/nvim/lua/lilJ/lazy/lint.lua @@ -0,0 +1,36 @@ +return { + "mfussenegger/nvim-lint", + event = { + "BufReadPre", + "BufNewFile", + }, + config = function() + local lint = require("lint") + + lint.linters_by_ft = { + javascript = { "eslint_d" }, + 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/mason.lua b/nvim/lua/lilJ/lazy/lsp/mason.lua index 086bf73..b5868a2 100644 --- a/nvim/lua/lilJ/lazy/lsp/mason.lua +++ b/nvim/lua/lilJ/lazy/lsp/mason.lua @@ -86,9 +86,11 @@ return { mason_tool_installer.setup({ ensure_installed = { "prettier", + "prettierd", "stylua", - -- "pylint", + "pylint", "eslint_d", + "htmlbeautifier", }, }) end, diff --git a/nvim/lua/lilJ/lazy/treesitter.lua b/nvim/lua/lilJ/lazy/treesitter.lua index 06d538d..e2620a9 100644 --- a/nvim/lua/lilJ/lazy/treesitter.lua +++ b/nvim/lua/lilJ/lazy/treesitter.lua @@ -4,7 +4,7 @@ return { build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup ({ - ensure_installed = { "cpp", "typescript", "tsx", "c", "python" }, + ensure_installed = { "cpp", "typescript", "tsx", "c", "python", "go", "html" }, sync_install = false,