mirror of
https://github.com/softinio/nix-config.git
synced 2025-10-19 03:26:40 -07:00
re-organize nixvim
This commit is contained in:
parent
7584b9ebfc
commit
10e3123b7f
22 changed files with 480 additions and 219 deletions
11
programs/nixvim/plugins/ai.nix
Normal file
11
programs/nixvim/plugins/ai.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
# GitHub Copilot
|
||||
copilot-vim.enable = true;
|
||||
|
||||
# Avante AI assistant (imported from separate file)
|
||||
# avante config is in avante.nix
|
||||
};
|
||||
}
|
17
programs/nixvim/plugins/avante.nix
Normal file
17
programs/nixvim/plugins/avante.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.avante = {
|
||||
enable = true;
|
||||
settings = {
|
||||
provider = "claude";
|
||||
providers = {
|
||||
claude = {
|
||||
model = "claude-sonnet-4-5-20250929";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
36
programs/nixvim/plugins/conform.nix
Normal file
36
programs/nixvim/plugins/conform.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
formatters_by_ft = {
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "nixfmt" ];
|
||||
python = ''
|
||||
function(bufnr)
|
||||
if require("conform").get_formatter_info("ruff_format", bufnr).available then
|
||||
return { "ruff_fix", "ruff_format" }
|
||||
else
|
||||
return { "isort", "black", "flake8" }
|
||||
end
|
||||
end
|
||||
'';
|
||||
scala = [ "scalafmt" ];
|
||||
swift = [ "swift_format" ];
|
||||
"*" = [ "trim_whitespace" "trim_newlines" ];
|
||||
};
|
||||
format_on_save = ''
|
||||
function(bufnr)
|
||||
-- Disable with a global or buffer-local variable
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
24
programs/nixvim/plugins/default.nix
Normal file
24
programs/nixvim/plugins/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
# Core plugin categories
|
||||
./ui.nix
|
||||
./git.nix
|
||||
./editing.nix
|
||||
./utility.nix
|
||||
./ai.nix
|
||||
|
||||
# LSP configuration
|
||||
./lsp
|
||||
|
||||
# Individual plugin configurations
|
||||
./avante.nix
|
||||
./conform.nix
|
||||
./floaterm.nix
|
||||
./lualine.nix
|
||||
./neo-tree.nix
|
||||
./telescope.nix
|
||||
./treesitter.nix
|
||||
];
|
||||
}
|
44
programs/nixvim/plugins/editing.nix
Normal file
44
programs/nixvim/plugins/editing.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
# Auto-close brackets and quotes
|
||||
nvim-autopairs.enable = true;
|
||||
|
||||
# Flash jump/search enhancement
|
||||
flash.enable = true;
|
||||
|
||||
# Image clipboard support
|
||||
img-clip = {
|
||||
enable = true;
|
||||
settings = {
|
||||
default = {
|
||||
embed_image_as_base64 = false;
|
||||
prompt_for_file_name = false;
|
||||
drag_and_drop = {
|
||||
insert_mode = true;
|
||||
};
|
||||
use_absolute_path = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Trim trailing whitespace
|
||||
trim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
highlight = true;
|
||||
ft_blocklist = [
|
||||
"checkhealth"
|
||||
"floaterm"
|
||||
"lspinfo"
|
||||
"neo-tree"
|
||||
"TelescopePrompt"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Collection of small useful plugins
|
||||
snacks.enable = true;
|
||||
};
|
||||
}
|
14
programs/nixvim/plugins/floaterm.nix
Normal file
14
programs/nixvim/plugins/floaterm.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins.floaterm = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
width = 0.8;
|
||||
height = 0.8;
|
||||
title = "";
|
||||
keymap_toggle = "<leader>,";
|
||||
};
|
||||
};
|
||||
}
|
17
programs/nixvim/plugins/git.nix
Normal file
17
programs/nixvim/plugins/git.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
# Git signs in the gutter
|
||||
gitsigns = {
|
||||
enable = true;
|
||||
settings.signs = {
|
||||
add.text = "+";
|
||||
change.text = "~";
|
||||
delete.text = "_";
|
||||
topdelete.text = "‾";
|
||||
changedelete.text = "~";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
9
programs/nixvim/plugins/lsp/default.nix
Normal file
9
programs/nixvim/plugins/lsp/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./servers.nix
|
||||
./keymaps.nix
|
||||
./formatting.nix
|
||||
];
|
||||
}
|
19
programs/nixvim/plugins/lsp/formatting.nix
Normal file
19
programs/nixvim/plugins/lsp/formatting.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
# Diagnostics display
|
||||
diagnostic.settings.virtual_text = true;
|
||||
|
||||
plugins = {
|
||||
# Auto-format on save
|
||||
lsp-format = {
|
||||
enable = true;
|
||||
lspServersToEnable = "all";
|
||||
};
|
||||
|
||||
# Sane defaults for all servers
|
||||
lspconfig.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
43
programs/nixvim/plugins/lsp/keymaps.nix
Normal file
43
programs/nixvim/plugins/lsp/keymaps.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.lsp.keymaps = [
|
||||
# Diagnostics navigation
|
||||
{
|
||||
key = "<leader>k";
|
||||
action.__raw = "function() vim.diagnostic.jump({ count=-1, float=true }) end";
|
||||
}
|
||||
{
|
||||
key = "<leader>j";
|
||||
action.__raw = "function() vim.diagnostic.jump({ count=1, float=true }) end";
|
||||
}
|
||||
|
||||
# LSP navigation
|
||||
{
|
||||
key = "gd";
|
||||
lspBufAction = "definition";
|
||||
}
|
||||
{
|
||||
key = "gD";
|
||||
lspBufAction = "references";
|
||||
}
|
||||
{
|
||||
key = "gt";
|
||||
lspBufAction = "type_definition";
|
||||
}
|
||||
{
|
||||
key = "gi";
|
||||
lspBufAction = "implementation";
|
||||
}
|
||||
|
||||
# Documentation and refactoring
|
||||
{
|
||||
key = "K";
|
||||
lspBufAction = "hover";
|
||||
}
|
||||
{
|
||||
key = "<F2>";
|
||||
lspBufAction = "rename";
|
||||
}
|
||||
];
|
||||
}
|
79
programs/nixvim/plugins/lsp/servers.nix
Normal file
79
programs/nixvim/plugins/lsp/servers.nix
Normal file
|
@ -0,0 +1,79 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.lsp = {
|
||||
inlayHints.enable = true;
|
||||
|
||||
servers = {
|
||||
# Python
|
||||
basedpyright = {
|
||||
enable = true;
|
||||
settings.settings.basedpyright = {
|
||||
analysis = {
|
||||
autoImportCompletions = true;
|
||||
autoSearchPaths = true;
|
||||
inlayHints = {
|
||||
callArgumentNames = true;
|
||||
};
|
||||
diagnosticMode = "openFilesOnly";
|
||||
reportMissingImports = true;
|
||||
reportMissingParameterType = true;
|
||||
reportUnnecessaryComparison = true;
|
||||
reportUnnecessaryContains = true;
|
||||
reportUnusedClass = true;
|
||||
reportUnusedFunction = true;
|
||||
reportUnsedImports = true;
|
||||
reportUnsusedVariables = true;
|
||||
typeCheckingMode = "recommended";
|
||||
useLibraryCodeForTypes = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Shell scripting
|
||||
bashls.enable = true;
|
||||
|
||||
# Web development
|
||||
html.enable = true;
|
||||
jsonls.enable = true;
|
||||
yamlls.enable = true;
|
||||
ts_ls.enable = true;
|
||||
|
||||
# Query languages
|
||||
jqls.enable = true;
|
||||
|
||||
# Lua
|
||||
lua_ls = {
|
||||
enable = true;
|
||||
settings.settings.diagnostics.globals = [ "vim" ];
|
||||
};
|
||||
|
||||
# Documentation
|
||||
marksman.enable = true;
|
||||
|
||||
# Scala
|
||||
metals.enable = true;
|
||||
|
||||
# Nix
|
||||
nil_ls.enable = true;
|
||||
nixd.enable = true;
|
||||
|
||||
# Rust
|
||||
rust_analyzer.enable = true;
|
||||
|
||||
# Swift/iOS development
|
||||
sourcekit = {
|
||||
enable = true;
|
||||
settings = {
|
||||
cmd = [
|
||||
"xcrun"
|
||||
"sourcekit-lsp"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Typst
|
||||
tinymist.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
49
programs/nixvim/plugins/lualine.nix
Normal file
49
programs/nixvim/plugins/lualine.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins.lualine = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
options.globalstatus = true;
|
||||
|
||||
sections = {
|
||||
lualine_a = [ "mode" ];
|
||||
lualine_b = [ "branch" ];
|
||||
lualine_c = [
|
||||
"filename"
|
||||
"diff"
|
||||
];
|
||||
|
||||
lualine_x = [
|
||||
"diagnostics"
|
||||
|
||||
{
|
||||
__unkeyed.__raw = ''
|
||||
function()
|
||||
local msg = ""
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end
|
||||
'';
|
||||
icon = "";
|
||||
color.fg = "#ffffff";
|
||||
}
|
||||
"encoding"
|
||||
"fileformat"
|
||||
"filetype"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
25
programs/nixvim/plugins/neo-tree.nix
Normal file
25
programs/nixvim/plugins/neo-tree.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>m";
|
||||
action = ":Neotree action=focus reveal toggle<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
|
||||
closeIfLastWindow = true;
|
||||
window = {
|
||||
width = 30;
|
||||
autoExpandWidth = true;
|
||||
position = "right";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
54
programs/nixvim/plugins/telescope.nix
Normal file
54
programs/nixvim/plugins/telescope.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
fzf-native.enable = true;
|
||||
ui-select.enable = true;
|
||||
undo.enable = true;
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
"<leader>ff" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
"<leader>b" = "buffers";
|
||||
"<leader>fh" = "help_tags";
|
||||
"<leader>fd" = "diagnostics";
|
||||
|
||||
"<C-p>" = "git_files";
|
||||
"<leader>?" = "oldfiles";
|
||||
};
|
||||
|
||||
settings.defaults = {
|
||||
file_ignore_patterns = [
|
||||
"^.git/"
|
||||
"^.mypy_cache/"
|
||||
"^__pycache__/"
|
||||
"^output/"
|
||||
"^data/"
|
||||
"%.ipynb"
|
||||
];
|
||||
set_env.COLORTERM = "truecolor";
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-t>";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require('telescope.builtin').live_grep({
|
||||
default_text="TODO",
|
||||
initial_mode="normal"
|
||||
})
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
69
programs/nixvim/plugins/treesitter.nix
Normal file
69
programs/nixvim/plugins/treesitter.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
|
||||
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
awk
|
||||
bash
|
||||
c
|
||||
cpp
|
||||
css
|
||||
dockerfile
|
||||
fish
|
||||
git-rebase
|
||||
gitattributes
|
||||
gitcommit
|
||||
gitignore
|
||||
go
|
||||
haskell
|
||||
hocon
|
||||
html
|
||||
http
|
||||
java
|
||||
javascript
|
||||
json
|
||||
json5
|
||||
jsonc
|
||||
lua
|
||||
make
|
||||
markdown
|
||||
markdown-inline
|
||||
nix
|
||||
proto
|
||||
python
|
||||
rust
|
||||
scala
|
||||
sql
|
||||
swift
|
||||
terraform
|
||||
toml
|
||||
typescript
|
||||
vim
|
||||
xml
|
||||
yaml
|
||||
];
|
||||
|
||||
nixvimInjections = true;
|
||||
|
||||
settings = {
|
||||
highlight.enable = true;
|
||||
indent.enable = true;
|
||||
};
|
||||
folding = false;
|
||||
};
|
||||
|
||||
treesitter-refactor = {
|
||||
enable = true;
|
||||
highlightDefinitions = {
|
||||
enable = true;
|
||||
# Set to false if you have an `updatetime` of ~100.
|
||||
clearOnCursorMove = false;
|
||||
};
|
||||
};
|
||||
|
||||
hmts.enable = true;
|
||||
};
|
||||
}
|
40
programs/nixvim/plugins/ui.nix
Normal file
40
programs/nixvim/plugins/ui.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
# Colorscheme
|
||||
colorschemes.tokyonight = {
|
||||
enable = true;
|
||||
settings = {
|
||||
style = "night";
|
||||
on_colors.__raw = "function(colors) colors.bg = \"#000000\" end";
|
||||
};
|
||||
};
|
||||
|
||||
plugins = {
|
||||
# Icons for file types
|
||||
web-devicons.enable = true;
|
||||
|
||||
# Color highlighter (shows colors in code)
|
||||
colorizer = {
|
||||
enable = true;
|
||||
settings.user_default_options.names = false;
|
||||
};
|
||||
|
||||
# Indentation guides
|
||||
indent-blankline.enable = true;
|
||||
|
||||
# Markdown preview with live rendering
|
||||
markview.enable = true;
|
||||
|
||||
# UI component library
|
||||
nui.enable = true;
|
||||
|
||||
# Loading/progress indicators
|
||||
fidget.enable = true;
|
||||
|
||||
# Status line (imported from separate file)
|
||||
# lualine is in lualine.nix
|
||||
};
|
||||
};
|
||||
}
|
29
programs/nixvim/plugins/utility.nix
Normal file
29
programs/nixvim/plugins/utility.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
# Lazy loading support
|
||||
lz-n.enable = true;
|
||||
|
||||
# File manager
|
||||
oil = {
|
||||
enable = true;
|
||||
lazyLoad.settings.cmd = "Oil";
|
||||
};
|
||||
|
||||
# TODO comment highlighting
|
||||
todo-comments = {
|
||||
enable = true;
|
||||
keymaps.todoTelescope.key = "<leader>t";
|
||||
};
|
||||
|
||||
# Diagnostics list
|
||||
trouble.enable = true;
|
||||
|
||||
# Typst language preview
|
||||
typst-preview.enable = true;
|
||||
|
||||
# Key binding help
|
||||
which-key.enable = true;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue