add config

This commit is contained in:
Patrick Michl
2024-11-05 13:01:15 +01:00
parent e0cbe28786
commit 28d8213ebc
23 changed files with 1240 additions and 0 deletions

116
config/plugins/cmp/cmp.nix Normal file
View File

@ -0,0 +1,116 @@
{
plugins = {
cmp-emoji.enable = true;
cmp-nvim-lsp.enable = true;
cmp-buffer.enable = true;
cmp-path.enable = true;
cmp_luasnip.enable = true;
cmp-cmdline.enable = false;
cmp = {
enable = true;
settings = {
autoEnableSources = true;
experimental = {ghost_text = false;};
performance = {
debounce = 60;
fetchingTimeout = 200;
maxViewEntries = 30;
};
snippet = {expand = "luasnip";};
formatting = {fields = ["kind" "abbr" "menu"];};
sources = [
{name = "git";}
{name = "nvim_lsp";}
{name = "emoji";}
{
name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "luasnip"; # snippets
keywordLength = 3;
}
];
window = {
completion = {border = "solid";};
documentation = {border = "solid";};
};
mapping = {
"<C-Tab>" =
/*
lua
*/
"cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<Down>" =
/*
lua
*/
"cmp.mapping.select_next_item()";
"<Up>" =
/*
lua
*/
"cmp.mapping.select_prev_item()";
"<C-e>" =
/*
lua
*/
"cmp.mapping.abort()";
"<C-b>" =
/*
lua
*/
"cmp.mapping.scroll_docs(-4)";
"<C-f>" =
/*
lua
*/
"cmp.mapping.scroll_docs(4)";
"<C-Space>" =
/*
lua
*/
"cmp.mapping.complete()";
"<CR>" =
/*
lua
*/
"cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
"<TAB>" =
/*
lua
*/
''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end
'';
"<S-TAB>" =
/*
lua
*/
''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end
'';
};
};
};
};
}

View File

@ -0,0 +1,9 @@
{
plugins.lspkind = {
enable = true;
extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};
};
}

View File

@ -0,0 +1,13 @@
{
plugins.schemastore = {
enable = true;
json = {
enable = true;
};
yaml = {
enable = true;
};
};
}

View File

@ -0,0 +1,13 @@
{
plugins.illuminate = {
enable = true;
underCursor = false;
filetypesDenylist = [
"Outline"
"TelescopePrompt"
"alpha"
"harpoon"
"reason"
];
};
}

View File

@ -0,0 +1,40 @@
_: {
plugins.navic = {
enable = true;
settings = {
separator = " ";
highlight = true;
depthLimit = 5;
lsp = {
autoAttach = true;
};
icons = {
Array = "󱃵 ";
Boolean = " ";
Class = " ";
Constant = " ";
Constructor = " ";
Enum = " ";
EnumMember = " ";
Event = " ";
Field = "󰽏 ";
File = " ";
Function = "󰡱 ";
Interface = " ";
Key = " ";
Method = " ";
Module = "󰕳 ";
Namespace = " ";
Null = "󰟢 ";
Number = " ";
Object = " ";
Operator = " ";
Package = "󰏖 ";
String = " ";
Struct = " ";
TypeParameter = " ";
Variable = " ";
};
};
};
}

View File

@ -0,0 +1,43 @@
{
plugins.neo-tree = {
enable = true;
sources = ["filesystem" "buffers" "git_status" "document_symbols"];
addBlankLineAtTop = false;
filesystem = {
bindToCwd = true;
};
defaultComponentConfigs = {
indent = {
withExpanders = true;
expanderCollapsed = "󰅂";
expanderExpanded = "󰅀";
expanderHighlight = "NeoTreeExpander";
};
gitStatus = {
symbols = {
added = " ";
conflict = "󰩌 ";
deleted = "󱂥";
ignored = " ";
modified = " ";
renamed = "󰑕";
staged = "󰩍";
unstaged = "";
untracked = " ";
};
};
};
};
keymaps = [
{
mode = ["n"];
key = "<C-n>";
action = "<cmd>Neotree toggle<cr>";
options = {desc = "Open/Close Neotree";};
}
];
}

View File

@ -0,0 +1,14 @@
{
plugins.todo-comments = {
enable = true;
settings = {
colors = {
error = ["DiagnosticError" "ErrorMsg" "#ED8796"];
warning = ["DiagnosticWarn" "WarningMsg" "#EED49F"];
info = ["DiagnosticInfo" "#EED49F"];
default = ["Identifier" "#F5A97F"];
test = ["Identifier" "#8AADF4"];
};
};
};
}

View File

@ -0,0 +1,61 @@
{pkgs, ...}: {
plugins.treesitter = {
enable = true;
settings = {
indent.enable = true;
highlight.enable = true;
};
folding = false;
nixvimInjections = true;
grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars;
};
plugins.treesitter-textobjects = {
enable = false;
select = {
enable = true;
lookahead = true;
keymaps = {
"aa" = "@parameter.outer";
"ia" = "@parameter.inner";
"af" = "@function.outer";
"if" = "@function.inner";
"ac" = "@class.outer";
"ic" = "@class.inner";
"ii" = "@conditional.inner";
"ai" = "@conditional.outer";
"il" = "@loop.inner";
"al" = "@loop.outer";
"at" = "@comment.outer";
};
};
move = {
enable = true;
gotoNextStart = {
"]m" = "@function.outer";
"]]" = "@class.outer";
};
gotoNextEnd = {
"]M" = "@function.outer";
"][" = "@class.outer";
};
gotoPreviousStart = {
"[m" = "@function.outer";
"[[" = "@class.outer";
};
gotoPreviousEnd = {
"[M" = "@function.outer";
"[]" = "@class.outer";
};
};
swap = {
enable = true;
swapNext = {
"<leader>a" = "@parameters.inner";
};
swapPrevious = {
"<leader>A" = "@parameter.outer";
};
};
};
}

View File

@ -0,0 +1,27 @@
_: {
plugins.gitsigns = {
enable = true;
settings = {
signs = {
add = {
text = " ";
};
change = {
text = " ";
};
delete = {
text = " ";
};
untracked = {
text = "";
};
topdelete = {
text = "󱂥 ";
};
changedelete = {
text = "󱂧 ";
};
};
};
};
}

View File

@ -0,0 +1,24 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
lazygit-nvim
];
extraConfigLua =
/*
lua
*/
''
require("telescope").load_extension("lazygit")
'';
keymaps = [
{
mode = "n";
key = "<leader>gg";
action = "<cmd>LazyGit<CR>";
options = {
desc = "LazyGit (root dir)";
};
}
];
}

133
config/plugins/lsp/lsp.nix Normal file
View File

@ -0,0 +1,133 @@
{pkgs, ...}: {
plugins = {
lsp-lines.enable = true;
lsp-format.enable = true;
lsp = {
enable = true;
inlayHints = true;
servers = {
html.enable = true;
lua_ls.enable = true;
nil_ls.enable = true;
marksman.enable = true;
ansiblels.enable = true;
jsonls.enable = true;
solargraph.enable = true;
bashls.enable = true;
yamlls = {
enable = true;
extraOptions = {
settings = {
yaml = {
schemas = {
kubernetes = ".h8s/*.{yml,yaml}";
"http://json.schemastore.org/github-workflow" = ".github/workflows/*";
"http://json.schemastore.org/github-action" = ".github/action.{yml,yaml}";
"http://json.schemastore.org/ansible-stable-2.9" = "roles/tasks/*.{yml,yaml}";
"http://json.schemastore.org/kustomization" = "kustomization.{yml,yaml}";
"http://json.schemastore.org/ansible-playbook" = "*play*.{yml,yaml}";
"http://json.schemastore.org/chart" = "Chart.{yml,yaml}";
"https://json.schemastore.org/dependabot-v2" = ".github/dependabot.{yml,yaml}";
"https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json" = "*docker-compose*.{yml,yaml}";
"https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json" = "*flow*.{yml,yaml}";
"https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json" = ".gitlab-ci.yml";
};
};
};
};
};
};
keymaps = {
silent = true;
lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
ga = {
action = "code_action";
desc = "Code Action";
};
ff = {
action = "format";
desc = "Format Code";
};
K = {
action = "hover";
desc = "Hover";
};
"<leader>cw" = {
action = "workspace_symbol";
desc = "Workspace Symbol";
};
"<leader>cr" = {
action = "rename";
desc = "Rename";
};
};
diagnostic = {
"<leader>cd" = {
action = "open_float";
desc = "Line Diagnostics";
};
"[d" = {
action = "goto_next";
desc = "Next Diagnostic";
};
"]d" = {
action = "goto_prev";
desc = "Previous Diagnostic";
};
};
};
};
};
extraPlugins = with pkgs.vimPlugins; [
ansible-vim
];
extraConfigLua =
/*
lua
*/
''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.diagnostic.config{
float={border=_border}
};
require('lspconfig.ui.windows').default_options = {
border = _border
}
'';
}

View File

@ -0,0 +1,9 @@
{
plugins.luasnip = {
enable = true;
settings = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
};
}

View File

@ -0,0 +1,67 @@
{
colorschemes = {
catppuccin = {
enable = true;
settings = {
background = {
light = "macchiato";
dark = "mocha";
};
custom_highlights = ''
function(highlights)
return {
CursorLineNr = { fg = highlights.peach, style = {} },
NavicText = { fg = highlights.text },
}
end
'';
flavour = "macchiato";
no_bold = false;
no_italic = false;
no_underline = false;
transparent_background = false;
integrations = {
cmp = true;
notify = true;
gitsigns = true;
neotree = true;
which_key = true;
illuminate = {
enabled = true;
lsp = true;
};
navic = {
enabled = true;
custom_bg = "NONE";
};
treesitter = true;
telescope.enabled = true;
indent_blankline.enabled = true;
mini = {
enabled = true;
indentscope_color = "rosewater";
};
native_lsp = {
enabled = true;
inlay_hints = {
background = true;
};
virtual_text = {
errors = ["italic"];
hints = ["italic"];
information = ["italic"];
warnings = ["italic"];
ok = ["italic"];
};
underlines = {
errors = ["underline"];
hints = ["underline"];
information = ["underline"];
warnings = ["underline"];
};
};
};
};
};
};
}

View File

@ -0,0 +1,26 @@
{
plugins = {
bufferline = {
enable = true;
settings = {
options = {
diagnostics = "nvim_lsp";
mode = "buffers";
close_icon = " ";
buffer_close_icon = "󰱝 ";
modified_icon = "󰔯 ";
offsets = [
{
filetype = "neo-tree";
text = "Neo-tree";
highlight = "Directory";
text_align = "left";
}
];
};
};
};
};
}

View File

@ -0,0 +1,94 @@
{
plugins.lualine = {
enable = true;
settings = {
options = {
globalstatus = true;
extensions = [
"fzf"
"neo-tree"
];
disabledFiletypes = {
statusline = ["startup" "alpha"];
};
theme = "catppuccin";
};
sections = {
lualine_a = [
{
__unkeyed-1 = "mode";
icon = "";
}
];
lualine_b = [
{
__unkeyed-1 = "branch";
icon = "";
}
{
__unkeyed-1 = "diff";
symbols = {
added = " ";
modified = " ";
removed = " ";
};
}
];
lualine_c = [
{
__unkeyed-1 = "diagnostics";
sources = ["nvim_lsp"];
symbols = {
error = " ";
warn = " ";
info = " ";
hint = "󰝶 ";
};
}
{
__unkeyed-1 = "navic";
}
];
lualine_x = [
{
__unkeyed-1 = "filetype";
icon_only = true;
separator = "";
padding = {
left = 1;
right = 0;
};
}
{
__unkeyed-1 = "filename";
path = 1;
}
{
__unkeyed-1.__raw = ''
function()
local icon = " "
local status = require("copilot.api").status.data
return icon .. (status.message or " ")
end,
cond = function()
local ok, clients = pcall(vim.lsp.get_clients, { name = "copilot", bufnr = 0 })
return ok and #clients > 0
end,
'';
}
];
lualine_y = [
{
__unkeyed-1 = "progress";
}
];
lualine_z = [
{
__unkeyed-1 = "location";
}
];
};
};
};
}

View File

@ -0,0 +1,7 @@
{
plugins = {
web-devicons.enable = true;
which-key.enable = true;
fidget.enable = true;
};
}

View File

@ -0,0 +1,36 @@
{
plugins.telescope = {
enable = true;
extensions = {
file-browser.enable = true;
fzf-native.enable = true;
};
keymaps = {
";" = {
action = "find_files";
options.desc = "Find project files";
};
"<leader>g" = {
action = "live_grep";
options.desc = "Grep from root dir";
};
};
};
extraConfigLua =
/*
lua
*/
''
require("telescope").setup{
pickers = {
colorscheme = {
enable_preview = true
}
}
}
'';
}

View File

@ -0,0 +1,23 @@
{
plugins.toggleterm = {
enable = true;
settings = {
size = 20;
close_on_exit = false;
hide_numbers = true;
shade_terminals = true;
shading_factor = 1;
start_in_insert = true;
persist_size = true;
};
};
keymaps = [
{
mode = ["n" "i"];
key = "<c-\>";
action = "<cmd>ToggleTerm direction=horizontal<cr>";
options.desc = "Toggle Horizontal Terminal Window";
}
];
}