vim: experiment with nixd, add ultisnips to nvim-cmp
This commit is contained in:
parent
4630720d82
commit
2a9bcf2f24
@ -114,6 +114,11 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
@ -132,7 +137,7 @@ cmp.setup({
|
||||
["<S-Tab>"] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
cmp.select_prev_item({ behavior = cmp.SelectBehavimr.Insert })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
@ -168,10 +173,27 @@ cmp.setup({
|
||||
}
|
||||
})
|
||||
|
||||
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'lua_ls', 'rnix', 'texlab', 'verible' }
|
||||
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'lua_ls', 'nixd', 'texlab', 'verible' }
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local on_attach = function(bufnr)
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "line",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
end
|
||||
for _, lsp in pairs(servers) do
|
||||
require('lspconfig')[lsp].setup {
|
||||
on_attach = on_attach(),
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
@ -3,27 +3,32 @@
|
||||
vimUtils,
|
||||
fetchFromGitHub,
|
||||
}: {
|
||||
extraPackages = [
|
||||
pkgs.ccls
|
||||
pkgs.clang
|
||||
pkgs.luaformatter
|
||||
pkgs.nil
|
||||
pkgs.pyright
|
||||
pkgs.rnix-lsp
|
||||
pkgs.rust-analyzer
|
||||
pkgs.sumneko-lua-language-server
|
||||
pkgs.svls
|
||||
pkgs.texlab
|
||||
pkgs.tree-sitter
|
||||
pkgs.zls
|
||||
pkgs.verible
|
||||
extraPackages = with pkgs; [
|
||||
ccls
|
||||
clang
|
||||
luaformatter
|
||||
nixd
|
||||
pyright
|
||||
rust-analyzer
|
||||
sumneko-lua-language-server
|
||||
svls
|
||||
texlab
|
||||
tree-sitter
|
||||
verible
|
||||
zls
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
cmp-buffer
|
||||
cmp-cmdline
|
||||
cmp-nvim-lsp
|
||||
cmp-nvim-ultisnips
|
||||
cmp-path
|
||||
colorizer
|
||||
fugitive
|
||||
fzf-vim
|
||||
gruvbox
|
||||
nvim-cmp
|
||||
nvim-lspconfig
|
||||
nvim-treesitter
|
||||
nvim-ts-rainbow
|
||||
@ -35,10 +40,5 @@
|
||||
vim-slime
|
||||
vim-snippets
|
||||
zig-vim
|
||||
cmp-nvim-lsp
|
||||
cmp-buffer
|
||||
cmp-path
|
||||
cmp-cmdline
|
||||
nvim-cmp
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user