update nvim config
This commit is contained in:
47
nvim/.config/nvim/lua/plugins/cmp.lua
Normal file
47
nvim/.config/nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = {
|
||||
['<Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
if not cmp.select_next_item() then
|
||||
if vim.bo.buftype ~= 'prompt' and has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
else
|
||||
return vim.cmd(">")
|
||||
end
|
||||
end,
|
||||
|
||||
['<S-Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
if not cmp.select_prev_item() then
|
||||
if vim.bo.buftype ~= 'prompt' and has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
else
|
||||
return vim.cmd("<")
|
||||
end
|
||||
end,
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
34
nvim/.config/nvim/lua/plugins/diagnostics.lua
Normal file
34
nvim/.config/nvim/lua/plugins/diagnostics.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
local levels = vim.diagnostic.severity
|
||||
|
||||
local opts = {
|
||||
virtual_text = false,
|
||||
float = {
|
||||
border = "rounded",
|
||||
},
|
||||
signs = {
|
||||
text = {
|
||||
[levels.ERROR] = '✘',
|
||||
[levels.WARN] = '▲',
|
||||
[levels.HINT] = '⚑',
|
||||
[levels.INFO] = '»',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local sign_define = function(name, text)
|
||||
local hl = 'DiagnosticSign' .. name
|
||||
vim.fn.sign_define(hl, {
|
||||
texthl = hl,
|
||||
text = text,
|
||||
numhl = ''
|
||||
})
|
||||
end
|
||||
|
||||
if vim.fn.has('nvim-0.10') == 0 then
|
||||
sign_define('Error', opts.signs.text[levels.ERROR])
|
||||
sign_define('Warn', opts.signs.text[levels.WARN])
|
||||
sign_define('Hint', opts.signs.text[levels.HINT])
|
||||
sign_define('Info', opts.signs.text[levels.INFO])
|
||||
end
|
||||
|
||||
vim.diagnostic.config(opts)
|
@@ -1,7 +1,10 @@
|
||||
require('plugins.colorscheme')
|
||||
require('plugins.diagnostics')
|
||||
require('plugins.gitsigns')
|
||||
require('plugins.indent-blankline')
|
||||
require('plugins.nvim-autopairs')
|
||||
require('plugins.nvim-tree')
|
||||
require('plugins.telescope')
|
||||
require('plugins.treesitter')
|
||||
require('plugins.cmp')
|
||||
require('plugins.mason')
|
||||
|
15
nvim/.config/nvim/lua/plugins/mason.lua
Normal file
15
nvim/.config/nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'ts_ls',
|
||||
'html',
|
||||
'cssls',
|
||||
'jsonls',
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({})
|
||||
end,
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user