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

This commit is contained in:
Moritz Böhme 2023-09-07 09:04:14 +02:00
commit ffdc672cb2
16 changed files with 364 additions and 133 deletions

View file

@ -149,7 +149,6 @@ in
# nix
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
comma
manix
nix-index
nix-output-monitor

View file

@ -24,6 +24,8 @@ in
};
config.nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
package = pkgs.nix-super;
extraOptions = "experimental-features = nix-command flakes";

View file

@ -26,7 +26,7 @@ let
);
descString = optionalString (desc != null) "desc = ${quote desc},";
in
''{ ${quote key}, ${cmdString}, mode = ${quote mode}, ${descString} }'';
''{ ${quote key}, ${cmdString}, mode = ${listToStringOneLine quote mode}, ${descString} }'';
lazySpecFromPlugin =
{ plugin, dependencies, init, conf, lazy, event, enabled, cmd, ft, priority, keys }:
listToStringMultiLine'
@ -161,8 +161,8 @@ in
'';
};
mode = mkOption {
type = str;
default = "n";
type = listOf str;
default = [ "n" ];
description = ''
Mode to bind the key in.
'';

View file

@ -1,2 +0,0 @@
-- dont show ghost text
vim.g.codeium_render = false

View file

@ -1,6 +0,0 @@
vim.g.coq_settings = {
auto_start = "shut-up",
keymap = {
jump_to_mark = "<c-n>",
},
}

View file

@ -1,4 +0,0 @@
require("coq_3p")({
{ src = "orgmode", short_name = "ORG" },
{ src = "codeium", short_name = "COD" },
})

View file

@ -74,6 +74,33 @@ with builtins;
{ plugin = nvim-web-devicons; }
];
}
{
plugin = nvim-cmp;
conf = readFile ./nvim-cmp.lua;
event = [ "InsertEnter" ];
dependencies = [
{
plugin = nvim-autopairs;
conf = /* lua */ ''
require("nvim-autopairs").setup({})
'';
}
{ plugin = cmp-async-path; }
{ plugin = cmp-buffer; }
{ plugin = cmp-cmdline; }
{ plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; }
{
plugin = codeium-nvim;
conf = /* lua */ ''
require("codeium").setup({})
'';
}
{ plugin = friendly-snippets; }
{ plugin = lspkind-nvim; }
{ plugin = luasnip; }
];
}
{
plugin = todo-comments-nvim;
event = [ "BufReadPost" "BufNewFile" ];
@ -103,10 +130,6 @@ with builtins;
'';
dependencies = [
{ plugin = nvim-ts-context-commentstring; }
{
plugin = orgmode;
conf = readFile ./orgmode.lua;
}
];
}
{
@ -114,6 +137,7 @@ with builtins;
event = [ "BufRead" "BufNewFile" ];
conf = readFile ./nvim-lspconfig.lua;
dependencies = [
{ plugin = lsp_signature-nvim; }
{
plugin = null-ls-nvim;
conf = readFile ./null-ls-nvim.lua;
@ -148,6 +172,7 @@ with builtins;
}
];
}
{ plugin = actions-preview-nvim; }
];
}
{
@ -157,7 +182,31 @@ with builtins;
}
{
plugin = vim-fugitive;
event = [ "VeryLazy" ];
cmd = [
"G"
"Git"
"Ggrep"
"Glgrep"
"Gclog"
"Gllog"
"Gcd"
"Glcd"
"Gedit"
"Gsplit"
"Gvsplit"
"Gtabedit"
"Gpedit"
"Gdrop"
"Gread"
"Gwrite"
"Gwq"
"Gdiffsplit"
"Gvdiffsplit"
"GMove"
"GRename"
"GDelete"
"GBrowse"
];
}
{
plugin = vim-tmux-navigator;
@ -240,26 +289,6 @@ with builtins;
plugin = markdown-preview-nvim;
ft = [ "md" ];
}
{
plugin = coq_nvim;
event = [ "BufReadPost" "BufNewFile" ];
init = builtins.readFile ./coq-nvim.lua;
dependencies = [
{
plugin = coq-thirdparty;
conf = builtins.readFile ./coq-thirdparty.lua;
dependencies = [
{
plugin = codeium-vim;
init = builtins.readFile ./codeium-vim.lua;
}
];
}
{
plugin = coq-artifacts;
}
];
}
{
plugin = nvim-surround;
event = [ "BufReadPost" "BufNewFile" ];

View file

@ -1,6 +1,5 @@
require("mini.align").setup()
require("mini.move").setup()
require("mini.pairs").setup()
require("mini.starter").setup()
require("mini.statusline").setup({

View file

@ -0,0 +1,114 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
formatting = {
format = require("lspkind").cmp_format({
mode = "symbol", -- show only symbol annotations
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
symbol_map = {
Codeium = "",
},
}),
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "async_path", priority = 1 },
{ name = "buffer", priority = 1 },
{ name = "luasnip", priority = 2 },
{ name = "codeium", priority = 3 },
{ name = "nvim_lsp", priority = 4 },
},
})
-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "buffer" },
}),
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "async_path" },
}, {
{ name = "cmdline" },
}),
enabled = function()
-- Set of commands where cmp will be disabled
local disabled = {
IncRename = true,
}
-- Get first word of cmdline
local cmd = vim.fn.getcmdline():match("%S+")
-- Return true if cmd isn't disabled
-- else call/return cmp.close(), which returns false
return not disabled[cmd] or cmp.close()
end,
})
-- If you want insert `(` after select function or method item
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local handlers = require("nvim-autopairs.completion.handlers")
cmp.event:on(
"confirm_done",
cmp_autopairs.on_confirm_done({
filetypes = {
-- "*" is a alias to all filetypes
["*"] = {
["("] = {
kind = {
cmp.lsp.CompletionItemKind.Function,
cmp.lsp.CompletionItemKind.Method,
},
handler = handlers["*"],
},
},
-- Disable for functional languages
haskell = false,
nix = false,
},
})
)

View file

@ -5,8 +5,9 @@ vim.diagnostic.config({
virtual_text = false,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
-- NOTE for nvim-ufo
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
capabilities.textDocument.foldingRange = {
@ -34,7 +35,7 @@ local on_attach_def = function(client, bufnr)
l = {
name = "lsp",
d = { vim.diagnostic.open_float, "Open diagnostic window" },
c = { vim.lsp.buf.code_action, "Code action" },
c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } },
r = {
function()
return ":IncRename " .. vim.fn.expand("<cword>")
@ -95,11 +96,21 @@ local on_attach_def = function(client, bufnr)
vim.lsp.inlay_hint(bufnr, true)
end, timeout)
end
require("lsp_signature").on_attach({
bind = true, -- This is mandatory, otherwise border config won't get registered.
handler_opts = {
border = "rounded",
},
}, bufnr)
end
local lspconfig_default_options = {
on_attach = on_attach_def,
capabilities = capabilities,
flags = {
debounce_text_changes = 100,
},
}
---function to add default options to lspconfig
@ -107,9 +118,8 @@ local lspconfig_default_options = {
---@param options table
---@return nil
local function lspconfig_setup(lsp, options)
local coq_options = require("coq").lsp_ensure_capabilities({})
local merged_options = vim.tbl_deep_extend("force", coq_options, lspconfig_default_options, options)
lspconfig[lsp].setup(merged_options)
local final_options = vim.tbl_deep_extend("force", lspconfig_default_options, options)
lspconfig[lsp].setup(final_options)
end
local servers = {

View file

@ -1,13 +1,8 @@
-- Load custom treesitter grammar for org filetype
require("orgmode").setup_ts_grammar()
require("nvim-treesitter.configs").setup({
sync_install = false,
auto_install = false,
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
context_commentstring = {
enable = true,

View file

@ -1,4 +0,0 @@
require("orgmode").setup({
org_agenda_files = { "~/Notes/org" },
org_default_notes_file = "~/Notes/org/refile.org",
})

View file

@ -34,11 +34,17 @@ require("which-key").register({
["<tab>"] = {
name = "tab",
["<tab>"] = { "<cmd>tabnew<cr>", "New tab" },
n = { "<cmd>tabnext<cr>", "Next tab" },
p = { "<cmd>tabprevious<cr>", "Previous tab" },
d = { "<cmd>tabclose<cr>", "Close tab" },
},
}, { prefix = "<leader>" })
require("which-key").register({
["["] = {
t = { "<cmd>tabprevious<cr>", "Previous tab" },
},
["]"] = {
t = { "<cmd>tabnext<cr>", "Next tab" },
},
})
-- file
require("which-key").register({