disable tabnine on non-x86
This commit is contained in:
parent
b1be5a910c
commit
1fdd8ccc0e
4 changed files with 63 additions and 27 deletions
|
@ -92,6 +92,7 @@ in {
|
|||
];
|
||||
|
||||
vim.g.isDesktop = config.isDesktop;
|
||||
vim.g.nix_system = pkgs.system;
|
||||
|
||||
output.path.path = with pkgs; [ripgrep];
|
||||
};
|
||||
|
|
|
@ -17,7 +17,12 @@
|
|||
]
|
||||
++ (
|
||||
if config.isDesktop
|
||||
then [cmp-nvim-lsp cmp-tabnine]
|
||||
then [cmp-nvim-lsp]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if config.isDesktop && pkgs.system == "x86_64-linux"
|
||||
then [cmp-tabnine]
|
||||
else []
|
||||
);
|
||||
extraLuaModules = ["config.cmp"];
|
||||
|
|
|
@ -4,6 +4,16 @@ local compare = require('cmp.config.compare')
|
|||
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
local with_tabnine = vim.g.isDesktop and (vim.g.nix_system == "x86_64-linux");
|
||||
|
||||
function concat(a)
|
||||
res = {}
|
||||
for i,v in ipairs(a) do
|
||||
table.foreach(v, function(k, v) table.insert(res, v) end)
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
|
@ -23,7 +33,8 @@ cmp.setup({
|
|||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources(
|
||||
vim.g.isDesktop and {{ name = 'nvim_lsp' }, { name = 'cmp_tabnine' }} or {},
|
||||
vim.g.isDesktop and {{ name = 'nvim_lsp' }} or {},
|
||||
with_tabnine and {{ name = 'cmp_tabnine' }} or {},
|
||||
{
|
||||
{ name = 'luasnip' },
|
||||
}, {
|
||||
|
@ -32,17 +43,19 @@ cmp.setup({
|
|||
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require('cmp_tabnine.compare'),
|
||||
compare.offset,
|
||||
compare.exact,
|
||||
compare.score,
|
||||
compare.recently_used,
|
||||
compare.kind,
|
||||
compare.sort_text,
|
||||
compare.length,
|
||||
compare.order,
|
||||
},
|
||||
comparators = concat({
|
||||
with_tabnine and {require('cmp_tabnine.compare')} or {},
|
||||
{
|
||||
compare.offset,
|
||||
compare.exact,
|
||||
compare.score,
|
||||
compare.recently_used,
|
||||
compare.kind,
|
||||
compare.sort_text,
|
||||
compare.length,
|
||||
compare.order,
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
formatting = {
|
||||
|
@ -129,17 +142,19 @@ cmp.setup.cmdline(':', {
|
|||
})
|
||||
})
|
||||
|
||||
local tabnine = require('cmp_tabnine.config')
|
||||
tabnine:setup({
|
||||
max_lines = 1000,
|
||||
max_num_results = 20,
|
||||
sort = true,
|
||||
run_on_every_keystroke = true,
|
||||
snippet_placeholder = '..',
|
||||
ignored_file_types = {
|
||||
-- default is not to ignore
|
||||
-- uncomment to ignore in lua:
|
||||
-- lua = true
|
||||
},
|
||||
show_prediction_strength = true
|
||||
})
|
||||
if with_tabnine then
|
||||
local tabnine = require('cmp_tabnine.config')
|
||||
tabnine:setup({
|
||||
max_lines = 1000,
|
||||
max_num_results = 20,
|
||||
sort = true,
|
||||
run_on_every_keystroke = true,
|
||||
snippet_placeholder = '..',
|
||||
ignored_file_types = {
|
||||
-- default is not to ignore
|
||||
-- uncomment to ignore in lua:
|
||||
-- lua = true
|
||||
},
|
||||
show_prediction_strength = true
|
||||
})
|
||||
end
|
||||
|
|
15
config/programs/vim/modules/ux/hop.nix
Normal file
15
config/programs/vim/modules/ux/hop.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{pkgs, ...}: {
|
||||
output.plugins = with pkgs.vimPlugins; [hop-nvim];
|
||||
plugin.setup.hop = {
|
||||
case_insensitive = true;
|
||||
char2_fallback_key = "<CR>";
|
||||
quit_key = "<Etc>";
|
||||
};
|
||||
|
||||
vim.keybindings.keybindings.f = {
|
||||
command = "<cmd>lua require('hop').hint_char2()<cr>";
|
||||
options.silent = true;
|
||||
label = "nvim-hop char2";
|
||||
mode = "";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue