feat: auto save and fix cmp keymap

This commit is contained in:
xinyangli 2024-09-02 11:29:17 +08:00
parent 4138a017a3
commit 7e0140a6a9
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk
2 changed files with 43 additions and 12 deletions

View file

@ -47,6 +47,8 @@
signcolumn = "yes";
# Search case sensitivity.
ic = true;
# For dragging windows
mouse = "a";
};
# Clipboard.
@ -54,5 +56,12 @@
register = "unnamedplus";
providers.xclip.enable = true;
};
autoCmd = [
{
event = "InsertLeave";
pattern = "*";
command = "silent! update";
}
];
};
}

View file

@ -2,7 +2,6 @@
plugins = {
cmp = {
enable = true;
autoEnableSources = false;
settings = {
sources = [
{ name = "nvim_lsp"; }
@ -30,10 +29,33 @@
"<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;
};
}
];
}