mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 08:39:42 -04:00
79 lines
2 KiB
Lua
79 lines
2 KiB
Lua
-- Autocmds are automatically loaded on the VeryLazy event
|
|
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
|
-- Add any additional autocmds here
|
|
local lsp = require('lsp-zero').preset({})
|
|
|
|
lsp.on_attach(function(client, bufnr)
|
|
lsp.default_keymaps({ buffer = bufnr })
|
|
end)
|
|
|
|
-- When you don't have mason.nvim installed
|
|
-- You'll need to list the servers installed in your system
|
|
lsp.setup_servers({
|
|
'tsserver',
|
|
'eslint',
|
|
'hls',
|
|
'pyright',
|
|
'nil_ls',
|
|
'volar',
|
|
'cssls',
|
|
'html',
|
|
'jsonls',
|
|
'diagnosticls',
|
|
'lua_ls',
|
|
'marksman',
|
|
'purescriptls',
|
|
'tailwindcss',
|
|
'bashls'
|
|
})
|
|
|
|
-- (Optional) Configure lua language server for neovim
|
|
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
|
|
|
lsp.setup()
|
|
|
|
local cmp = require 'cmp'
|
|
cmp.setup {
|
|
snippet = {
|
|
expand = function(args)
|
|
require('luasnip').lsp_expand(args.body)
|
|
end,
|
|
},
|
|
sources = {
|
|
{ name = 'nvim_lsp' },
|
|
{ name = 'luasnip' },
|
|
-- other sources...
|
|
},
|
|
-- other configurations...
|
|
}
|
|
|
|
vim.cmd [[
|
|
au BufRead,BufNewFile *.purs set filetype=purescript
|
|
]]
|
|
|
|
local luasnip = require 'luasnip'
|
|
|
|
cmp.setup {
|
|
-- other configurations...
|
|
mapping = {
|
|
['<Tab>'] = cmp.mapping(function(fallback)
|
|
if vim.fn.pumvisible() == 1 then
|
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
|
|
elseif luasnip.expand_or_jumpable() then
|
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
|
else
|
|
fallback()
|
|
end
|
|
end, { 'i', 's' }),
|
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
if vim.fn.pumvisible() == 1 then
|
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n')
|
|
elseif luasnip.jumpable(-1) then
|
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
|
|
else
|
|
fallback()
|
|
end
|
|
end, { 'i', 's' }),
|
|
},
|
|
}
|
|
|