Merge remote-tracking branch 'origin/nixos' into nixos

nixos
Moritz Böhme 2023-03-09 16:21:51 +01:00
commit 033ae38d5c
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
3 changed files with 62 additions and 51 deletions

View File

@ -50,59 +50,64 @@ require("nvim-treesitter.configs").setup({
}, },
}) })
local cmp = require("cmp") -- load cmp on InsertEnter
local luasnip = require("luasnip") vim.api.nvim_create_autocmd("InsertEnter", {
require("copilot_cmp").setup() callback = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
require("copilot_cmp").setup()
cmp.setup({ cmp.setup({
formatting = { formatting = {
format = require("lspkind").cmp_format({ format = require("lspkind").cmp_format({
mode = "symbol", -- show only symbol annotations mode = "symbol", -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = { symbol_map = {
Copilot = "", Copilot = "",
},
}),
}, },
}), snippet = {
}, -- REQUIRED - you must specify a snippet engine
snippet = { expand = function(args)
-- REQUIRED - you must specify a snippet engine require("luasnip").lsp_expand(args.body)
expand = function(args) end,
require("luasnip").lsp_expand(args.body) },
end, mapping = cmp.mapping.preset.insert({
}, ["<C-b>"] = cmp.mapping.scroll_docs(-4),
mapping = cmp.mapping.preset.insert({ ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-Space>"] = cmp.mapping.complete(),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-e>"] = cmp.mapping.abort(),
["<C-Space>"] = cmp.mapping.complete(), ["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-e>"] = cmp.mapping.abort(), ["<Tab>"] = cmp.mapping(function(fallback)
["<CR>"] = cmp.mapping.confirm({ select = true }), if cmp.visible() then
["<Tab>"] = cmp.mapping(function(fallback) cmp.select_next_item()
if cmp.visible() then elseif luasnip.expand_or_jumpable() then
cmp.select_next_item() luasnip.expand_or_jump()
elseif luasnip.expand_or_jumpable() then else
luasnip.expand_or_jump() fallback()
else end
fallback() end, { "i", "s" }),
end ["<S-Tab>"] = cmp.mapping(function(fallback)
end, { "i", "s" }), if cmp.visible() then
["<S-Tab>"] = cmp.mapping(function(fallback) cmp.select_prev_item()
if cmp.visible() then elseif luasnip.jumpable(-1) then
cmp.select_prev_item() luasnip.jump(-1)
elseif luasnip.jumpable(-1) then else
luasnip.jump(-1) fallback()
else end
fallback() end, { "i", "s" }),
end }),
end, { "i", "s" }), sources = {
}), { name = "buffer", priority = 1 },
sources = { { name = "copilot", priority = 8 },
{ name = "buffer", priority = 1 }, { name = "luasnip", priority = 7 },
{ name = "copilot", priority = 8 }, { name = "nvim_lsp", priority = 9 },
{ name = "luasnip", priority = 7 }, { name = "orgmode", priority = 9 },
{ name = "nvim_lsp", priority = 9 }, },
{ name = "orgmode", priority = 9 }, })
}, end,
}) })
---merge tables ---merge tables

View File

@ -5,4 +5,5 @@ lib.composeManyExtensions [
(import ./packages.nix { inherit inputs lib; }) (import ./packages.nix { inherit inputs lib; })
(import ./vimPlugins.nix { inherit inputs lib; }) (import ./vimPlugins.nix { inherit inputs lib; })
(import ./wayland.nix { inherit inputs lib; }) (import ./wayland.nix { inherit inputs lib; })
(import ./lib.nix { inherit inputs lib; })
] ]

5
overlays/lib.nix Normal file
View File

@ -0,0 +1,5 @@
{ lib, inputs }:
final: prev: {
inherit lib;
}