Files
Moirai/config/default.nix
2025-03-17 22:54:09 -05:00

331 lines
8.4 KiB
Nix

{ pkgs, opts, ... }: {
# Import all your configuration modules here
imports = [ ./bufferline.nix ];
plugins = {
lualine.enable = true;
luasnip.enable = true;
barbar.enable = true;
nvim-tree.enable = true;
noice.enable = true;
mini.enable = true;
notify.enable = true;
telescope.enable = true;
treesitter = {
enable = true;
settings = {
highlight.enable = true;
grammarPackages = pkgs.vimPlugins.nvim-treesitter.passthru.allGrammars ++ [
pkgs.vimPlugins.nvim-treesitter-parsers.glsl
];
};
};
render-markdown.enable = true;
web-devicons.enable = true;
cmp-nvim-lsp.enable = true;
lsp = {
enable = true;
servers = {
#js/typescript
ts_ls.enable = true;
#c/c++
ccls.enable = true;
#nix
nil_ls.enable = true;
#python
pyright.enable = true;
#bash
bashls.enable = true;
#css
cssls.enable = true;
#glsl
glsl_analyzer.enable = true;
};
keymaps = {
# Diagnostic keymaps
diagnostic = {
"<leader>q" = {
#mode = "n";
action = "setloclist";
desc = "Open diagnostic [Q]uickfix list";
};
};
extra = [
# Jump to the definition of the word under your cusor.
# This is where a variable was first declared, or where a function is defined, etc.
# To jump back, press <C-t>.
{
mode = "n";
key = "gd";
action.__raw = "require('telescope.builtin').lsp_definitions";
options = {
desc = "LSP: [G]oto [D]efinition";
};
}
# Find references for the word under your cursor.
{
mode = "n";
key = "gr";
action.__raw = "require('telescope.builtin').lsp_references";
options = {
desc = "LSP: [G]oto [R]eferences";
};
}
# Jump to the implementation of the word under your cursor.
# Useful when your language has ways of declaring types without an actual implementation.
{
mode = "n";
key = "gI";
action.__raw = "require('telescope.builtin').lsp_implementations";
options = {
desc = "LSP: [G]oto [I]mplementation";
};
}
# Jump to the type of the word under your cursor.
# Useful when you're not sure what type a variable is and you want to see
# the definition of its *type*, not where it was *defined*.
{
mode = "n";
key = "<leader>D";
action.__raw = "require('telescope.builtin').lsp_type_definitions";
options = {
desc = "LSP: Type [D]efinition";
};
}
# Fuzzy find all the symbols in your current document.
# Symbols are things like variables, functions, types, etc.
{
mode = "n";
key = "<leader>ds";
action.__raw = "require('telescope.builtin').lsp_document_symbols";
options = {
desc = "LSP: [D]ocument [S]ymbols";
};
}
# Fuzzy find all the symbols in your current workspace.
# Similar to document symbols, except searches over your entire project.
{
mode = "n";
key = "<leader>ws";
action.__raw = "require('telescope.builtin').lsp_dynamic_workspace_symbols";
options = {
desc = "LSP: [W]orkspace [S]ymbols";
};
}
];
lspBuf = {
# Rename the variable under your cursor.
# Most Language Servers support renaming across files, etc.
"<leader>rn" = {
action = "rename";
desc = "LSP: [R]e[n]ame";
};
# Execute a code action, usually your cursor needs to be on top of an error
# or a suggestion from your LSP for this to activate.
"<leader>ca" = {
#mode = "n";
action = "code_action";
desc = "LSP: [C]ode [A]ction";
};
# WARN: This is not Goto Definition, this is Goto Declaration.
# For example, in C this would take you to the header.
"gD" = {
action = "declaration";
desc = "LSP: [G]oto [D]eclaration";
};
};
};
};
/*
dap = {
};
*/
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
{ name = "luasnip"; }
# { name = "cmdline"; }
];
completion = {
completeopt = "menu,menuone,noinsert";
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
};
snippet.expand = ''
function(args)
require("luasnip").lsp_expand(args.body)
end
'';
};
};
};
globals = {
mapleader = " ";
maplocalleader = " ";
};
opts = {
nu = true;
rnu = true;
scrolloff = 12;
tabstop = 4;
softtabstop = 4;
shiftwidth = 4;
expandtab = true;
smartindent = true;
wrap = false;
hlsearch = false;
incsearch = true;
};
keymaps = [
{
mode = "n";
key = "<leader>ff";
action = "<cmd>Telescope find_files hidden=true<CR>";
}
{
mode = "n";
key = "<leader>fc";
action = "<cmd>Telescope treesitter<CR>";
}
{
mode = "n";
key = "<leader>t";
action = "<cmd>NvimTreeToggle<CR>";
}
{
mode = "n";
key = "<C-.>";
action = "<cmd>BufferNext<CR>";
}
{
mode = "n";
key = "<C-,>";
action = "<cmd>BufferPrevious<CR>";
}
{
mode = "n";
key = "<C-h>";
action = "<cmd>wincmd h<CR>";
}
{
mode = "n";
key = "<C-j>";
action = "<cmd>wincmd j<CR>";
}
{
mode = "n";
key = "<C-k>";
action = "<cmd>wincmd k<CR>";
}
{
mode = "n";
key = "<C-l>";
action = "<cmd>wincmd l<CR>";
}
{
mode = "n";
key = "Q";
action = "<nop>";
}
{
mode = "v";
key = "J";
action = ":m '>+1<CR>gv=gv";
}
{
mode = "v";
key = "K";
action = ":m '<-2<CR>gv=gv";
}
{
mode = "n";
key = "<leader>y";
action = "\"+y";
}
{
mode = "v";
key = "<leader>y";
action = "\"+y";
}
{
mode = "n";
key = "<leader>s";
action = ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>";
}
];
extraConfigLua = ''
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})
'';
extraPlugins = with pkgs.vimPlugins; [
pywal-nvim
tokyonight-nvim
llm-nvim
nvim-lspconfig
nvim-treesitter-parsers.glsl
];
colorscheme = if opts.pywal then "pywal" else "tokyonight-storm";
}