Use null-ls and mason
This commit is contained in:
parent
a4f9ba5719
commit
f94ba6234b
@ -48,7 +48,7 @@ map('', '<leader>tt', ':TagbarToggle<cr>', {silent = true})
|
|||||||
map('', '<C-n>', ':NvimTreeToggle<cr>', { silent = true })
|
map('', '<C-n>', ':NvimTreeToggle<cr>', { silent = true })
|
||||||
|
|
||||||
-- toggle formatter
|
-- toggle formatter
|
||||||
map('', '<leader>fm', ':Neoformat<cr>', {silent = true})
|
map('', '<leader>fm', ':lua vim.lsp.buf.formatting()<cr>', { silent = true })
|
||||||
|
|
||||||
-- toggle Hop
|
-- toggle Hop
|
||||||
map('', '<leader>b', ':HopWordBC<cr>', { silent = true })
|
map('', '<leader>b', ':HopWordBC<cr>', { silent = true })
|
||||||
@ -56,5 +56,8 @@ map('', '<leader>w', ':HopWordAC<cr>', {silent = true})
|
|||||||
map('', '<leader>l', ':HopWordCurrentLine<cr>', { silent = true })
|
map('', '<leader>l', ':HopWordCurrentLine<cr>', { silent = true })
|
||||||
|
|
||||||
-- telescope stuff
|
-- telescope stuff
|
||||||
map('', '<leader>fd', ':Telescope fd<cr>', {silent = true})
|
map('', '<leader>fd', ':Telescope fd<cr>',
|
||||||
|
|
||||||
|
|
||||||
|
{ silent = true })
|
||||||
map('', '<leader>tb', ':Telescope buffers<cr>', { silent = true })
|
map('', '<leader>tb', ':Telescope buffers<cr>', { silent = true })
|
||||||
|
@ -26,16 +26,16 @@ return require('packer').startup(function(use)
|
|||||||
-- }
|
-- }
|
||||||
|
|
||||||
-- lsp stuff
|
-- lsp stuff
|
||||||
use {'neovim/nvim-lspconfig', event = 'UIEnter'}
|
|
||||||
use {
|
use {
|
||||||
'williamboman/nvim-lsp-installer',
|
'neovim/nvim-lspconfig',
|
||||||
after = 'nvim-lspconfig',
|
after = "mason-lspconfig.nvim",
|
||||||
config = function() require 'plugins.lspinstall' end
|
config = function() require 'plugins.lsp' end
|
||||||
}
|
}
|
||||||
use {'hrsh7th/cmp-nvim-lsp', after = 'nvim-lsp-installer'}
|
use { 'williamboman/mason-lspconfig.nvim', after = 'mason.nvim' }
|
||||||
|
use { 'hrsh7th/cmp-nvim-lsp', after = 'nvim-lspconfig' }
|
||||||
use {
|
use {
|
||||||
'ray-x/lsp_signature.nvim',
|
'ray-x/lsp_signature.nvim',
|
||||||
after = 'nvim-lsp-installer',
|
after = 'nvim-lspconfig',
|
||||||
config = function() require 'plugins.lsp-signature' end
|
config = function() require 'plugins.lsp-signature' end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +72,20 @@ return require('packer').startup(function(use)
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- formating and editing
|
-- formating and editing
|
||||||
|
use { "williamboman/mason.nvim", event = "UIEnter" }
|
||||||
use {
|
use {
|
||||||
'windwp/nvim-autopairs',
|
'windwp/nvim-autopairs',
|
||||||
after = 'nvim-cmp',
|
after = 'nvim-cmp',
|
||||||
config = function() require('plugins.nvim-autopairs') end
|
config = function() require('plugins.nvim-autopairs') end
|
||||||
}
|
}
|
||||||
use {'sbdchd/neoformat', cmd = 'Neoformat'}
|
use {
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
config = function()
|
||||||
|
require('plugins.null-ls')
|
||||||
|
end,
|
||||||
|
requires = { "nvim-lua/plenary.nvim" },
|
||||||
|
event = "CmdlineEnter"
|
||||||
|
}
|
||||||
use {
|
use {
|
||||||
'mattn/emmet-vim',
|
'mattn/emmet-vim',
|
||||||
ft = { 'html', 'htmldjango', 'css', 'markdown' },
|
ft = { 'html', 'htmldjango', 'css', 'markdown' },
|
||||||
|
15
lua/plugins/lsp.lua
Normal file
15
lua/plugins/lsp.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
require("mason").setup {ui = {icons = {package_installed = "✓"}}}
|
||||||
|
require("mason-lspconfig").setup {ensure_installed = {"sumneko_lua"}}
|
||||||
|
-- Dynamic loading of lsp servers
|
||||||
|
require("mason-lspconfig").setup_handlers {
|
||||||
|
-- The first entry (without a key) will be the default handler
|
||||||
|
-- and will be called for each installed server that doesn't have
|
||||||
|
-- a dedicated handler.
|
||||||
|
function(server_name) -- default handler (optional)
|
||||||
|
require("lspconfig")[server_name].setup {}
|
||||||
|
end,
|
||||||
|
-- Next, you can provide targeted overrides for specific servers.
|
||||||
|
-- For example, a handler override for the `rust_analyzer`:
|
||||||
|
["rust_analyzer"] = function() require("rust-tools").setup {} end
|
||||||
|
}
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
local lsp_installer = require("nvim-lsp-installer")
|
|
||||||
|
|
||||||
-- Register a handler that will be called for all installed servers.
|
|
||||||
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
|
||||||
local opts = {}
|
|
||||||
|
|
||||||
-- (optional) Customize the options passed to the server
|
|
||||||
-- if server.name == "tsserver" then
|
|
||||||
-- opts.root_dir = function() ... end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- This setup() function is exactly the same as lspconfig's setup function.
|
|
||||||
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
|
||||||
server:setup(opts)
|
|
||||||
end)
|
|
||||||
|
|
18
lua/plugins/null-ls.lua
Normal file
18
lua/plugins/null-ls.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
-- builtins
|
||||||
|
-- local code_actions = null_ls.builtins.code_actions
|
||||||
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
|
local formatting = null_ls.builtins.formatting
|
||||||
|
local hover = null_ls.builtins.hover
|
||||||
|
local completion = null_ls.builtins.completion
|
||||||
|
|
||||||
|
local sources = {
|
||||||
|
code_actions,
|
||||||
|
diagnostics,
|
||||||
|
formatting,
|
||||||
|
hover,
|
||||||
|
completion
|
||||||
|
}
|
||||||
|
|
||||||
|
null_ls.setup({ sources = sources })
|
Loading…
Reference in New Issue
Block a user