nixos-combined-flake/modules/nixvim/options.nix

166 lines
5.4 KiB
Nix

{ lib
, ...
}:
let
indentSize = 4;
in
{
options = {
programs.nixvim.ai = {
enable = lib.mkEnableOption "AI functions";
};
};
config = {
clipboard.register = "unnamedplus";
globals = {
mapleader = " ";
maplocalleader = ",";
inlay_hints_visible = true;
};
opts = {
termguicolors = true;
whichwrap = "b,s,<,>,[,],h,l";
backspace = "indent,eol,start";
autoindent = true;
expandtab = true;
smarttab = true;
smartindent = true;
shiftwidth = indentSize;
tabstop = indentSize;
softtabstop = indentSize;
hlsearch = true;
incsearch = true;
ignorecase = true;
smartcase = true;
scrolloff = 8;
splitbelow = true;
splitright = true;
startofline = false;
number = true;
relativenumber = true;
visualbell = true;
errorbells = false;
#textwidth = 80;
colorcolumn = [ 80 ];
cursorline = true;
undofile = true;
backup = true;
mouse = "a";
selectmode = "mouse";
mousemoveevent = true;
timeoutlen = 300;
list = true;
spelllang = [ "de" "en_us" ];
helplang = "de";
laststatus = 3;
conceallevel = 0;
concealcursor = "nc";
signcolumn = "yes";
foldlevel = 999;
};
extraConfigLua = ''
vim.opt.undodir = vim.fn.stdpath("state") .. "/undo"
vim.opt.backupdir = vim.fn.stdpath("state") .. "/backup"
vim.opt.listchars:append("eol:")
vim.opt.listchars:append("space:.")
vim.opt.listchars:append("tab:🡢 ")
vim.filetype.add({extension = { templ = "templ" }})
vim.diagnostic.config({
virtual_text = true,
severity_sort = true,
})
vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "󰌵", texthl = "DiagnosticSignHint" })
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "DapBreakpoint" })
vim.fn.sign_define(
"DapBreakpointCondition",
{ text = "", texthl = "DapBreakpoint", linehl = "", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = "", texthl = "DapBreakpoint", linehl = "", numhl = "DapBreakpoint" }
)
vim.fn.sign_define("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = "DapLogPoint" })
vim.fn.sign_define("DapStopped", { text = "", texthl = "DapStopped", linehl = "", numhl = "DapStopped" })
'';
extraConfigLuaPre = ''
vim.opt.runtimepath:prepend(',~/.config/nvim')
vim.opt.runtimepath:append(',~/.config/nvim/after')
local colors = require("catppuccin.palettes").get_palette("mocha")
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
function get_program()
return coroutine.create(function(coro)
local opts = {}
pickers
.new(opts, {
prompt_title = "Path to executable",
finder = finders.new_oneshot_job({ "fd", "--exclude", ".git", "--no-ignore", "--type", "x"}, {}),
sorter = conf.generic_sorter(opts),
attach_mappings = function(buffer_number)
actions.select_default:replace(function()
actions.close(buffer_number)
coroutine.resume(coro, action_state.get_selected_entry()[1])
end)
return true
end,
})
:find()
end)
end
'';
extraConfigLuaPost = ''
local hooks = require("ibl.hooks")
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = colors.red })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = colors.yellow })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = colors.blue })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = colors.peach })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = colors.green })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = colors.mauve })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = colors.teal })
end)
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
local dap = require("dap")
local dapui = require("dapui")
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.after.event_initialized.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
require('lspconfig').asm_lsp.setup({})
'';
};
}