61 lines
1.6 KiB
Nix
61 lines
1.6 KiB
Nix
{
|
|
plugins = {
|
|
cmp = {
|
|
enable = true;
|
|
settings = {
|
|
sources = [
|
|
{ name = "nvim_lsp"; }
|
|
{
|
|
name = "buffer"; # text within current buffer
|
|
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
|
keywordLength = 3;
|
|
}
|
|
{
|
|
name = "path"; # file system paths
|
|
keywordLength = 3;
|
|
}
|
|
{
|
|
name = "luasnip"; # snippets
|
|
keywordLength = 3;
|
|
}
|
|
];
|
|
mapping = {
|
|
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
|
"<C-j>" = "cmp.mapping.select_next_item()";
|
|
"<C-k>" = "cmp.mapping.select_prev_item()";
|
|
"<C-e>" = "cmp.mapping.abort()";
|
|
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
|
|
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
|
"<C-Space>" = "cmp.mapping.complete()";
|
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
|
"<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
|
};
|
|
};
|
|
};
|
|
cmp-nvim-lsp.enable = true;
|
|
cmp-path.enable = true;
|
|
cmp-buffer.enable = true;
|
|
};
|
|
keymaps = [
|
|
# Need to map macro recording to another key due to:
|
|
# https://github.com/hrsh7th/nvim-cmp/issues/1692
|
|
{
|
|
mode = [ "n" ];
|
|
key = "<leader>q";
|
|
action = "q";
|
|
options = {
|
|
noremap = true;
|
|
silent = true;
|
|
};
|
|
}
|
|
{
|
|
mode = [ "n" ];
|
|
key = "q";
|
|
action = "<Nop>";
|
|
options = {
|
|
noremap = true;
|
|
silent = true;
|
|
};
|
|
}
|
|
];
|
|
}
|