добавлены форматировщики и LSP-сервера

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2023-03-21 06:26:16 +10:00
parent 74cc3389e8
commit ce27dbe7e8
6 changed files with 310 additions and 183 deletions

44
lua/.luarc.json Normal file
View File

@ -0,0 +1,44 @@
{
"workspace.library": [
"/home/mirzaev/.config/nvim",
"/home/mirzaev/.local/share/nvim/site",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/coq.artifacts",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/coq.thirdparty",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/coq_nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/diaglist.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/fidget.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/kommentary",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/lualine-lsp-progress",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/lualine.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/lush.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/neo-tree.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nginx.vim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nui.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nvim-dap",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nvim-lint",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/packer.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/phpctags",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/plenary.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/symbols-outline.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/tagbar",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/telescope.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/trouble.nvim",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-fish",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-fugitive",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-prettier",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-signify",
"/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-test",
"/home/mirzaev/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig",
"/snap/nvim/2789/usr/share/nvim/runtime",
"/snap/nvim/2789/usr/share/nvim/runtime/pack/dist/opt/matchit",
"${3rd}/luassert/library",
"${3rd}/luv/library"
]
}

View File

@ -1,5 +1,4 @@
--[[ nvim-neo-tree/neo-tree ]]
-- Открыть интерфейс с древовидным отображением файлов
vim.keymap.set({ 'n', 'i', 'v', 't' }, '<f1>', '<cmd>NeoTreeRevealToggle<cr>', { noremap = true })
@ -9,21 +8,18 @@ vim.keymap.set({'n', 'i', 'v', 't'}, '<f2>', '<cmd>TroubleToggle<cr>', {noremap
--[[ onsails/diaglist.nvim ]]
-- Открыть интерфейс диагностики
vim.keymap.set('n', '<space>dw', '<cmd>lua require(\'diaglist\').open_all_diagnostics()<cr>', { noremap = true })
vim.keymap.set('n', '<space>d0', '<cmd>lua require(\'diaglist\').open_buffer_diagnostics()<cr>', { noremap = true })
--[[ noib3/nvim-cokeline ]]
-- Переключение вкладок
vim.keymap.set('n', '<tab>', '<Plug>(cokeline-focus-next)', { noremap = true, silent = true })
vim.keymap.set('n', '<s-tab>', '<Plug>(cokeline-focus-prev)', { noremap = true, silent = true })
--[[ neovim/nvim-lspconfig ]]
-- Диагностика
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { noremap = true, silent = true })
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { noremap = true, silent = true })
@ -42,19 +38,23 @@ lspconfig_on_attach = function(client, bufnr)
vim.keymap.set('n', '<c-k>', vim.lsp.buf.signature_help, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, {noremap = true, silent = true, buffer = bufnr})
vim.keymap.set('n', '<space>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end,
{ noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', 'gr', vim.lsp.buf.references, { noremap = true, silent = true, buffer = bufnr })
-- Форматирование
vim.keymap.set({'n', 'v', 't'}, 'F', function () vim.lsp.buf.format {async = true} end, {noremap = true, silent = true, buffer = bufnr})
vim.keymap.set({ 'n', 'v', 't' }, 'F', function()
vim.lsp.buf.format { async = true }
vim.api.nvim_command('PrettierAsync')
end,
{ noremap = true, silent = true, buffer = bufnr })
end
--[[ lewis6991/gitsigns.nvim ]]
-- Инициализация только после того, как LSP-сервер подключится к текущему буферу
gitsigns_on_attach = function(bufnr)
-- Инициализация ярлыка
@ -94,7 +94,6 @@ end
--[[ nvim-telescope/telescope.nvim ]]
-- Инициализация ярлыка
local builtin = require('telescope.builtin')
@ -112,7 +111,6 @@ vim.keymap.set('n', '<leader>fh', builtin.help_tags, {noremap = true, silent = t
--[[ windwp/nvim-autopairs ]]
-- Переназначение стандартных сочетаний клавиш для "ms-jpq/coq_nvim"
--vim.keymap.set('i', '<esc>', [[pumvisible() ? "<c-e><esc>" : "<esc>"]], {expr = true, noremap = true})
--vim.keymap.set('i', '<c-c>', [[pumvisible() ? "<c-e><c-c>" : "<c-c>"]], {expr = true, noremap = true})

View File

@ -17,30 +17,104 @@ lspconfig.intelephense.setup({
capabilities = capabilities
})
-- Инициализация "vscode-html-language-server" (LSP-сервер для HTML)
-- Инициализация "hrsh7th/vscode-html-language-server" (LSP-сервер для HTML)
lspconfig.html.setup({
init_options = {
configurationSection = { 'html' },
embeddedLanguages = {
css = false,
javascript = false
},
provideFormatter = true,
},
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})
-- Инициализация "vscode-html-language-server" (LSP-сервер для CSS)
-- Инициализация "aca/emmet-ls" (LSP-сервер для HTML)
lspconfig.emmet_ls.setup({
init_options = {
html = {
options = {
["bem.enabled"] = true,
},
},
},
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})
-- Инициализация "hrsh7th/vscode-langservers-extracted" (LSP-сервер для JS, вспомогательный для CSS)
lspconfig.cssls.setup({
settings = {
css = {
validate = true
},
less = {
validate = true
},
scss = {
validate = true
}
},
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})
-- Инициализация "vscode-langservers-extracted" (LSP-сервер для JavaScript и PostScript)
-- Инициализация "antonk52/cssmodules-language-server" (LSP-сервер для JS, вспомогательный для CSS)
lspconfig.cssmodules_ls.setup({
init_options = {
camelCase = false,
},
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})
-- Инициализация "denoland/deno" (LSP-сервер для JavaScript и PostScript)
lspconfig.denols.setup({
init_options = {
enable = true,
unstable = false
},
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})
-- Инициализация "vscode-langservers-extracted" (LSP-сервер для JSON)
-- Инициализация "hrsh7th/vscode-langservers-extracted" (LSP-сервер для JSON)
lspconfig.jsonls.setup({
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})
-- Инициализация "luals/lua-language-server" (LSP-сервер для Lua)
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
on_attach = lspconfig_on_attach,
coq.lsp_ensure_capabilities(),
capabilities = capabilities
})

View File

@ -177,4 +177,10 @@ return require('packer').startup(function(use)
-- Аналог LSP-сервера для подержки синтаксиса nginx
use 'chr4/nginx.vim'
-- Форматировщик Prettier
use {
'prettier/vim-prettier',
run = 'yarn install --frozen-lockfile --production'
}
end)

View File

@ -19,8 +19,8 @@ vim.opt.signcolumn = 'yes'
-- 24-битные цвета
vim.opt.termguicolors = true
-- Отключение переноса строк при достижении границы окна
vim.opt_local.wrap = false
-- Перенос строк при достижении границы окна
vim.opt_local.wrap = true
-- Отображение колонки курсора
vim.opt_local.cursorcolumn = true

View File

@ -252,6 +252,11 @@ _G.packer_plugins = {
path = "/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
},
["vim-prettier"] = {
loaded = true,
path = "/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-prettier",
url = "https://github.com/prettier/vim-prettier"
},
["vim-signify"] = {
loaded = true,
path = "/home/mirzaev/.local/share/nvim/site/pack/packer/start/vim-signify",
@ -266,14 +271,34 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
-- Config for: bufferline.nvim
time([[Config for bufferline.nvim]], true)
try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins/bufferline\frequire\0", "config", "bufferline.nvim")
time([[Config for bufferline.nvim]], false)
-- Config for: symbols-outline.nvim
time([[Config for symbols-outline.nvim]], true)
try_loadstring("\27LJ\2\n7\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\28plugins/symbols-outline\frequire\0", "config", "symbols-outline.nvim")
time([[Config for symbols-outline.nvim]], false)
-- Config for: neo-tree.nvim
time([[Config for neo-tree.nvim]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/neo-tree\frequire\0", "config", "neo-tree.nvim")
time([[Config for neo-tree.nvim]], false)
-- Config for: fidget.nvim
time([[Config for fidget.nvim]], true)
try_loadstring("\27LJ\2\n.\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\19plugins/fidget\frequire\0", "config", "fidget.nvim")
time([[Config for fidget.nvim]], false)
-- Config for: nvim-treesitter
time([[Config for nvim-treesitter]], true)
try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins/treesitter\frequire\0", "config", "nvim-treesitter")
time([[Config for nvim-treesitter]], false)
-- Config for: gitsigns.nvim
time([[Config for gitsigns.nvim]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/gitsigns\frequire\0", "config", "gitsigns.nvim")
time([[Config for gitsigns.nvim]], false)
-- Config for: telescope.nvim
time([[Config for telescope.nvim]], true)
try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins/telescope\frequire\0", "config", "telescope.nvim")
time([[Config for telescope.nvim]], false)
-- Config for: nvim-autopairs
time([[Config for nvim-autopairs]], true)
try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins/autopairs\frequire\0", "config", "nvim-autopairs")
time([[Config for nvim-autopairs]], false)
-- Config for: vim-test
time([[Config for vim-test]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/vim-test\frequire\0", "config", "vim-test")
time([[Config for vim-test]], false)
-- Config for: nvim-dap
time([[Config for nvim-dap]], true)
try_loadstring("\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins/dap\frequire\0", "config", "nvim-dap")
@ -282,66 +307,46 @@ time([[Config for nvim-dap]], false)
time([[Config for lspkind-nvim]], true)
try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins/lspkind\frequire\0", "config", "lspkind-nvim")
time([[Config for lspkind-nvim]], false)
-- Config for: nvim-lint
time([[Config for nvim-lint]], true)
try_loadstring("\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17plugins/lint\frequire\0", "config", "nvim-lint")
time([[Config for nvim-lint]], false)
-- Config for: trouble.nvim
time([[Config for trouble.nvim]], true)
try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins/trouble\frequire\0", "config", "trouble.nvim")
time([[Config for trouble.nvim]], false)
-- Config for: lualine.nvim
time([[Config for lualine.nvim]], true)
try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins/lualine\frequire\0", "config", "lualine.nvim")
time([[Config for lualine.nvim]], false)
-- Config for: nvim-treesitter
time([[Config for nvim-treesitter]], true)
try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins/treesitter\frequire\0", "config", "nvim-treesitter")
time([[Config for nvim-treesitter]], false)
-- Config for: nvim-web-devicons
time([[Config for nvim-web-devicons]], true)
try_loadstring("\27LJ\2\n9\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\30plugins/nvim-web-devicons\frequire\0", "config", "nvim-web-devicons")
time([[Config for nvim-web-devicons]], false)
-- Config for: telescope.nvim
time([[Config for telescope.nvim]], true)
try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins/telescope\frequire\0", "config", "telescope.nvim")
time([[Config for telescope.nvim]], false)
-- Config for: diaglist.nvim
time([[Config for diaglist.nvim]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/diaglist\frequire\0", "config", "diaglist.nvim")
time([[Config for diaglist.nvim]], false)
-- Config for: coq_nvim
time([[Config for coq_nvim]], true)
try_loadstring("\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins/coq\frequire\0", "config", "coq_nvim")
time([[Config for coq_nvim]], false)
-- Config for: neo-tree.nvim
time([[Config for neo-tree.nvim]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/neo-tree\frequire\0", "config", "neo-tree.nvim")
time([[Config for neo-tree.nvim]], false)
-- Config for: vim-test
time([[Config for vim-test]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/vim-test\frequire\0", "config", "vim-test")
time([[Config for vim-test]], false)
-- Config for: fidget.nvim
time([[Config for fidget.nvim]], true)
try_loadstring("\27LJ\2\n.\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\19plugins/fidget\frequire\0", "config", "fidget.nvim")
time([[Config for fidget.nvim]], false)
-- Config for: nvim-autopairs
time([[Config for nvim-autopairs]], true)
try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins/autopairs\frequire\0", "config", "nvim-autopairs")
time([[Config for nvim-autopairs]], false)
-- Config for: lush.nvim
time([[Config for lush.nvim]], true)
try_loadstring("\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17plugins/lush\frequire\0", "config", "lush.nvim")
time([[Config for lush.nvim]], false)
-- Config for: symbols-outline.nvim
time([[Config for symbols-outline.nvim]], true)
try_loadstring("\27LJ\2\n7\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\28plugins/symbols-outline\frequire\0", "config", "symbols-outline.nvim")
time([[Config for symbols-outline.nvim]], false)
-- Config for: lualine-lsp-progress
time([[Config for lualine-lsp-progress]], true)
try_loadstring("\27LJ\2\n<\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0!plugins/lualine-lsp-progress\frequire\0", "config", "lualine-lsp-progress")
time([[Config for lualine-lsp-progress]], false)
-- Config for: gitsigns.nvim
time([[Config for gitsigns.nvim]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/gitsigns\frequire\0", "config", "gitsigns.nvim")
time([[Config for gitsigns.nvim]], false)
-- Config for: diaglist.nvim
time([[Config for diaglist.nvim]], true)
try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins/diaglist\frequire\0", "config", "diaglist.nvim")
time([[Config for diaglist.nvim]], false)
-- Config for: lualine.nvim
time([[Config for lualine.nvim]], true)
try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins/lualine\frequire\0", "config", "lualine.nvim")
time([[Config for lualine.nvim]], false)
-- Config for: lush.nvim
time([[Config for lush.nvim]], true)
try_loadstring("\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17plugins/lush\frequire\0", "config", "lush.nvim")
time([[Config for lush.nvim]], false)
-- Config for: coq_nvim
time([[Config for coq_nvim]], true)
try_loadstring("\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins/coq\frequire\0", "config", "coq_nvim")
time([[Config for coq_nvim]], false)
-- Config for: nvim-lint
time([[Config for nvim-lint]], true)
try_loadstring("\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17plugins/lint\frequire\0", "config", "nvim-lint")
time([[Config for nvim-lint]], false)
-- Config for: nvim-web-devicons
time([[Config for nvim-web-devicons]], true)
try_loadstring("\27LJ\2\n9\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\30plugins/nvim-web-devicons\frequire\0", "config", "nvim-web-devicons")
time([[Config for nvim-web-devicons]], false)
-- Config for: trouble.nvim
time([[Config for trouble.nvim]], true)
try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins/trouble\frequire\0", "config", "trouble.nvim")
time([[Config for trouble.nvim]], false)
-- Config for: bufferline.nvim
time([[Config for bufferline.nvim]], true)
try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins/bufferline\frequire\0", "config", "bufferline.nvim")
time([[Config for bufferline.nvim]], false)
-- Load plugins in order defined by `after`
time([[Sequenced loading]], true)
vim.cmd [[ packadd nvim-lspconfig ]]