null-ls functionality

This commit is contained in:
juan 2023-03-09 17:25:09 +08:00
parent 43456e196f
commit 7223a95766
Signed by: juan
GPG Key ID: 5C1E5093C74F1DC7
6 changed files with 33 additions and 43 deletions

View File

@ -56,8 +56,5 @@ 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>', map('', '<leader>fd', ':Telescope fd<cr>', { silent = true })
{ silent = true })
map('', '<leader>tb', ':Telescope buffers<cr>', { silent = true }) map('', '<leader>tb', ':Telescope buffers<cr>', { silent = true })

View File

@ -25,7 +25,7 @@ return require('packer').startup(function(use)
-- lsp stuff -- lsp stuff
use { use {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
after = "mason-lspconfig.nvim", after = { "mason-lspconfig.nvim", "null-ls.nvim" },
config = function() require 'plugins.lsp' end config = function() require 'plugins.lsp' end
} }
use { 'williamboman/mason-lspconfig.nvim', after = 'mason.nvim' } use { 'williamboman/mason-lspconfig.nvim', after = 'mason.nvim' }
@ -68,7 +68,7 @@ return require('packer').startup(function(use)
{ 'hrsh7th/cmp-nvim-lsp-document-symbol', after = 'nvim-cmp' }, -- TS { 'hrsh7th/cmp-nvim-lsp-document-symbol', after = 'nvim-cmp' }, -- TS
{ 'ray-x/cmp-treesitter', after = 'nvim-cmp' }, -- end { 'ray-x/cmp-treesitter', after = 'nvim-cmp' }, -- end
-- Snip -- Snip
{ 'saadparwaiz1/cmp_luasnip', after = { 'nvim-cmp', 'LuaSnip' } } { 'saadparwaiz1/cmp_luasnip', after = { 'nvim-cmp', 'LuaSnip' } },
} }
} }
@ -81,11 +81,15 @@ return require('packer').startup(function(use)
} }
use { use {
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
config = function()
require('plugins.null-ls')
end,
requires = { "nvim-lua/plenary.nvim" }, requires = { "nvim-lua/plenary.nvim" },
event = "CmdlineEnter" event = 'BufEnter'
}
use {
"jay-babu/mason-null-ls.nvim",
config = function()
require 'plugins.null-ls'
end,
after = { "mason.nvim", "null-ls.nvim" }
} }
use { use {
'mattn/emmet-vim', 'mattn/emmet-vim',
@ -106,11 +110,6 @@ return require('packer').startup(function(use)
after = 'nvim-treesitter', after = 'nvim-treesitter',
config = function() require 'plugins.matchup' end config = function() require 'plugins.matchup' end
} }
use {
'abecodes/tabout.nvim',
config = function() require('tabout').setup {} end,
after = { 'nvim-treesitter', 'nvim-autopairs', 'nvim-cmp' } -- if a completion plugin is using tabs load it before
}
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
event = 'UIEnter', event = 'UIEnter',

View File

@ -1,18 +1,12 @@
local null_ls = require("null-ls") require("mason").setup()
require("mason-null-ls").setup({
-- builtins automatic_installation = false,
-- local code_actions = null_ls.builtins.code_actions automatic_setup = true, -- Recommended, but optional
local diagnostics = null_ls.builtins.diagnostics })
local formatting = null_ls.builtins.formatting require("null-ls").setup({
local hover = null_ls.builtins.hover sources = {
local completion = null_ls.builtins.completion -- Anything not supported by mason.
local sources = {
code_actions,
diagnostics,
formatting,
hover,
completion
} }
})
null_ls.setup({ sources = sources }) require 'mason-null-ls'.setup_handlers() -- If `automatic_setup` is true.

View File

@ -2,7 +2,7 @@ local npairs = require('nvim-autopairs')
npairs.setup({map_bs = true, map_cr = true, map_c_w = true}) npairs.setup({map_bs = true, map_cr = true, map_c_w = true})
-- If you want insert `(` after select function or method item -- -- If you want insert `(` after select function or method item
local cmp_autopairs = require('nvim-autopairs.completion.cmp') -- local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp') -- local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) -- cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())

View File