diff --git a/nvim/.config/nvim/lua/axp/plugins/init.lua b/nvim/.config/nvim/lua/axp/plugins/init.lua index e4d1eed..432e546 100644 --- a/nvim/.config/nvim/lua/axp/plugins/init.lua +++ b/nvim/.config/nvim/lua/axp/plugins/init.lua @@ -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') diff --git a/nvim/.config/nvim/lua/axp/plugins/lsp.lua b/nvim/.config/nvim/lua/axp/plugins/lsp.lua index f781ad2..b2da364 100644 --- a/nvim/.config/nvim/lua/axp/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/axp/plugins/lsp.lua @@ -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', 'rn', vim.lsp.buf.rename) + vim.keymap.set('n', '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', 'D', vim.lsp.buf.type_definition) + vim.keymap.set('n', 'K', vim.lsp.buf.hover) + vim.keymap.set('n', '', vim.lsp.buf.signature_help) - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('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('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('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('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('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 diff --git a/nvim/.config/nvim/lua/axp/plugins/lualine.lua b/nvim/.config/nvim/lua/axp/plugins/lualine.lua deleted file mode 100644 index 9582128..0000000 --- a/nvim/.config/nvim/lua/axp/plugins/lualine.lua +++ /dev/null @@ -1,4 +0,0 @@ -local status, lualine = pcall(require, 'lualine') -if (not status) then return end - -lualine.setup {} diff --git a/nvim/.config/nvim/lua/axp/plugins/luasnip/snippets.lua b/nvim/.config/nvim/lua/axp/plugins/luasnip/snippets.lua index fb68508..3d92599 100644 --- a/nvim/.config/nvim/lua/axp/plugins/luasnip/snippets.lua +++ b/nvim/.config/nvim/lua/axp/plugins/luasnip/snippets.lua @@ -102,6 +102,7 @@ if (status_luasnip) then M.list = { javascript = javascript, typescript = javascript, + typescriptreact = javascript, vue = vue } end diff --git a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua index 558616a..dc129a2 100644 --- a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua +++ b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua @@ -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 } diff --git a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua deleted file mode 100644 index e558824..0000000 --- a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua +++ /dev/null @@ -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 } }) - } -} diff --git a/nvim/.config/nvim/lua/axp/plugins/prettier.lua b/nvim/.config/nvim/lua/axp/plugins/prettier.lua deleted file mode 100644 index fcca015..0000000 --- a/nvim/.config/nvim/lua/axp/plugins/prettier.lua +++ /dev/null @@ -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' - } -} diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 0375084..41a68ba 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -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",