Initial commit

This commit is contained in:
Fred Drake
2024-09-30 11:57:07 -04:00
commit 94be99323c
14 changed files with 1367 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
{
plugins = {
cmp-dap.enable = true;
dap = {
enable = true;
extensions = {
dap-go.enable = true;
dap-python.enable = true;
dap-ui.enable = true;
};
};
};
}
+157
View File
@@ -0,0 +1,157 @@
{
plugins = {
alpha = {
enable = true;
layout = [
{
type = "padding";
val = 2;
}
{
type = "text";
val = [
" _ _______ _______ _________ _______ "
"( ( /|( ____ \\( ___ )|\\ /|\\__ __/( )"
"| \\ ( || ( \\/| ( ) || ) ( | ) ( | () () |"
"| \\ | || (__ | | | || | | | | | | || || |"
"| (\\ \\) || __) | | | |( ( ) ) | | | |(_)| |"
"| | \\ || ( | | | | \\ \\_/ / | | | | | |"
"| ) \\ || (____/\\| (___) | \\ / ___) (___| ) ( |"
"|/ )_)(_______/(_______) \\_/ \\_______/|/ \\|"
" "
];
opts = {
position = "center";
hl = "Type";
};
}
{
type = "padding";
val = 2;
}
{
type = "group";
val = [
{
type = "button";
val = " New File ";
on_press.__raw = "function() vim.cmd[[ene]] end";
opts = {
shortcut = "n";
keymap = [
"n"
"n"
"<cmd>ene<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
position = "center";
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = " Find File ";
on_press.__raw =
"function() require('telescope.builtin').find_files() end";
opts = {
shortcut = "f";
keymap = [
"n"
"f"
"<cmd>lua require('telescope.builtin').find_files()<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
position = "center";
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = " Recent Files ";
on_press.__raw =
"function() require('telescope.builtin').oldfiles() end";
opts = {
shortcut = "r";
keymap = [
"n"
"r"
"<cmd>lua require('telescope.builtin').oldfiles()<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
position = "center";
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = " Find Text ";
on_press.__raw =
"function() require('telescope.builtin').live_grep() end";
opts = {
shortcut = "g";
keymap = [
"n"
"g"
"<cmd>lua require('telescope.builtin').live_grep()<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
position = "center";
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = " Quit Neovim ";
on_press.__raw = "function() vim.cmd[[qa]] end";
opts = {
shortcut = "q";
keymap = [
"n"
"q"
"<cmd>qa<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
position = "center";
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
];
}
{
type = "padding";
val = 2;
}
];
};
};
}
+14
View File
@@ -0,0 +1,14 @@
let
# Read all files in the current directory
files = builtins.readDir ./.;
# Filter out default.nix and non-.nix files
nixFiles = builtins.filter (name: name != "default.nix" && builtins.match ".*\\.nix" name != null) (builtins.attrNames files);
# Create a list of import statements
imports = map (name: ./. + "/${name}") nixFiles;
in
{
# Import all configuration modules automatically
imports = imports;
}
+69
View File
@@ -0,0 +1,69 @@
{
plugins = {
fzf-lua = {
enable = true;
keymaps = {
"<leader>/" = {
action = "live_grep";
options = { desc = "Live Grep"; };
};
"<leader>," = {
action = "buffers";
options = { desc = "Switch Buffer"; };
settings = {
sort_mru = true;
sort_lastused = true;
};
};
"<leader>ff" = {
action = "files";
options = { desc = "Find Files"; };
};
"<leader>fr" = {
action = "oldfiles";
options = { desc = "Recent Files"; };
};
"<leader>gc" = {
action = "git_commits";
options = { desc = "Git Commits"; };
};
"<leader>gs" = {
action = "git_status";
options = { desc = "Git Status"; };
};
"<leader>s\"" = {
action = "registers";
options = { desc = "Registers"; };
};
"<leader>sd" = {
action = "diagnostics_document";
options = { desc = "Document Diagnostics"; };
};
"<leader>sD" = {
action = "diagnostics_workspace";
options = { desc = "Workspace Diagnostics"; };
};
"<leader>sh" = {
action = "help_tags";
options = { desc = "Help Pages"; };
};
"<leader>sk" = {
action = "keymaps";
options = { desc = "Key Maps"; };
};
};
};
telescope.enable = true;
todo-comments = {
enable = true;
keymaps = {
todoTelescope = {
key = "<leader>st";
keywords = [ "TODO" ];
};
};
};
};
}
+287
View File
@@ -0,0 +1,287 @@
{
globals.mapleader = " ";
plugins.which-key = {
enable = true;
settings = {
spec = [
{
__unkeyed-1 = "<leader>g";
group = "Git";
}
{
__unkeyed-1 = "<leader><tab>";
group = "Tabs";
}
{
__unkeyed-1 = "<leader>f";
group = "File / Find";
}
{
__unkeyed-1 = "<leader>q";
group = "Quit / Session";
}
{
__unkeyed-1 = "<leader>s";
group = "Search";
}
{
__unkeyed-1 = "<leader>b";
group = "Buffer";
}
{
__unkeyed-1 = "<leader>o";
group = "SOPS";
icon = "";
}
];
};
};
keymaps = [
# Normal mode
{
mode = "i";
key = "jk";
action = "<CMD>noh<CR><ESC>";
options = { desc = "Normal mode and clear highlight"; };
}
{
mode = "i";
key = "<ESC>";
action = "<CMD>noh<CR><ESC>";
options = { desc = "Normal mode and clear highlight"; };
}
{
mode = "n";
key = "<ESC>";
action = "<CMD>noh<CR><ESC>";
options = { desc = "Normal mode and clear highlight"; };
}
# Add undo breakpoints
{
mode = "i";
key = ",";
action = ",<C-g>u";
options = { desc = "Undo breakpoint"; };
}
{
mode = "i";
key = ".";
action = ".<C-g>u";
options = { desc = "Undo breakpoint"; };
}
{
mode = "i";
key = ";";
action = ";<C-g>u";
options = { desc = "Undo breakpoint"; };
}
{
mode = "n";
key = "<leader>e";
action = "<CMD>Neotree toggle<CR>";
options = { desc = "Toggle tree view"; };
}
# LSP Actions
{
mode = "n";
key = "gd";
action =
"<CMD>FzfLua lsp_definitions jump_to_single_result=true ignore_current_line=true<CR>";
options = { desc = "Goto Definition"; };
}
{
mode = "n";
key = "gr";
action =
"<CMD>FzfLua lsp_references jump_to_single_result=true ignore_current_line=true<CR>";
options = { desc = "References"; };
}
{
mode = "n";
key = "gI";
action =
"<CMD>FzfLua lsp_implementations jump_to_single_result=true ignore_current_line=true<CR>";
options = { desc = "Goto Implementation"; };
}
{
mode = "n";
key = "gy";
action =
"<CMD>FzfLua lsp_typedefs jump_to_single_result=true ignore_current_line=true<CR>";
options = { desc = "Goto T[y]pe Definition"; };
}
# SOPS
{
mode = "n";
key = "<leader>od";
action = "<CMD>!sops -d -i %<CR><CR>";
options = { desc = "Decrypt SOPS File"; };
}
{
mode = "n";
key = "<leader>oe";
action = "<CMD>!sops -e -i %<CR><CR>";
options = { desc = "Encrypt SOPS File"; };
}
# Git
{
mode = "n";
key = "<leader>gg";
action = "<CMD>LazyGit<CR>";
options = { desc = "LazyGit"; };
}
# Windows
{
key = "<C-h>";
action = "<CMD>wincmd h<CR>";
options = { desc = "Navigate Window Left"; };
}
{
key = "<C-j>";
action = "<CMD>wincmd j<CR>";
options = { desc = "Navigate Window Down"; };
}
{
key = "<C-k>";
action = "<CMD>wincmd k<CR>";
options = { desc = "Navigate Window Up"; };
}
{
key = "<C-l>";
action = "<CMD>wincmd l<CR>";
options = { desc = "Navigate Window Right"; };
}
{
mode = "n";
key = "<leader>w";
action = "<c-w>";
options = { desc = "Windows"; };
}
{
mode = "n";
key = "<leader>-";
action = "<C-W>s";
options = { desc = "Split Window Below"; };
}
{
mode = "n";
key = "<leader>|";
action = "<C-W>v";
options = { desc = "Split Window Right"; };
}
{
mode = "n";
key = "<leader>wd";
action = "<C-W>c";
options = { desc = "Delete Window"; };
}
# Tabs
{
mode = "n";
key = "<leader><tab>l";
action = "<CMD>tablast<CR>";
options = { desc = "Last Tab"; };
}
{
mode = "n";
key = "<leader><tab>o";
action = "<CMD>tabonly<CR>";
options = { desc = "Close Other Tabs"; };
}
{
mode = "n";
key = "<leader><tab>f";
action = "<CMD>tabfirst<CR>";
options = { desc = "First Tab"; };
}
{
mode = "n";
key = "<leader><tab><tab>";
action = "<CMD>tabnew<CR>";
options = { desc = "New Tab"; };
}
{
mode = "n";
key = "<leader><tab>]";
action = "<CMD>tabnext<CR>";
options = { desc = "Next Tab"; };
}
{
mode = "n";
key = "<leader><tab>d";
action = "<CMD>tabclose<CR>";
options = { desc = "Close Tab"; };
}
{
mode = "n";
key = "<leader><tab>[";
action = "<CMD>tabprevious<CR>";
options = { desc = "Previous Tab"; };
}
# Buffer
{
mode = "n";
key = "<S-h>";
action = "<CMD>bprevious<CR>";
options = { desc = "Previous Buffer"; };
}
{
mode = "n";
key = "<S-l>";
action = "<CMD>bnext<CR>";
options = { desc = "Next Buffer"; };
}
{
mode = "n";
key = "<leader>bb";
action = "<CMD>e #<CR>";
options = { desc = "Switch To Other Buffer"; };
}
{
mode = "n";
key = "<leader>bd";
action = "<CMD>bd<CR>";
options = { desc = "Delete Buffer and Window"; };
}
{
mode = "n";
key = "<leader>bp";
action = "<CMD>BufferLineTogglePin<CR>";
options = { desc = "Toggle Pin"; };
}
{
mode = "n";
key = "<leader>bP";
action = "<CMD>BufferLineGroupClose ungrouped<CR>";
options = { desc = "Delete Non-Pinned Buffers"; };
}
{
mode = "n";
key = "<leader>bo";
action = "<CMD>BufferLineCloseOthers<CR>";
options = { desc = "Delete Other Buffers"; };
}
{
mode = "n";
key = "<leader>br";
action = "<CMD>BufferLineCloseRight<CR>";
options = { desc = "Delete Buffers to the Right"; };
}
{
mode = "n";
key = "<leader>bl";
action = "<CMD>BufferLineCloseLeft<CR>";
options = { desc = "Delete Buffers to the Left"; };
}
];
}
+252
View File
@@ -0,0 +1,252 @@
let selectOpts = "{behavior = cmp.SelectBehavior.Select}";
in { pkgs, ... }: {
plugins = {
cmp = {
enable = true;
settings = {
autoEnableSources = true;
performance = { debounce = 150; };
sources = [
{ name = "path"; }
{
name = "nvim_lsp";
keywordLength = 1;
}
{
name = "buffer";
keywordLength = 3;
}
];
snippet.expand =
"function(args) require('luasnip').lsp_expand(args.body) end";
formatting = {
fields = [ "menu" "abbr" "kind" ];
format = ''
function(entry, item)
local menu_icon = {
nvim_lsp = '[LSP]',
luasnip = '[SNIP]',
buffer = '[BUF]',
path = '[PATH]',
}
item.menu = menu_icon[entry.source.name]
return item
end
'';
};
mapping = {
"<Up>" = "cmp.mapping.select_prev_item(${selectOpts})";
"<Down>" = "cmp.mapping.select_next_item(${selectOpts})";
"<C-p>" = "cmp.mapping.select_prev_item(${selectOpts})";
"<C-n>" = "cmp.mapping.select_next_item(${selectOpts})";
"<C-u>" = "cmp.mapping.scroll_docs(-4)";
"<C-d>" = "cmp.mapping.scroll_docs(4)";
"<C-e>" = "cmp.mapping.abort()";
"<C-y>" = "cmp.mapping.confirm({select = true})";
"<CR>" = "cmp.mapping.confirm({select = false})";
"<C-f>" = ''
cmp.mapping(
function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end,
{ "i", "s" }
)
'';
"<C-b>" = ''
cmp.mapping(
function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
{ "i", "s" }
)
'';
"<Tab>" = ''
cmp.mapping(
function(fallback)
local col = vim.fn.col('.') - 1
if cmp.visible() then
cmp.select_next_item(select_opts)
elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
fallback()
else
cmp.complete()
end
end,
{ "i", "s" }
)
'';
"<S-Tab>" = ''
cmp.mapping(
function(fallback)
if cmp.visible() then
cmp.select_prev_item(select_opts)
else
fallback()
end
end,
{ "i", "s" }
)
'';
};
window = {
completion = {
border = "rounded";
winhighlight =
"Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None";
zindex = 1001;
scrolloff = 0;
colOffset = 0;
sidePadding = 1;
scrollbar = true;
};
documentation = {
border = "rounded";
winhighlight =
"Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None";
zindex = 1001;
maxHeight = 20;
};
};
};
};
cmp-nvim-lsp.enable = true;
cmp-buffer.enable = true;
cmp-path.enable = true;
cmp-treesitter.enable = true;
dap.enable = true;
none-ls = {
enable = true;
sources.formatting = {
black.enable = true;
csharpier.enable = true;
hclfmt.enable = true;
just.enable = true;
nixfmt.enable = true;
opentofu_fmt.enable = true;
prettier.enable = true;
# rubyfmt is broken on darwin-based systems
rubyfmt.enable = (pkgs.stdenv.hostPlatform.system != "x86_64-darwin"
&& pkgs.stdenv.hostPlatform.system != "aarch64-darwin");
sqlformat.enable = true;
stylua.enable = true;
yamlfmt.enable = true;
};
sources.diagnostics = {
trivy.enable = true;
yamllint.enable = true;
};
};
conform-nvim = {
enable = true;
settings = {
format_on_save = {
lsp_fallback = "fallback";
timeout_ms = 500;
};
notify_on_error = true;
formatters_by_ft = {
css = [ "prettier" ];
html = [ "prettier" ];
javascript = [ "prettier" ];
javascriptreact = [ "prettier" ];
lua = [ "stylua" ];
markdown = [ "prettier" ];
nix = [ "nixfmt" ];
python = [ "black" ];
ruby = [ "rubyfmt" ];
rust = [ "rustfmt" ];
terraform = [ "tofu_fmt" ];
tf = [ "tofu_fmt" ];
typescript = [ "prettier" ];
typescriptreact = [ "prettier" ];
yaml = [ "yamlfmt" ];
};
};
};
lsp = {
enable = true;
inlayHints = true;
keymaps = {
diagnostic = {
"<leader>E" = "open_float";
"[" = "goto_prev";
"]" = "goto_next";
"<leader>do" = "setloclist";
};
lspBuf = {
"K" = "hover";
"gD" = "declaration";
"gd" = "definition";
"gr" = "references";
"gI" = "implementation";
"gy" = "type_definition";
"<leader>rn" = "rename";
"<leader>ca" = "code_action";
"<leader>wl" = "list_workspace_folders";
"<leader>wr" = "remove_workspace_folder";
"<leader>wa" = "add_workspace_folder";
};
};
preConfig = ''
vim.diagnostic.config({
virtual_text = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
},
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{border = 'rounded'}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{border = 'rounded'}
)
'';
postConfig = ''
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
'';
servers = {
nil-ls.enable = true;
nixd.enable = true;
omnisharp.enable = true;
};
};
rustaceanvim = {
enable = true;
settings = { tools.enable_clippy = true; };
};
# rust-tools.enable = true;
};
}
+33
View File
@@ -0,0 +1,33 @@
{
config = {
opts = {
updatetime = 100; # faster completion
number = true;
relativenumber = true;
autoindent = true;
autowrite = true;
confirm = true;
clipboard = "unnamedplus";
cursorline = true;
list = true;
expandtab = true;
shiftround = true;
shiftwidth = 2;
# showmode = false;
signcolumn = "yes";
smartcase = true;
smartindent = true;
tabstop = 2;
ignorecase = true;
incsearch = true;
completeopt = "menu,menuone,noselect";
wildmode = "longest:full,full";
swapfile = false;
undofile = true; # Build-in persistent undo
undolevels = 10000;
};
};
}
+92
View File
@@ -0,0 +1,92 @@
{
plugins = {
bufferline = {
enable = true;
settings = {
options = {
always_show_bufferline = false;
buffer_close_icon = "";
offsets = [{
filetype = "neo-tree";
text = "Neo-tree";
highlight = "Directory";
text_align = "left";
}];
diagnostics = "nvim_lsp";
};
};
};
gitsigns = {
enable = true;
settings = {
current_line_blame = true;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
signcolumn = true;
signs = {
add = { text = ""; };
change = { text = ""; };
changedelete = { text = "~"; };
delete = { text = "_"; };
topdelete = { text = ""; };
untracked = { text = ""; };
};
watch_gitdir = { follow_files = true; };
};
};
illuminate.enable = true;
lazygit.enable = true;
nvim-lightbulb.enable = true;
lualine = {
enable = true;
settings.options.globalstatus = true;
};
luasnip.enable = true;
mini = {
enable = true;
modules = {
surround = { };
indentscope = {
symbol = "";
options = { try_as_border = true; };
};
};
};
neo-tree = {
enable = true;
extraOptions = {
filesystem = {
follow_current_file.enabled = true;
filtered_items = {
hide_dotfiles = false;
hide_gitignored = false;
hide_hidden = false;
};
};
};
};
noice.enable = true;
notify.enable = true;
nvim-autopairs.enable = true;
nvim-colorizer.enable = true;
render-markdown.enable = true;
todo-comments.enable = true;
treesitter = {
enable = true;
folding = true;
settings.indent.enable = true;
};
vim-surround.enable = true;
web-devicons.enable = true;
};
}
+5
View File
@@ -0,0 +1,5 @@
{
colorschemes = {
gruvbox.enable = true;
};
}