nvim
This commit is contained in:
parent
b4c4201d65
commit
b58adfce4a
10 changed files with 65 additions and 174 deletions
|
@ -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,
|
||||
})
|
||||
|
|
5
nvim/lua/plugins/autopairs.lua
Normal file
5
nvim/lua/plugins/autopairs.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {}
|
||||
}
|
|
@ -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"
|
||||
|
|
15
nvim/lua/plugins/conform.lua
Normal file
15
nvim/lua/plugins/conform.lua
Normal file
|
@ -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",
|
||||
},
|
||||
},
|
||||
}
|
11
nvim/lua/plugins/gitsigns.lua
Normal file
11
nvim/lua/plugins/gitsigns.lua
Normal file
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -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" },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
}
|
|
@ -10,7 +10,7 @@ return {
|
|||
},
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
tag = "v1.4.0",
|
||||
tag = "v1.5.0",
|
||||
opts = {
|
||||
progress = {
|
||||
display = {
|
||||
|
|
6
nvim/lua/plugins/luasnip.lua
Normal file
6
nvim/lua/plugins/luasnip.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp"
|
||||
}
|
8
nvim/lua/plugins/mini.lua
Normal file
8
nvim/lua/plugins/mini.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
'echasnovski/mini.nvim',
|
||||
version = '*',
|
||||
config = function()
|
||||
require "mini.statusline".setup()
|
||||
require "mini.surround".setup()
|
||||
end
|
||||
}
|
12
nvim/lua/plugins/telescope.lua
Normal file
12
nvim/lua/plugins/telescope.lua
Normal file
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue