This also moved away from nvim-compe as it's deprecated in favor of nvim-cmp.
66COC6TI5UGIYQMWHOTONDBSH63AQYAHYP5UKYZR65Y6VEVJIPZQC
ZRJNPDNXM2XBDKJH4I4WFFNGFVWGFDPWRKAICRN45CMYRR5VADZAC
PX3D4SDCXCVNA4ZPA4Y4O675C3KSYJWQOZCLVLSNX4LLSET3MDWAC
QKXSAPK72YBZXXIZDA6NDWIRNXU3BAAEM6WGDZTDODDJJSAHOIHAC
YQUFGGWU6WFCVRSGS3J577RQL7WJRQCLXVHHXVXDUJTMDRQC5BSQC
6TJTI7RQ5QVCBPW6BKPUL6XUFWUIMXH774UAFCHACDJQWDMPSZNQC
WOVOJYXQSEPSUTQGPT625ZIXV7GHKFRJ64CGGL64QBNOIRHOKVTAC
5C7V5HBQN72EONBIORLYJPIY4OYZTI3YJEWIDCTLSDOQ44N6W4YAC
L2MS4TSNRLJSAN6IYUQJQIDLBJ46DI6J72RQV7VUDMY6LZE44G5AC
XYVOW54TWIJYX7VDWOTXFNM27C2ODJKTGUZ3LXVDURPHHLBKXS6QC
};
})
(buildVimPlugin {
pname = "nvim-cmp";
version = "2021-10-16";
buildInputs = [pkgs.nixpkgs-unstable.stylua];
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "nvim-cmp";
rev = "4ecf2a24265626a2c00427394deb4747c7b9d5dc";
sha256 = "pJ1bEmOEsW8fDZLNawGwpbPsiIEaYnXsA3GKlxYnI9w=";
};
})
(buildVimPlugin {
pname = "cmp-nvim-lsp";
version = "2021-10-17";
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "cmp-nvim-lsp";
rev = "accbe6d97548d8d3471c04d512d36fa61d0e4be8";
sha256 = "lVcTATtmUu1dL9CvX/GR0b5fNj9IyWsls6kD07I3Hbc=";
};
})
(buildVimPlugin {
pname = "cmp-buffer";
version = "2021-10-17";
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "cmp-buffer";
rev = "5dde5430757696be4169ad409210cf5088554ed6";
sha256 = "lLP6gnuSN/tJiJ1sb2u6Xm5G2P59pz6tnOGDRfbivjk=";
vim.opt.completeopt = "menuone,noselect";
vim.opt.inccommand = "nosplit";
-- go to the following link to see docs or do :help compe
-- https://github.com/hrsh7th/nvim-compe/blob/master/doc/compe.txt
require'compe'.setup {
enabled = true;
autocomplete = true;
debug = false;
preselect = 'enabled';
throttle_timeout = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
local cmp = require'cmp';
cmp.setup({
snippet = {
expand = function(args)
-- For `vsnip` user.
vim.fn["vsnip#anonymous"](args.body)
--shamelessly copied from nvim-compe's readme here:
--https://github.com/hrsh7th/nvim-compe
local check_back_space = function()
local col = vim.fn.col('.') - 1
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
return true
else
return false
end
end
-- For `ultisnips` user.
-- vim.fn["UltiSnips#Anon"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'buffer' },
}
})
-- Use (s-)tab to:
--- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder
_G.tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then -- gonna be honest here, I don't use snippets
return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn['compe#complete']()
end
end
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)"
else
-- If <S-Tab> is not working in your terminal, change it to <C-h>
return t "<S-Tab>"
end
end
local function on_attach(_client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
--Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
end
"nixpkgs-unstable": {
"locked": {
"lastModified": 1634172192,
"narHash": "sha256-FBF4U/T+bMg4sEyT/zkgasvVquGzgdAf4y8uCosKMmo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2cf9db0e3d45b9d00f16f2836cb1297bcadc475e",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},