diff --git a/nvim/lua/my/lsp.lua b/nvim/lua/my/lsp.lua index d2f1ade..4d4634f 100644 --- a/nvim/lua/my/lsp.lua +++ b/nvim/lua/my/lsp.lua @@ -1,8 +1,6 @@ local lspconfig = require "lspconfig" require "neodev".setup() -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single" }) - local capabilities = {} local has_cmp, cmp_lsp = pcall(require, "cmp_nvim_lsp") @@ -10,24 +8,6 @@ if has_cmp then capabilities = cmp_lsp.default_capabilities() end -local has_lsp_format, lsp_format = pcall(require, "lsp-format") -if has_lsp_format then - lsp_format.setup { - typescript = { exclude = { "ts_ls" } }, - javascript = { exclude = { "ts_ls" } }, - typescriptreact = { exclude = { "ts_ls" } }, - javascriptreact = { exclude = { "ts_ls" } }, - } -end - -local prettier = { - formatCommand = 'prettierd "${INPUT}"', - formatStdin = true, - -- env = { - -- string.format('PRETTIERD_DEFAULT_CONFIG=%s', vim.fn.expand('~/.config/nvim/utils/linter-config/.prettierrc.json')), - -- }, -} - local eslint = { lintCommand = [[eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}]], lintIgnoreExitCode = true, @@ -51,17 +31,16 @@ local shellcheck = { local servers = { efm = { - filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh", "php" }, + filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" }, init_options = { documentFormatting = true }, settings = { rootMarkers = { ".git/" }, languages = { - typescript = { prettier, eslint }, - typescriptreact = { prettier, eslint }, - javascript = { prettier, eslint }, - javascriptreact = { prettier, eslint }, + typescript = { eslint }, + typescriptreact = { eslint }, + javascript = { eslint }, + javascriptreact = { eslint }, sh = { shellcheck }, - php = { prettier }, }, }, }, @@ -131,87 +110,13 @@ local servers = { intelephense = { files = { maxSize = 1000000000 }, format = { enable = false }, - stubs = { - "apache", - "bcmath", - "bz2", - "calendar", - "com_dotnet", - "Core", - "ctype", - "curl", - "date", - "dba", - "dom", - "enchant", - "exif", - "FFI", - "fileinfo", - "filter", - "fpm", - "ftp", - "gd", - "gettext", - "gmp", - "hash", - "iconv", - "imap", - "intl", - "json", - "ldap", - "libxml", - "mbstring", - "meta", - "mysqli", - "oci8", - "odbc", - "openssl", - "pcntl", - "pcre", - "PDO", - "pdo_ibm", - "pdo_mysql", - "pdo_pgsql", - "pdo_sqlite", - "pgsql", - "Phar", - "posix", - "pspell", - "readline", - "Reflection", - "session", - "shmop", - "SimpleXML", - "snmp", - "soap", - "sockets", - "sodium", - "SPL", - "sqlite3", - "standard", - "superglobals", - "sysvmsg", - "sysvsem", - "sysvshm", - "tidy", - "tokenizer", - "xml", - "xmlreader", - "xmlrpc", - "xmlwriter", - "xsl", - "wordpress", - "Zend OPcache", - "zip", - "zlib", - }, + stubs = { "apache", "bcmath", "bz2", "calendar", "com_dotnet", "Core", "ctype", "curl", "date", "dba", "dom", "enchant", "exif", "FFI", "fileinfo", "filter", "fpm", "ftp", "gd", "gettext", "gmp", "hash", "iconv", "imap", "intl", "json", "ldap", "libxml", "mbstring", "meta", "mysqli", "oci8", "odbc", "openssl", "pcntl", "pcre", "PDO", "pdo_ibm", "pdo_mysql", "pdo_pgsql", "pdo_sqlite", "pgsql", "Phar", "posix", "pspell", "readline", "Reflection", "session", "shmop", "SimpleXML", "snmp", "soap", "sockets", "sodium", "SPL", "sqlite3", "standard", "superglobals", "sysvmsg", "sysvsem", "sysvshm", "tidy", "tokenizer", "xml", "xmlreader", "xmlrpc", "xmlwriter", "xsl", "wordpress", "Zend OPcache", "zip", "zlib", }, }, } }, zls = {}, bashls = {}, } - for lsp, settings in pairs(servers) do lspconfig[lsp].setup(vim.tbl_extend("force", { capabilities = capabilities }, settings)) end @@ -230,9 +135,5 @@ vim.api.nvim_create_autocmd("LspAttach", { buffer = args.buf, }) end - - if has_lsp_format then - lsp_format.on_attach(client) - end end, }) diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..fe53948 --- /dev/null +++ b/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {} +} diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 7396660..66734d6 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -8,6 +8,7 @@ return { "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", "onsails/lspkind.nvim", + { "nvim-tree/nvim-web-devicons", lazy = true }, }, config = function() local cmp = require "cmp" diff --git a/nvim/lua/plugins/conform.lua b/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..f5a1e5e --- /dev/null +++ b/nvim/lua/plugins/conform.lua @@ -0,0 +1,15 @@ +return { + 'stevearc/conform.nvim', + opts = { + formatters_by_ft = { + javascript = { "prettierd" }, + typescript = { "prettierd" }, + php = { "pint" } + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "fallback", + }, + }, +} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..dcfc974 --- /dev/null +++ b/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,11 @@ +return { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + opts = { + current_line_blame = true, + current_line_blame_opts = { + delay = 300, + }, + on_attach = require "my.keymaps".gitsigns_keymaps, + } +} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua deleted file mode 100644 index e566d6e..0000000 --- a/nvim/lua/plugins/init.lua +++ /dev/null @@ -1,68 +0,0 @@ -return { - { - "nvim-telescope/telescope.nvim", - event = "VeryLazy", - branch = "0.1.x", - dependencies = { - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - { "nvim-telescope/telescope-ui-select.nvim" }, - "nvim-lua/plenary.nvim", - }, - config = function() - require "my.telescope" - end - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = {} - }, - { - "lewis6991/gitsigns.nvim", - event = "VeryLazy", - opts = { - current_line_blame = true, - current_line_blame_opts = { - delay = 300, - }, - on_attach = require "my.keymaps".gitsigns_keymaps, - } - }, - { "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" }, - { "nvim-tree/nvim-web-devicons", lazy = true }, - { - "L3MON4D3/LuaSnip", - version = "v2.*", - -- install jsregexp (optional!). - build = "make install_jsregexp" - }, - { - 'echasnovski/mini.nvim', - version = '*', - config = function() - require "mini.statusline".setup() - require "mini.surround".setup() - end - }, - -- { - -- "yetone/avante.nvim", - -- event = "VeryLazy", - -- build = "make BUILD_FROM_SOURCE=true luajit", - -- opts = { - -- -- add any opts here - -- }, - -- dependencies = { - -- "stevearc/dressing.nvim", - -- "nvim-lua/plenary.nvim", - -- "MunifTanjim/nui.nvim", - -- --- The below is optional, make sure to setup it properly if you have lazy=true - -- { - -- 'MeanderingProgrammer/render-markdown.nvim', - -- opts = { - -- file_types = { "markdown", "Avante" }, - -- }, - -- ft = { "markdown", "Avante" }, - -- }, - -- }, - -- } -} diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua index 4aa411b..4646cf4 100644 --- a/nvim/lua/plugins/lspconfig.lua +++ b/nvim/lua/plugins/lspconfig.lua @@ -10,7 +10,7 @@ return { }, { "j-hui/fidget.nvim", - tag = "v1.4.0", + tag = "v1.5.0", opts = { progress = { display = { diff --git a/nvim/lua/plugins/luasnip.lua b/nvim/lua/plugins/luasnip.lua new file mode 100644 index 0000000..0902fcc --- /dev/null +++ b/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,6 @@ +return { + "L3MON4D3/LuaSnip", + version = "v2.*", + -- install jsregexp (optional!). + build = "make install_jsregexp" +} diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..01607cd --- /dev/null +++ b/nvim/lua/plugins/mini.lua @@ -0,0 +1,8 @@ +return { + 'echasnovski/mini.nvim', + version = '*', + config = function() + require "mini.statusline".setup() + require "mini.surround".setup() + end +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..d40ad9c --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,12 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { "nvim-telescope/telescope-ui-select.nvim" }, + "nvim-lua/plenary.nvim", + }, + config = function() + require "my.telescope" + end +}