Handle autocomplete in vim command line

This commit is contained in:
Artemis Tosini 2023-09-07 14:26:04 +00:00
parent 2dd865c192
commit f4fc83d877
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
2 changed files with 36 additions and 2 deletions

View file

@ -41,7 +41,6 @@
modules = [ modules = [
private.nixosModules.base private.nixosModules.base
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
nixvim.nixosModules.nixvim
{ home-manager.extraSpecialArgs = specialArgs; } { home-manager.extraSpecialArgs = specialArgs; }
] ++ (conf.modules or [ ]); ] ++ (conf.modules or [ ]);
}); });

View file

@ -1,6 +1,8 @@
{ pkgs, ... }: { pkgs, inputs, ... }:
{ {
imports = [ inputs.nixvim.nixosModules.nixvim ];
environment.sessionVariables = { environment.sessionVariables = {
EDITOR = "nvim"; EDITOR = "nvim";
VISUAL = "nvim"; VISUAL = "nvim";
@ -97,6 +99,9 @@
# Autocomplete # Autocomplete
plugins = { plugins = {
cmp-cmdline.enable = true;
cmp-git.enable = true;
cmp-buffer.enable = true;
nvim-cmp = { nvim-cmp = {
enable = true; enable = true;
sources = [ sources = [
@ -115,5 +120,35 @@
}; };
}; };
}; };
# For some reason you can't do this directly in nix?
extraConfigLuaPost = ''
do
local cmp = require('cmp')
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' },
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end
'';
}; };
} }