From c844d7eb4d5f568e8c32a7ba9117056504633fe8 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Mon, 30 Oct 2023 19:53:33 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20lsp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 3 +- lazy-lock.json | 67 +-- .../default_config.lua => config/default.lua} | 3 - lua/config/lazy.lua | 51 ++ lua/{core/init.lua => config/options.lua} | 4 +- lua/plugin/init.lua | 518 ------------------ lua/{plugin => plugins}/config/autopairs.lua | 0 lua/{plugin => plugins}/config/bqf.lua | 0 lua/{plugin => plugins}/config/bufferline.lua | 4 +- lua/{plugin => plugins}/config/bufresize.lua | 2 +- lua/{plugin => plugins}/config/cmp.lua | 0 .../config/colorscheme.lua | 2 +- lua/{plugin => plugins}/config/dashboard.lua | 6 +- lua/{plugin => plugins}/config/diffview.lua | 0 lua/{plugin => plugins}/config/gitsigns.lua | 0 lua/{plugin => plugins}/config/hop.lua | 2 +- .../config/indent_blankline.lua | 0 lua/{plugin => plugins}/config/lastplace.lua | 0 lua/{plugin => plugins}/config/legendary.lua | 8 +- .../config/lsp-signature.lua | 0 lua/{plugin => plugins}/config/lsp.lua | 0 .../config/manson-tool-installer.lua | 0 lua/{plugin => plugins}/config/modes.lua | 0 lua/{plugin => plugins}/config/neogit.lua | 0 .../config/notification.lua | 0 lua/{plugin => plugins}/config/nvimtree.lua | 4 +- .../config/relativenumber.lua | 0 lua/{plugin => plugins}/config/rest.lua | 0 lua/{plugin => plugins}/config/smartsplit.lua | 0 .../config/smoothcursor.lua | 0 lua/{plugin => plugins}/config/statusline.lua | 2 +- lua/{plugin => plugins}/config/telescope.lua | 2 +- lua/{plugin => plugins}/config/treesitter.lua | 0 lua/{plugin => plugins}/config/treesj.lua | 0 .../config/typescript-tools.lua | 0 lua/{plugin => plugins}/config/ufo.lua | 0 lua/plugins/init.lua | 378 +++++++++++++ lua/plugins/lsp/lspconfig.lua | 187 +++++++ lua/plugins/lsp/mason.lua | 50 ++ lua/plugins/lsp/none-ls.lua | 74 +++ stylua.toml | 3 + 41 files changed, 795 insertions(+), 575 deletions(-) rename lua/{core/default_config.lua => config/default.lua} (97%) create mode 100644 lua/config/lazy.lua rename lua/{core/init.lua => config/options.lua} (96%) delete mode 100644 lua/plugin/init.lua rename lua/{plugin => plugins}/config/autopairs.lua (100%) rename lua/{plugin => plugins}/config/bqf.lua (100%) rename lua/{plugin => plugins}/config/bufferline.lua (93%) rename lua/{plugin => plugins}/config/bufresize.lua (88%) rename lua/{plugin => plugins}/config/cmp.lua (100%) rename lua/{plugin => plugins}/config/colorscheme.lua (98%) rename lua/{plugin => plugins}/config/dashboard.lua (86%) rename lua/{plugin => plugins}/config/diffview.lua (100%) rename lua/{plugin => plugins}/config/gitsigns.lua (100%) rename lua/{plugin => plugins}/config/hop.lua (96%) rename lua/{plugin => plugins}/config/indent_blankline.lua (100%) rename lua/{plugin => plugins}/config/lastplace.lua (100%) rename lua/{plugin => plugins}/config/legendary.lua (93%) rename lua/{plugin => plugins}/config/lsp-signature.lua (100%) rename lua/{plugin => plugins}/config/lsp.lua (100%) rename lua/{plugin => plugins}/config/manson-tool-installer.lua (100%) rename lua/{plugin => plugins}/config/modes.lua (100%) rename lua/{plugin => plugins}/config/neogit.lua (100%) rename lua/{plugin => plugins}/config/notification.lua (100%) rename lua/{plugin => plugins}/config/nvimtree.lua (94%) rename lua/{plugin => plugins}/config/relativenumber.lua (100%) rename lua/{plugin => plugins}/config/rest.lua (100%) rename lua/{plugin => plugins}/config/smartsplit.lua (100%) rename lua/{plugin => plugins}/config/smoothcursor.lua (100%) rename lua/{plugin => plugins}/config/statusline.lua (98%) rename lua/{plugin => plugins}/config/telescope.lua (98%) rename lua/{plugin => plugins}/config/treesitter.lua (100%) rename lua/{plugin => plugins}/config/treesj.lua (100%) rename lua/{plugin => plugins}/config/typescript-tools.lua (100%) rename lua/{plugin => plugins}/config/ufo.lua (100%) create mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/lsp/lspconfig.lua create mode 100644 lua/plugins/lsp/mason.lua create mode 100644 lua/plugins/lsp/none-ls.lua create mode 100644 stylua.toml diff --git a/init.lua b/init.lua index 46c126d..55b8979 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1 @@ -require "core" -require "plugin" +require("config.lazy") diff --git a/lazy-lock.json b/lazy-lock.json index 160e1ee..a1c466e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,14 +1,14 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "0df29db3543837f8b41597f2640397c5ec792b7b" }, - "SmoothCursor.nvim": { "branch": "main", "commit": "efe978cb59a752adbc5908aefde1de1d0e1fc87b" }, + "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, + "SmoothCursor.nvim": { "branch": "main", "commit": "8c2c5d61899a5c0ecc1dc34827a6eda1270cebdf" }, "agrolens.nvim": { "branch": "main", "commit": "a2f15094a2b7e7bc79184de8edc13034116d8d47" }, "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" }, "bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" }, "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, - "catppuccin": { "branch": "main", "commit": "fc537040147f0374a22b88142a20eb6781141f0b" }, + "catppuccin": { "branch": "main", "commit": "b359f3eec32dcc6b7c9a26901dc235bbb6cd8a0b" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, @@ -23,57 +23,58 @@ "diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" }, "dressing.nvim": { "branch": "master", "commit": "1f2d1206a03bd3add8aedf6251e4534611de577f" }, "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, - "flash.nvim": { "branch": "main", "commit": "6d76c5dee65181ab55cbdfb0760260e800d643f4" }, + "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, - "guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" }, + "gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" }, + "guihua.lua": { "branch": "master", "commit": "9c3e3ba03ac65782e950bd21434bbbfe8dfb6f50" }, "hlargs.nvim": { "branch": "main", "commit": "6218a401824c5733ac50b264991b62d064e85ab2" }, - "indent-blankline.nvim": { "branch": "master", "commit": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572" }, - "iswap.nvim": { "branch": "master", "commit": "8b038cb10585713b4c3918d44d6c329effad2a5d" }, + "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, + "iswap.nvim": { "branch": "master", "commit": "e05889db694524f68eb69567a70a98470994b890" }, "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, - "lazy.nvim": { "branch": "main", "commit": "33c447b96e1cb1a5a2be87982d5d32bb5054079d" }, - "legendary.nvim": { "branch": "master", "commit": "be1de69822e6329ef5ae87521a70911c434aa9eb" }, - "lsp_lines.nvim": { "branch": "main", "commit": "9e3f99fbbd28aaec80dc0158c43be8cca8dd5017" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" }, + "lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" }, + "legendary.nvim": { "branch": "master", "commit": "234e2ef8dec65db153c63a8b310c74155bb93ee7" }, + "lsp_lines.nvim": { "branch": "main", "commit": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "e4f34741daa9cf95de68a603d3e7a6844a69fdf0" }, "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, - "modes.nvim": { "branch": "main", "commit": "9ca1d683e9505f6fdc97a884151267cfc380a379" }, - "neoconf.nvim": { "branch": "main", "commit": "393d37abd9d82adcac627309a41758ae8e140d9e" }, - "neodev.nvim": { "branch": "main", "commit": "a4b6e7ca11ff5be2264d5c169fcedd97d8699ec4" }, - "neogit": { "branch": "master", "commit": "d3fbf8b48f4f8bc406eb23f8b06eb912776f8cb0" }, + "modes.nvim": { "branch": "main", "commit": "5357fda0f4a21d73611496087a0d3b6d7b4f9384" }, + "neoconf.nvim": { "branch": "main", "commit": "00dcf2b81c45de1768b4171faa16729f0888cfb8" }, + "neogit": { "branch": "master", "commit": "05899be06d611c485cfb6e17ef6e3b695de67b62" }, "neon": { "branch": "main", "commit": "7765aaa7d1cd3804176140644640766e4411c766" }, - "nightly": { "branch": "main", "commit": "fbab0f60e2d92d119f6e0cf50c503dcd7753659e" }, - "nvim-autopairs": { "branch": "master", "commit": "748e72c05495a3d30e88a6ef04b21697019a9aa9" }, + "nightly": { "branch": "main", "commit": "825299e1dfafc093918137e752bde2dbaed60503" }, + "none-ls.nvim": { "branch": "main", "commit": "b8fd44ee1616e6a9c995ed5f94ad9f1721d303ef" }, + "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, "nvim-bqf": { "branch": "main", "commit": "8784eebf34371049b641646d00232c2603215297" }, - "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, - "nvim-lsp-file-operations": { "branch": "master", "commit": "0ae13ac58136c6175638b6e1ba04cb487dd22272" }, - "nvim-lspconfig": { "branch": "master", "commit": "61f984586fefa9869f07f3027e0dce5752412786" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "1e0ffa0acc92f88f9f2b68df47ccbe1917653a42" }, + "nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-tmux-navigation": { "branch": "main", "commit": "543f090a45cef28156162883d2412fffecb6b750" }, - "nvim-tree.lua": { "branch": "master", "commit": "53b0bcaadaffb505acff230578b56a86ec1ab38a" }, - "nvim-treesitter": { "branch": "master", "commit": "49f7194e4c4d3c9ed891b0968798c062e8ac5a3d" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" }, + "nvim-tree.lua": { "branch": "master", "commit": "7e3c0bee7b246ca835d5f7453db6fa19de359bab" }, + "nvim-treesitter": { "branch": "master", "commit": "a8c14d68b024ffc20baec92d1acc91796bcfb485" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" }, - "nvim-ufo": { "branch": "main", "commit": "f7eea53e88456403212df074b9aa3148a3908435" }, - "nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" }, + "nvim-ufo": { "branch": "main", "commit": "ebbab711d909d5f675e38ad489765bd22bd2c6b3" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" }, "relative-toggle.nvim": { "branch": "main", "commit": "fabe2f60f5f148f2bf1fb76e8a542f5adf8d996a" }, - "rest.nvim": { "branch": "main", "commit": "5bcaa1012ea8efd6093c69d2a4c67fbde760d043" }, + "rest.nvim": { "branch": "main", "commit": "b8d6c0a8762fd374e0204768a94241135ca3e311" }, "sad.nvim": { "branch": "master", "commit": "869c7f3ca3dcd28fd78023db6a7e1bf8af0f4714" }, "smart-pairs": { "branch": "master", "commit": "6e7a5a8e3906f7a8a8c5b8603d5264ff1b5d87c3" }, - "smart-splits.nvim": { "branch": "master", "commit": "dbf2c13bad1b75ab207639ba817a7e8a8a450042" }, + "smart-splits.nvim": { "branch": "master", "commit": "c8a9173d70cbbd1f6e4a414e49e31df2b32a1362" }, "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, - "tokyonight.nvim": { "branch": "main", "commit": "dce0ab49ae751f4f3617ab42d6f20c72369c7cb1" }, - "treesj": { "branch": "main", "commit": "81d0ae51b84143e228d27b6cf79d09012d2021cb" }, - "typescript-tools.nvim": { "branch": "master", "commit": "ebddb35900bbf5fa41fffa0463b676bf08e474e6" }, + "tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" }, + "treesj": { "branch": "main", "commit": "070e6761d0b11a55446d988a69908f7a0928dbab" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "vim-snippets": { "branch": "master", "commit": "ccc2fa1529d372f7ac16d5eb07a385a72b50e05d" }, diff --git a/lua/core/default_config.lua b/lua/config/default.lua similarity index 97% rename from lua/core/default_config.lua rename to lua/config/default.lua index d118ed6..92860d0 100644 --- a/lua/core/default_config.lua +++ b/lua/config/default.lua @@ -20,11 +20,8 @@ M.options = { M.ui = { theme_toggle = { - "nightly", "tokyonight", - "kanagawa", "catppuccin", - "neon" }, theme = "catppuccin", transparency = true, diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..e94f6bc --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,51 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + local success, maybe_error = pcall( + vim.fn.system, { + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + } + ) + if not success then + require('plugins.config.notification').error("ERROR: Fail to install plugin manager lazy.nvim", maybe_error) + require('plugins.config.notification').info("You can cleanup the " .. lazypath .. " and start again") + return + end +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + { import = "plugins" }, + { import = "plugins.lsp" }, + }, + defaults = { + lazy = false, + version = false, + }, + install = { colorscheme = { "catppuccin" } }, + checker = { enabled = true }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) + + +require("plugins.config.colorscheme").setup() + +------------------------------- +------------ keymaps ---------- +------------------------------- +require("config.default").keymaps.default() diff --git a/lua/core/init.lua b/lua/config/options.lua similarity index 96% rename from lua/core/init.lua rename to lua/config/options.lua index 72e5026..55e27ab 100644 --- a/lua/core/init.lua +++ b/lua/config/options.lua @@ -83,6 +83,4 @@ g.mapleader = " " g.maplocalleader = "\\" g.markdown_recommended_style = 0 ------------- autocommand ---------- - -require('core.default_config').load_extra_options() +require("config.default").load_extra_options() diff --git a/lua/plugin/init.lua b/lua/plugin/init.lua deleted file mode 100644 index 33b1920..0000000 --- a/lua/plugin/init.lua +++ /dev/null @@ -1,518 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - local success, maybe_error = pcall( - vim.fn.system, { - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - } - ) - if not success then - require('plugin.config.notification').error("ERROR: Fail to install plugin manager lazy.nvim", maybe_error) - require('plugin.config.notification').info("You can cleanup the " .. lazypath .. " and start again") - return - end -end -vim.opt.rtp:prepend(lazypath) - -local plugins = { - { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { - "folke/neodev.nvim", - config = function() - require("neodev").setup() - end - }, - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - { - "j-hui/fidget.nvim", - branch = "legacy" - }, - { - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - config = function() - require("lsp_lines").setup() - end, - }, - }, - config = function() - require("plugin.config.lsp").setup() - end, - cmd = { "Mason" } - }, - { - "pmizio/typescript-tools.nvim", - ft = { "typescript", "typescriptreact" }, - event = { - "BufReadPost", - "BufNewFile", - }, - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-lspconfig", - }, - -- opts = { - -- on_attach = require('plugin.config.typescript-tools').on_attach, - -- settings = { - -- separate_diagnostic_server = true, - -- tsserver_file_preferences = { - -- includeInlayParameterNameHints = 'literals', - -- includeInlayVariableTypeHints = true, - -- includeInlayFunctionLikeReturnTypeHints = true, - -- includeCompletionsForModuleExports = true, - -- quotePreference = "auto", - -- }, - -- }, - -- }, - }, - { - "folke/neoconf.nvim", - cmd = "Neoconf", - config = function() - require("neoconf").setup() - end - }, - { - -- AutoCompletion - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-nvim-lua", - "ray-x/cmp-treesitter", - "lukas-reineke/cmp-rg", - "quangnguyen30192/cmp-nvim-tags", - "andersevenrud/cmp-tmux", - "saadparwaiz1/cmp_luasnip", - "L3MON4D3/LuaSnip", - "rafamadriz/friendly-snippets", - "lukas-reineke/cmp-under-comparator", - { - "honza/vim-snippets", - dependencies = { - "friendly-snippets", - "vim-snippets", - } - } - }, - config = function() - require("plugin.config.cmp").setup() - end - }, - { - -- File Syntax - "nvim-treesitter/nvim-treesitter", - event = { - "BufReadPost", - "BufNewFile", - }, - build = function() - pcall(require("nvim-treesitter.install").update { with_sync = false }) - end, - config = function() - require("plugin.config.treesitter").setup() - end, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - "nvim-treesitter/nvim-treesitter-textobjects", - "p00f/nvim-ts-rainbow", - "HiPhish/nvim-ts-rainbow2", - "windwp/nvim-ts-autotag", - "mizlan/iswap.nvim", - { - "m-demare/hlargs.nvim", - config = function() - require("hlargs").setup() - end - }, - { - "ZhiyuanLck/smart-pairs", - event = "InsertEnter", - config = function() - require("pairs"):setup() - end - } - } - }, - { - "kevinhwang91/nvim-ufo", - dependencies = "kevinhwang91/promise-async", - event = "BufReadPost", - config = function() - require("plugin.config.ufo").setup() - end - }, - { - "mrjones2014/smart-splits.nvim", - event = "BufEnter", - config = function() - require("plugin.config.smartsplit").setup() - end, - lazy = false, - dependencies = { - "kwkarlwang/bufresize.nvim", - config = function() - require("plugin.config.bufresize").setup() - end - } - }, - { - "lewis6991/gitsigns.nvim", - config = function() - require("plugin.config.gitsigns").setup() - end - }, - { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", - { - "sindrets/diffview.nvim", - lazy = true, - enabled = true, - event = "BufRead", - } - }, - config = function() - require("plugin.config.neogit").setup() - end - }, - - "jiangmiao/auto-pairs", - { "tpope/vim-surround", event = "BufEnter" }, - { "tpope/vim-repeat", event = "BufEnter" }, - - -- colorscheme - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - { "Alexis12119/nightly.nvim", name = "nightly", priority = 1000 }, - { "rafamadriz/neon", name = "neon", priority = 1000 }, - { "rebelot/kanagawa.nvim", priority = 1000 }, - { "folke/tokyonight.nvim", priority = 1000 }, - - -- statusline - { - "nvim-lualine/lualine.nvim", - config = function() - require("plugin.config.statusline").setup() - end, - dependencies = { - "kyazdani42/nvim-web-devicons", - } - }, - - { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - config = function() - require("plugin.config.indent_blankline").setup() - end - }, -- Add indentation guides even on blank lines - - { - "numToStr/Comment.nvim", - config = function() - require("Comment").setup({ - pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() - }) - end, - dependencies = { - "nvim-ts-context-commentstring", - "JoosepAlviste/nvim-ts-context-commentstring" - } - }, -- "gc" to comment visual regions/lines - - "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically - { -- braket and tag - "windwp/nvim-autopairs", - config = function() - require("plugin.config.autopairs").setup() - end - }, - - { - "max397574/better-escape.nvim", - event = "InsertEnter", - config = function() - require("better_escape").setup { - mapping = { "jk" }, -- a table with mappings to use - } - end - }, - - { - -- File manager - "nvim-tree/nvim-tree.lua", - version = "nightly", - event = "VimEnter", - config = function() - require("plugin.config.nvimtree").setup() - end, - dependencies = { - { - "antosha417/nvim-lsp-file-operations", - config = function() - require("lsp-file-operations").setup() - end - } - } - }, - { - -- Notifocation - "rcarriga/nvim-notify", - event = "VeryLazy", - config = function() - require("plugin.config.notification").setup() - end, - lazy = false - }, - - { - -- Bufferline - "akinsho/bufferline.nvim", - version = "v3.*", - config = function() - require("plugin.config.bufferline").setup() - end - }, - - { - -- Telescope - "nvim-telescope/telescope.nvim", - event = { "VimEnter" }, - cmd = { "Telescope" }, - version = "0.1.x", - dependencies = { - "nvim-lua/plenary.nvim", - { - "nvim-telescope/telescope-fzf-native.nvim", - run = "make", - cond = vim.fn.executable "make" == 1, - }, - -- "debugloop/telescope-undo.nvim" - "nvim-telescope/telescope-symbols.nvim", - "desdic/agrolens.nvim", - }, - config = function() - require("plugin.config.telescope").setup() - end - }, - - { - "kevinhwang91/nvim-bqf", - ft = "qf", - cmd = "BqfAutoToggle", - event = "QuickFixCmdPost", - }, - - { - -- Lastplace - "ethanholz/nvim-lastplace", - event = "BufRead", - config = function() - require("plugin.config.lastplace").setup() - end - }, - - { - -- keymaps, commands, and autocommands - "mrjones2014/legendary.nvim", - priority = 10000, - lazy = false, - dependencies = { - "kkharji/sqlite.lua", - { - "stevearc/dressing.nvim", - event = "VeryLazy", - config = function() - require("dressing").setup() - end - } - }, - config = function() - require("plugin.config.legendary").setup() - end - }, - { - "monaqa/dial.nvim", - event = "VeryLazy", - keys = { "", { "", mode = "n" } }, - }, - { - "mvllow/modes.nvim", - event = "VeryLazy", - config = function() - require("plugin.config.modes").setup() - end - }, - - { - "gen740/SmoothCursor.nvim", - event = "VeryLazy", - config = function() - require("plugin.config.smoothcursor").setup() - end - }, - - { - "NTBBloodbath/rest.nvim", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim" - }, - config = function() - require("plugin.config.rest").setup() - end - }, - { - "folke/flash.nvim", - event = "VeryLazy", - keys = { - { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, - { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, - { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, - { - "R", - mode = { "o", "x" }, - function() require("flash").treesitter_search() end, - "Treesitter Search" - }, - { - "", - mode = { "c" }, - function() require("flash").toggle() end, - desc = - "Toggle Flash Search" - }, - }, - }, - - { - -- Dashboard - "goolord/alpha-nvim", - event = "VimEnter", - config = function() - require("plugin.config.dashboard").setup() - end - }, - - { - -- Split - "Wansmer/treesj", - event = "BufWinEnter", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - config = function() - require("plugin.config.treesj").setup() - end, - }, - - { -- tmux nav for nvim - "alexghergh/nvim-tmux-navigation", - event = "VeryLazy", - config = function() - require "nvim-tmux-navigation".setup { - disable_when_zoomed = true, - keybindings = { - left = "", - down = "", - up = "", - right = "", - } - } - end - }, - - { - "cpea2506/relative-toggle.nvim", - config = function() - require("plugin.config.relativenumber").setup() - end - }, - - { - "ray-x/sad.nvim", - event = "VeryLazy", - dependencies = { "ray-x/guihua.lua", run = "cd lua/fzy && make" }, - config = function() - require("sad").setup {} - end, - }, - -- { - -- "akinsho/toggleterm.nvim", - -- lazy = true, - -- cmd = { - -- "ToggleTerm", - -- "ToggleTermSetName", - -- "ToggleTermToggleAll", - -- "ToggleTermSendVisualLines", - -- "ToggleTermSendCurrentLine", - -- "ToggleTermSendVisualSelection", - -- }, - -- config = function() - -- require("toggleterm").setup() - -- end, - -- } -} - -local opts = { - spec = { - { import = "base" }, - { import = "pde" }, - }, - install = { - missing = true, - colorscheme = { - "catppuccin", - "tokyonight", - }, - }, - rtp = { - disabled_plugins = { - "2html_plugin", - "tohtml", - "getscript", - "getscriptPlugin", - "gzip", - "logipat", - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "matchit", - "tar", - "tarPlugin", - "rrhelper", - "spellfile", - "spellfile_plugin", - "vimball", - "vimballPlugin", - "zip", - "zipPlugin", - "tutor", - "rplugin", - "syntax", - "synmenu", - "optwin", - "compiler", - "bugreport", - } - } -} - -require("lazy").setup(plugins, opts) -require("plugin.config.colorscheme").setup() - - -------------------------------- ------------- keymaps ---------- -------------------------------- -require("core.default_config").keymaps.default() diff --git a/lua/plugin/config/autopairs.lua b/lua/plugins/config/autopairs.lua similarity index 100% rename from lua/plugin/config/autopairs.lua rename to lua/plugins/config/autopairs.lua diff --git a/lua/plugin/config/bqf.lua b/lua/plugins/config/bqf.lua similarity index 100% rename from lua/plugin/config/bqf.lua rename to lua/plugins/config/bqf.lua diff --git a/lua/plugin/config/bufferline.lua b/lua/plugins/config/bufferline.lua similarity index 93% rename from lua/plugin/config/bufferline.lua rename to lua/plugins/config/bufferline.lua index c76afc6..25adf51 100644 --- a/lua/plugin/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -1,8 +1,8 @@ ---@diagnostic disable: missing-fields local M = {} local status, bufferline = pcall(require, "bufferline") -local opts = require("core.default_config").opts -local keymap = require("core.default_config").keymap +local opts = require("config.default").opts +local keymap = require("config.default").keymap function M.setup() if (not status) then return end diff --git a/lua/plugin/config/bufresize.lua b/lua/plugins/config/bufresize.lua similarity index 88% rename from lua/plugin/config/bufresize.lua rename to lua/plugins/config/bufresize.lua index 6c36b18..7a8faa8 100644 --- a/lua/plugin/config/bufresize.lua +++ b/lua/plugins/config/bufresize.lua @@ -1,5 +1,5 @@ local M = {} -local opts = require("core.default_config").opts +local opts = require("config.default").opts local status, bufresize = pcall(require, "bufresize") function M.setup() diff --git a/lua/plugin/config/cmp.lua b/lua/plugins/config/cmp.lua similarity index 100% rename from lua/plugin/config/cmp.lua rename to lua/plugins/config/cmp.lua diff --git a/lua/plugin/config/colorscheme.lua b/lua/plugins/config/colorscheme.lua similarity index 98% rename from lua/plugin/config/colorscheme.lua rename to lua/plugins/config/colorscheme.lua index 40e6322..f532c4e 100644 --- a/lua/plugin/config/colorscheme.lua +++ b/lua/plugins/config/colorscheme.lua @@ -1,5 +1,5 @@ local M = {} -local ui = require("core.default_config").ui +local ui = require("config.default").ui function M.setup() diff --git a/lua/plugin/config/dashboard.lua b/lua/plugins/config/dashboard.lua similarity index 86% rename from lua/plugin/config/dashboard.lua rename to lua/plugins/config/dashboard.lua index 4725c09..83fc005 100644 --- a/lua/plugin/config/dashboard.lua +++ b/lua/plugins/config/dashboard.lua @@ -1,9 +1,9 @@ local M = {} -local alpha = require('alpha') -local dashboard = require('alpha.themes.dashboard') +local alpha = require("alpha") +local dashboard = require("alpha.themes.dashboard") function M.setup() - dashboard.section.header.val = require('core.default_config').options.figlet_name + dashboard.section.header.val = require("config.default").options.figlet_name dashboard.section.buttons.val = { dashboard.button("e", " New File", ":ene startinsert "), diff --git a/lua/plugin/config/diffview.lua b/lua/plugins/config/diffview.lua similarity index 100% rename from lua/plugin/config/diffview.lua rename to lua/plugins/config/diffview.lua diff --git a/lua/plugin/config/gitsigns.lua b/lua/plugins/config/gitsigns.lua similarity index 100% rename from lua/plugin/config/gitsigns.lua rename to lua/plugins/config/gitsigns.lua diff --git a/lua/plugin/config/hop.lua b/lua/plugins/config/hop.lua similarity index 96% rename from lua/plugin/config/hop.lua rename to lua/plugins/config/hop.lua index 9bde284..3533c12 100644 --- a/lua/plugin/config/hop.lua +++ b/lua/plugins/config/hop.lua @@ -1,5 +1,5 @@ local M = {} -local keymap = require("core.default_config").keymap +local keymap = require("config.default").keymap function M.setup() local hop = require('hop') diff --git a/lua/plugin/config/indent_blankline.lua b/lua/plugins/config/indent_blankline.lua similarity index 100% rename from lua/plugin/config/indent_blankline.lua rename to lua/plugins/config/indent_blankline.lua diff --git a/lua/plugin/config/lastplace.lua b/lua/plugins/config/lastplace.lua similarity index 100% rename from lua/plugin/config/lastplace.lua rename to lua/plugins/config/lastplace.lua diff --git a/lua/plugin/config/legendary.lua b/lua/plugins/config/legendary.lua similarity index 93% rename from lua/plugin/config/legendary.lua rename to lua/plugins/config/legendary.lua index e7320a7..06480a8 100644 --- a/lua/plugin/config/legendary.lua +++ b/lua/plugins/config/legendary.lua @@ -14,16 +14,16 @@ function M.setup() { 'sw', telescope_builtin.grep_string, description = '[S]earch current [W]ord' }, { 'sg', telescope_builtin.live_grep, description = '[S]earch by [G]rep' }, { '', telescope_builtin.buffers, description = '[S]earch [B]uffers' }, - { 'sc', function () require('plugin.config.telescope').colorscheme_picker() end, description = '[S]earch [C]olorscheme' }, - { 'so', function () require('plugin.config.telescope').treesitter() end, description = '[S]earch Treesitter Symb[o]ls' }, + { 'sc', function () require('plugins.config.telescope').colorscheme_picker() end, description = '[S]earch [C]olorscheme' }, + { 'so', function () require('plugins.config.telescope').treesitter() end, description = '[S]earch Treesitter Symb[o]ls' }, { 'ss', telescope_builtin.symbols, description = '[S]earch [S]ymbols' }, { 'sx', telescope_builtin.resume, description = '[S]earch [X]resume' }, { 'sd', telescope_builtin.diagnostics, description = '[S]earch [D]iagnostics' }, { 'sm', telescope_builtin.marks, description = '[S]earch [M]arks' }, { 'sj', telescope_builtin.jumplist, description = '[S]earch [J]umplists' }, { 'st', telescope_builtin.tags, description = '[S]earch [T]ags' }, - { '/', require('plugin.config.telescope').current_buffer_fuzzy_find, description = '[/] Fuzzily search in current buffer' }, - { 'en', require('plugin.config.telescope').edit_neovim, description = '[E]dit [N]eovim' }, + { '/', require("plugins.config.telescope").current_buffer_fuzzy_find, description = '[/] Fuzzily search in current buffer' }, + { 'en', require("plugins.config.telescope").edit_neovim, description = '[E]dit [N]eovim' }, { 'gb', telescope_builtin.git_branches, description = '[G]it [B]ranches' }, { 'gc', telescope_builtin.git_commits, description = '[G]it [B]ranches' }, { 'gs', telescope_builtin.git_status, description = '[G]it [S]tatus' }, diff --git a/lua/plugin/config/lsp-signature.lua b/lua/plugins/config/lsp-signature.lua similarity index 100% rename from lua/plugin/config/lsp-signature.lua rename to lua/plugins/config/lsp-signature.lua diff --git a/lua/plugin/config/lsp.lua b/lua/plugins/config/lsp.lua similarity index 100% rename from lua/plugin/config/lsp.lua rename to lua/plugins/config/lsp.lua diff --git a/lua/plugin/config/manson-tool-installer.lua b/lua/plugins/config/manson-tool-installer.lua similarity index 100% rename from lua/plugin/config/manson-tool-installer.lua rename to lua/plugins/config/manson-tool-installer.lua diff --git a/lua/plugin/config/modes.lua b/lua/plugins/config/modes.lua similarity index 100% rename from lua/plugin/config/modes.lua rename to lua/plugins/config/modes.lua diff --git a/lua/plugin/config/neogit.lua b/lua/plugins/config/neogit.lua similarity index 100% rename from lua/plugin/config/neogit.lua rename to lua/plugins/config/neogit.lua diff --git a/lua/plugin/config/notification.lua b/lua/plugins/config/notification.lua similarity index 100% rename from lua/plugin/config/notification.lua rename to lua/plugins/config/notification.lua diff --git a/lua/plugin/config/nvimtree.lua b/lua/plugins/config/nvimtree.lua similarity index 94% rename from lua/plugin/config/nvimtree.lua rename to lua/plugins/config/nvimtree.lua index 267e246..5ecb579 100644 --- a/lua/plugin/config/nvimtree.lua +++ b/lua/plugins/config/nvimtree.lua @@ -1,6 +1,6 @@ local M = {} -local opts = require("core.default_config").opts -local keymap = require("core.default_config").keymap +local opts = require("config.default").opts +local keymap = require("config.default").keymap local status, nvimtree = pcall(require, 'nvim-tree') function M.setup() diff --git a/lua/plugin/config/relativenumber.lua b/lua/plugins/config/relativenumber.lua similarity index 100% rename from lua/plugin/config/relativenumber.lua rename to lua/plugins/config/relativenumber.lua diff --git a/lua/plugin/config/rest.lua b/lua/plugins/config/rest.lua similarity index 100% rename from lua/plugin/config/rest.lua rename to lua/plugins/config/rest.lua diff --git a/lua/plugin/config/smartsplit.lua b/lua/plugins/config/smartsplit.lua similarity index 100% rename from lua/plugin/config/smartsplit.lua rename to lua/plugins/config/smartsplit.lua diff --git a/lua/plugin/config/smoothcursor.lua b/lua/plugins/config/smoothcursor.lua similarity index 100% rename from lua/plugin/config/smoothcursor.lua rename to lua/plugins/config/smoothcursor.lua diff --git a/lua/plugin/config/statusline.lua b/lua/plugins/config/statusline.lua similarity index 98% rename from lua/plugin/config/statusline.lua rename to lua/plugins/config/statusline.lua index 82d0332..3508bff 100644 --- a/lua/plugin/config/statusline.lua +++ b/lua/plugins/config/statusline.lua @@ -1,5 +1,5 @@ local M = {} -local ui = require("core.default_config").ui +local ui = require("config.default").ui local function getLsps() local lspNames = "[" diff --git a/lua/plugin/config/telescope.lua b/lua/plugins/config/telescope.lua similarity index 98% rename from lua/plugin/config/telescope.lua rename to lua/plugins/config/telescope.lua index 023b893..e4bd169 100644 --- a/lua/plugin/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -129,7 +129,7 @@ function M.treesitter() end function M.colorscheme_picker() - local ui = require("core.default_config").ui + local ui = require("config.default").ui require('telescope.pickers').new({}, { prompt_title = "Select ColorScheme", finder = require('telescope.finders').new_table({ diff --git a/lua/plugin/config/treesitter.lua b/lua/plugins/config/treesitter.lua similarity index 100% rename from lua/plugin/config/treesitter.lua rename to lua/plugins/config/treesitter.lua diff --git a/lua/plugin/config/treesj.lua b/lua/plugins/config/treesj.lua similarity index 100% rename from lua/plugin/config/treesj.lua rename to lua/plugins/config/treesj.lua diff --git a/lua/plugin/config/typescript-tools.lua b/lua/plugins/config/typescript-tools.lua similarity index 100% rename from lua/plugin/config/typescript-tools.lua rename to lua/plugins/config/typescript-tools.lua diff --git a/lua/plugin/config/ufo.lua b/lua/plugins/config/ufo.lua similarity index 100% rename from lua/plugin/config/ufo.lua rename to lua/plugins/config/ufo.lua diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..6aff254 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,378 @@ +if true then + return { + { + "folke/neoconf.nvim", + cmd = "Neoconf", + config = function() + require("neoconf").setup() + end + }, + { + -- AutoCompletion + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lua", + "ray-x/cmp-treesitter", + "lukas-reineke/cmp-rg", + "quangnguyen30192/cmp-nvim-tags", + "andersevenrud/cmp-tmux", + "saadparwaiz1/cmp_luasnip", + "L3MON4D3/LuaSnip", + "rafamadriz/friendly-snippets", + "lukas-reineke/cmp-under-comparator", + { + "honza/vim-snippets", + dependencies = { + "friendly-snippets", + "vim-snippets", + } + } + }, + config = function() + require("plugins.config.cmp").setup() + end + }, + { + -- File Syntax + "nvim-treesitter/nvim-treesitter", + event = { + "BufReadPost", + "BufNewFile", + }, + build = function() + pcall(require("nvim-treesitter.install").update { with_sync = false }) + end, + config = function() + require("plugins.config.treesitter").setup() + end, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + "nvim-treesitter/nvim-treesitter-textobjects", + "p00f/nvim-ts-rainbow", + "HiPhish/nvim-ts-rainbow2", + "windwp/nvim-ts-autotag", + "mizlan/iswap.nvim", + { + "m-demare/hlargs.nvim", + config = function() + require("hlargs").setup() + end + }, + { + "ZhiyuanLck/smart-pairs", + event = "InsertEnter", + config = function() + require("pairs"):setup() + end + } + } + }, + { + "kevinhwang91/nvim-ufo", + dependencies = "kevinhwang91/promise-async", + event = "BufReadPost", + config = function() + require("plugins.config.ufo").setup() + end + }, + { + "mrjones2014/smart-splits.nvim", + event = "BufEnter", + config = function() + require("plugins.config.smartsplit").setup() + end, + lazy = false, + dependencies = { + "kwkarlwang/bufresize.nvim", + config = function() + require("plugins.config.bufresize").setup() + end + } + }, + { + "lewis6991/gitsigns.nvim", + config = function() + require("plugins.config.gitsigns").setup() + end + }, + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + { + "sindrets/diffview.nvim", + lazy = true, + enabled = true, + event = "BufRead", + } + }, + config = function() + require("plugins.config.neogit").setup() + end + }, + + "jiangmiao/auto-pairs", + { "tpope/vim-surround", event = "BufEnter" }, + { "tpope/vim-repeat", event = "BufEnter" }, + + -- colorscheme + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + { "Alexis12119/nightly.nvim", name = "nightly", priority = 1000 }, + { "rafamadriz/neon", name = "neon", priority = 1000 }, + { "rebelot/kanagawa.nvim", priority = 1000 }, + { "folke/tokyonight.nvim", priority = 1000 }, + + -- statusline + { + "nvim-lualine/lualine.nvim", + config = function() + require("plugins.config.statusline").setup() + end, + dependencies = { + "kyazdani42/nvim-web-devicons", + } + }, + + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + config = function() + require("plugins.config.indent_blankline").setup() + end + }, -- Add indentation guides even on blank lines + + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup({ + pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() + }) + end, + dependencies = { + "nvim-ts-context-commentstring", + "JoosepAlviste/nvim-ts-context-commentstring" + } + }, -- "gc" to comment visual regions/lines + + "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically + { -- braket and tag + "windwp/nvim-autopairs", + config = function() + require("plugins.config.autopairs").setup() + end + }, + + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup { + mapping = { "jk" }, -- a table with mappings to use + } + end + }, + + { + -- File manager + "nvim-tree/nvim-tree.lua", + version = "nightly", + event = "VimEnter", + config = function() + require("plugins.config.nvimtree").setup() + end, + dependencies = { + { + "antosha417/nvim-lsp-file-operations", + config = function() + require("lsp-file-operations").setup() + end + } + } + }, + { + -- Notifocation + "rcarriga/nvim-notify", + event = "VeryLazy", + config = function() + require("plugins.config.notification").setup() + end, + lazy = false + }, + + { + -- Bufferline + "akinsho/bufferline.nvim", + version = "v3.*", + config = function() + require("plugins.config.bufferline").setup() + end + }, + + { + -- Telescope + "nvim-telescope/telescope.nvim", + event = { "VimEnter" }, + cmd = { "Telescope" }, + version = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + cond = vim.fn.executable "make" == 1, + }, + -- "debugloop/telescope-undo.nvim" + "nvim-telescope/telescope-symbols.nvim", + "desdic/agrolens.nvim", + }, + config = function() + require("plugins.config.telescope").setup() + end + }, + + { + "kevinhwang91/nvim-bqf", + ft = "qf", + cmd = "BqfAutoToggle", + event = "QuickFixCmdPost", + }, + + { + -- Lastplace + "ethanholz/nvim-lastplace", + event = "BufRead", + config = function() + require("plugins.config.lastplace").setup() + end + }, + + { + -- keymaps, commands, and autocommands + "mrjones2014/legendary.nvim", + priority = 10000, + lazy = false, + dependencies = { + "kkharji/sqlite.lua", + { + "stevearc/dressing.nvim", + event = "VeryLazy", + config = function() + require("dressing").setup() + end + } + }, + config = function() + require("plugins.config.legendary").setup() + end + }, + { + "monaqa/dial.nvim", + event = "VeryLazy", + keys = { "", { "", mode = "n" } }, + }, + { + "mvllow/modes.nvim", + event = "VeryLazy", + config = function() + require("plugins.config.modes").setup() + end + }, + + { + "gen740/SmoothCursor.nvim", + event = "VeryLazy", + config = function() + require("plugins.config.smoothcursor").setup() + end + }, + + { + "NTBBloodbath/rest.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim" + }, + config = function() + require("plugins.config.rest").setup() + end + }, + { + "folke/flash.nvim", + event = "VeryLazy", + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { + "R", + mode = { "o", "x" }, + function() require("flash").treesitter_search() end, + "Treesitter Search" + }, + { + "", + mode = { "c" }, + function() require("flash").toggle() end, + desc = + "Toggle Flash Search" + }, + }, + }, + + { + -- Dashboard + "goolord/alpha-nvim", + event = "VimEnter", + config = function() + require("plugins.config.dashboard").setup() + end + }, + + { + -- Split + "Wansmer/treesj", + event = "BufWinEnter", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + config = function() + require("plugins.config.treesj").setup() + end, + }, + + { -- tmux nav for nvim + "alexghergh/nvim-tmux-navigation", + event = "VeryLazy", + config = function() + require "nvim-tmux-navigation".setup { + disable_when_zoomed = true, + keybindings = { + left = "", + down = "", + up = "", + right = "", + } + } + end + }, + + { + "cpea2506/relative-toggle.nvim", + config = function() + require("plugins.config.relativenumber").setup() + end + }, + + { + "ray-x/sad.nvim", + event = "VeryLazy", + dependencies = { "ray-x/guihua.lua", run = "cd lua/fzy && make" }, + config = function() + require("sad").setup {} + end, + }, + } +end diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..6a1af5a --- /dev/null +++ b/lua/plugins/lsp/lspconfig.lua @@ -0,0 +1,187 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "antosha417/nvim-lsp-file-operations", config = true }, + { + "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + config = function() + require("lsp_lines").setup() + end, + }, + { + "j-hui/fidget.nvim", + branch = "legacy" + }, + "nvim-lua/plenary.nvim", + }, + config = function() + -- import lspconfig plugin + local lspconfig = require("lspconfig") + + -- import cmp-nvim-lsp plugin + local cmp_nvim_lsp = require("cmp_nvim_lsp") + + local keymap = vim.keymap -- for conciseness + + local opts = { noremap = true, silent = true } + local on_attach = function(client, bufnr) + opts.buffer = bufnr + + -- set keybinds + opts.desc = "Show LSP references" + keymap.set("n", "gr", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show LSP definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show LSP implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show LSP type definitions" + keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Smart rename" + keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Show line diagnostics" + keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = "Restart LSP" + keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary + end + + -- used to enable autocompletion (assign to every lsp server config) + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + capabilities.textDocument.completion.completionItem.preselectSupport = true + capabilities.textDocument.completion.completionItem.insertReplaceSupport = true + capabilities.textDocument.completion.completionItem.labelDetailsSupport = true + capabilities.textDocument.completion.completionItem.deprecatedSupport = true + capabilities.textDocument.completion.completionItem.commitCharactersSupport = true + capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } + capabilities.textDocument.completion.completionItem.snippetSupport = true + capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { "documentation", "detail", "additionalTextEdits" }, + } + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + + -- Change the Diagnostic symbols in the sign column (gutter) + -- (not in youtube nvim video) + local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + -- configure html server + -- lspconfig["html"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- }) + + -- configure typescript server with plugin + lspconfig["tsserver"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure css server + -- lspconfig["cssls"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- }) + + -- configure tailwindcss server + -- lspconfig["tailwindcss"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- }) + + -- configure svelte server + -- lspconfig["svelte"].setup({ + -- capabilities = capabilities, + -- on_attach = function(client, bufnr) + -- on_attach(client, bufnr) + -- + -- vim.api.nvim_create_autocmd("BufWritePost", { + -- pattern = { "*.js", "*.ts" }, + -- callback = function(ctx) + -- if client.name == "svelte" then + -- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file }) + -- end + -- end, + -- }) + -- end, + -- }) + + -- configure prisma orm server + -- lspconfig["prismals"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- }) + + -- configure graphql language server + -- lspconfig["graphql"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, + -- }) + + -- configure emmet language server + -- lspconfig["emmet_ls"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, + -- }) + + -- configure python server + -- lspconfig["pyright"].setup({ + -- capabilities = capabilities, + -- on_attach = on_attach, + -- }) + + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + end, +} diff --git a/lua/plugins/lsp/mason.lua b/lua/plugins/lsp/mason.lua new file mode 100644 index 0000000..aa4be73 --- /dev/null +++ b/lua/plugins/lsp/mason.lua @@ -0,0 +1,50 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + -- import mason + local mason = require("mason") + + -- import mason-lspconfig + local mason_lspconfig = require("mason-lspconfig") + + local mason_tool_installer = require("mason-tool-installer") + + -- enable mason and configure icons + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + mason_lspconfig.setup({ + -- list of servers for mason to install + ensure_installed = { + "tsserver", + -- "html", + -- "cssls", + "lua_ls", + -- "pyright", + }, + -- auto-install configured servers (with lspconfig) + automatic_installation = true, -- not the same as ensure_installed + }) + + mason_tool_installer.setup({ + ensure_installed = { + -- "stylua", -- lua formatter + -- "isort", -- python formatter + -- "black", -- python formatter + -- "pylint", -- python linter + -- "eslint_d", -- js linter + }, + }) + end, +} diff --git a/lua/plugins/lsp/none-ls.lua b/lua/plugins/lsp/none-ls.lua new file mode 100644 index 0000000..c4833f1 --- /dev/null +++ b/lua/plugins/lsp/none-ls.lua @@ -0,0 +1,74 @@ +return { + "nvimtools/none-ls.nvim", -- configure formatters & linters + lazy = true, + -- event = { "BufReadPre", "BufNewFile" }, -- to enable uncomment this + dependencies = { + "jay-babu/mason-null-ls.nvim", + }, + config = function() + local mason_null_ls = require("mason-null-ls") + + local null_ls = require("null-ls") + + local null_ls_utils = require("null-ls.utils") + + mason_null_ls.setup({ + ensure_installed = { + "prettier", -- prettier formatter + "stylua", -- lua formatter + "black", -- python formatter + "pylint", -- python linter + "eslint_d", -- js linter + }, + }) + + -- for conciseness + local formatting = null_ls.builtins.formatting -- to setup formatters + local diagnostics = null_ls.builtins.diagnostics -- to setup linters + + -- to setup format on save + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + + -- configure null_ls + null_ls.setup({ + -- add package.json as identifier for root (for typescript monorepos) + root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"), + -- setup formatters & linters + sources = { + -- to disable file types use + -- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs) + formatting.prettier.with({ + extra_filetypes = { "svelte" }, + }), -- js/ts formatter + formatting.stylua, -- lua formatter + formatting.isort, + formatting.black, + diagnostics.pylint, + diagnostics.eslint_d.with({ -- js/ts linter + condition = function(utils) + return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs + end, + }), + }, + -- configure format on save + on_attach = function(current_client, bufnr) + if current_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({ + filter = function(client) + -- only use null-ls for formatting instead of lsp server + return client.name == "null-ls" + end, + bufnr = bufnr, + }) + end, + }) + end + end, + }) + end, +} diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file