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
|
-- map buffer local keybindings when the language server attaches
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["UltiSnips#Anon"](args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
@ -132,7 +137,7 @@ cmp.setup({
|
|||||||
["<S-Tab>"] = cmp.mapping({
|
["<S-Tab>"] = cmp.mapping({
|
||||||
i = function(fallback)
|
i = function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
cmp.select_prev_item({ behavior = cmp.SelectBehavimr.Insert })
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
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 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
|
for _, lsp in pairs(servers) do
|
||||||
require('lspconfig')[lsp].setup {
|
require('lspconfig')[lsp].setup {
|
||||||
|
on_attach = on_attach(),
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -3,27 +3,32 @@
|
|||||||
vimUtils,
|
vimUtils,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
}: {
|
}: {
|
||||||
extraPackages = [
|
extraPackages = with pkgs; [
|
||||||
pkgs.ccls
|
ccls
|
||||||
pkgs.clang
|
clang
|
||||||
pkgs.luaformatter
|
luaformatter
|
||||||
pkgs.nil
|
nixd
|
||||||
pkgs.pyright
|
pyright
|
||||||
pkgs.rnix-lsp
|
rust-analyzer
|
||||||
pkgs.rust-analyzer
|
sumneko-lua-language-server
|
||||||
pkgs.sumneko-lua-language-server
|
svls
|
||||||
pkgs.svls
|
texlab
|
||||||
pkgs.texlab
|
tree-sitter
|
||||||
pkgs.tree-sitter
|
verible
|
||||||
pkgs.zls
|
zls
|
||||||
pkgs.verible
|
|
||||||
];
|
];
|
||||||
|
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
cmp-buffer
|
||||||
|
cmp-cmdline
|
||||||
|
cmp-nvim-lsp
|
||||||
|
cmp-nvim-ultisnips
|
||||||
|
cmp-path
|
||||||
colorizer
|
colorizer
|
||||||
fugitive
|
fugitive
|
||||||
fzf-vim
|
fzf-vim
|
||||||
gruvbox
|
gruvbox
|
||||||
|
nvim-cmp
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
nvim-treesitter
|
nvim-treesitter
|
||||||
nvim-ts-rainbow
|
nvim-ts-rainbow
|
||||||
@ -35,10 +40,5 @@
|
|||||||
vim-slime
|
vim-slime
|
||||||
vim-snippets
|
vim-snippets
|
||||||
zig-vim
|
zig-vim
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp-buffer
|
|
||||||
cmp-path
|
|
||||||
cmp-cmdline
|
|
||||||
nvim-cmp
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user