update nvim

This commit is contained in:
AntoXa PRO 2023-10-02 10:33:32 +03:00
parent f0f0a978a0
commit eb9c12d6bb
8 changed files with 25 additions and 83 deletions

View File

@ -13,7 +13,6 @@ M.list = {
-- View.
'EdenEast/nightfox.nvim',
'lukas-reineke/indent-blankline.nvim',
-- 'nvim-lualine/lualine.nvim',
-- Lsp.
'neovim/nvim-lspconfig',
@ -22,8 +21,7 @@ M.list = {
'hrsh7th/cmp-nvim-lsp',
--- Null-ls.
-- 'jose-elias-alvarez/null-ls.nvim',
'MunifTanjim/prettier.nvim',
'jose-elias-alvarez/null-ls.nvim',
-- Autocompletion
'L3MON4D3/LuaSnip',
@ -40,14 +38,12 @@ M.init = function()
-- View.
require('axp.plugins.nightfox')
require('axp.plugins.blankline')
-- require('axp.plugins.lualine')
-- Lsp.
require('axp.plugins.lsp')
-- Null-ls.
-- require('axp.plugins.null-ls')
require('axp.plugins.prettier')
require('axp.plugins.null-ls')
-- Autocompletion
require('axp.plugins.luasnip')

View File

@ -36,45 +36,17 @@ local servers = {
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself
-- many times.
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action)
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
-- LSP functionality
vim.keymap.set('n', 'gI', vim.lsp.buf.implementation)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition)
vim.keymap.set('n', 'K', vim.lsp.buf.hover)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
-- vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
-- vim.lsp.buf.format()
-- end, { desc = 'Format current buffer with LSP' })
end
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers

View File

@ -1,4 +0,0 @@
local status, lualine = pcall(require, 'lualine')
if (not status) then return end
lualine.setup {}

View File

@ -102,6 +102,7 @@ if (status_luasnip) then
M.list = {
javascript = javascript,
typescript = javascript,
typescriptreact = javascript,
vue = vue
}
end

View File

@ -7,10 +7,17 @@ local formatting = null_ls.builtins.formatting
-- Init.
null_ls.setup {
sources = {},
sources = {
formatting.prettier.with({ extra_args = { "--config", prettier_config } })
},
on_attach = function (client, bufnr)
if client.supports_method('textDocument/formatting') then
print('Test textDocument/formatting')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
end
}

View File

@ -1,15 +0,0 @@
-- Null-ls.
local status_null_ls, null_ls = pcall(require, 'null-ls')
if (not status_null_ls) then return end
-- Config.
local prettier_config = vim.fn.stdpath('config') .. '/lua/axp/plugins/null-ls/.prettierrc'
local formatting = null_ls.builtins.formatting
-- local diagnostics = null_ls.builtins.diagnostics
-- Init.
null_ls.setup {
sources = {
formatting.prettier.with({ extra_args = { "--config", prettier_config } })
}
}

View File

@ -1,15 +0,0 @@
local status, prettier = pcall(require, 'prettier')
if (not status) then return end
prettier.setup {
bin = 'prettier',
filetype = {
'html',
'typescript',
'typescriptreact',
'css',
'sass',
'scss',
'json'
}
}

View File

@ -109,6 +109,11 @@ _G.packer_plugins = {
path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/nightfox.nvim",
url = "https://github.com/EdenEast/nightfox.nvim"
},
["null-ls.nvim"] = {
loaded = true,
path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
},
["nvim-autopairs"] = {
loaded = true,
path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
@ -139,11 +144,6 @@ _G.packer_plugins = {
path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["prettier.nvim"] = {
loaded = true,
path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/prettier.nvim",
url = "https://github.com/MunifTanjim/prettier.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/telescope.nvim",