big module system implementation
This commit is contained in:
10
home/modules/devtools/neovim/plugins/barbar.nix
Normal file
10
home/modules/devtools/neovim/plugins/barbar.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
programs.nixvim.plugins.barbar = {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
next.key = "<TAB>";
|
||||
previous.key = "<S-TAB>";
|
||||
close.key = "<C-w>";
|
||||
};
|
||||
};
|
||||
}
|
||||
8
home/modules/devtools/neovim/plugins/chatgpt.nix
Normal file
8
home/modules/devtools/neovim/plugins/chatgpt.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{config, ...}: {
|
||||
programs.nixvim.plugins.chatgpt = {
|
||||
enable = true;
|
||||
settings = {
|
||||
api_key_cmd = "cat ${config.sops.secrets.openai_api_key.path}";
|
||||
};
|
||||
};
|
||||
}
|
||||
10
home/modules/devtools/neovim/plugins/comment.nix
Normal file
10
home/modules/devtools/neovim/plugins/comment.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
programs.nixvim.plugins.comment = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
opleader.line = "<C-b>";
|
||||
toggler.line = "<C-b>";
|
||||
};
|
||||
};
|
||||
}
|
||||
24
home/modules/devtools/neovim/plugins/conform.nix
Normal file
24
home/modules/devtools/neovim/plugins/conform.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
programs.nixvim.plugins.conform-nvim = {
|
||||
enable = true;
|
||||
formatOnSave = {
|
||||
lspFallback = true;
|
||||
timeoutMs = 500;
|
||||
};
|
||||
notifyOnError = true;
|
||||
formattersByFt = {
|
||||
liquidsoap = [ "liquidsoap-prettier" ];
|
||||
html = [ [ "prettierd" "prettier" ] ];
|
||||
css = [ [ "prettierd" "prettier" ] ];
|
||||
javascript = [ [ "prettierd" "prettier" ] ];
|
||||
javascriptreact = [ [ "prettierd" "prettier" ] ];
|
||||
typescript = [ [ "prettierd" "prettier" ] ];
|
||||
typescriptreact = [ [ "prettierd" "prettier" ] ];
|
||||
python = [ "black" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "alejandra" ];
|
||||
markdown = [ [ "prettierd" "prettier" ] ];
|
||||
yaml = [ "yamllint" "yamlfmt" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
60
home/modules/devtools/neovim/plugins/default.nix
Normal file
60
home/modules/devtools/neovim/plugins/default.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./barbar.nix
|
||||
./comment.nix
|
||||
./efm.nix
|
||||
# ./floaterm.nix
|
||||
# ./harpoon.nix
|
||||
./lsp.nix
|
||||
./lualine.nix
|
||||
./markdown-preview.nix
|
||||
./neo-tree.nix
|
||||
./startify.nix
|
||||
./tagbar.nix
|
||||
./telescope.nix
|
||||
./treesitter.nix
|
||||
./chatgpt.nix
|
||||
# ./vimtex.nix
|
||||
./nonels.nix
|
||||
./conform.nix
|
||||
# ./yanky.nix
|
||||
];
|
||||
|
||||
programs.nixvim = {
|
||||
extraPlugins = [pkgs.vimPlugins.gruvbox-material];
|
||||
colorscheme = "gruvbox-material";
|
||||
|
||||
plugins = {
|
||||
gitsigns = {
|
||||
enable = true;
|
||||
settings.signs = {
|
||||
add.text = "+";
|
||||
change.text = "~";
|
||||
};
|
||||
};
|
||||
|
||||
nvim-autopairs.enable = true;
|
||||
|
||||
nvim-colorizer = {
|
||||
enable = true;
|
||||
userDefaultOptions.names = false;
|
||||
};
|
||||
|
||||
oil.enable = true;
|
||||
|
||||
trim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
highlight = false;
|
||||
ft_blocklist = [
|
||||
"checkhealth"
|
||||
"floaterm"
|
||||
"lspinfo"
|
||||
"neo-tree"
|
||||
"TelescopePrompt"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
22
home/modules/devtools/neovim/plugins/efm.nix
Normal file
22
home/modules/devtools/neovim/plugins/efm.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
lsp.servers.efm = {
|
||||
enable = true;
|
||||
extraOptions.init_options = {
|
||||
documentFormatting = true;
|
||||
documentRangeFormatting = true;
|
||||
hover = true;
|
||||
documentSymbol = true;
|
||||
codeAction = true;
|
||||
completion = true;
|
||||
};
|
||||
};
|
||||
|
||||
lsp-format = {
|
||||
enable = true;
|
||||
lspServersToEnable = ["efm"];
|
||||
};
|
||||
|
||||
efmls-configs.enable = true;
|
||||
};
|
||||
}
|
||||
12
home/modules/devtools/neovim/plugins/floaterm.nix
Normal file
12
home/modules/devtools/neovim/plugins/floaterm.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
programs.nixvim.plugins.floaterm = {
|
||||
enable = true;
|
||||
|
||||
width = 0.8;
|
||||
height = 0.8;
|
||||
|
||||
title = "";
|
||||
|
||||
keymaps.toggle = "<leader>,";
|
||||
};
|
||||
}
|
||||
20
home/modules/devtools/neovim/plugins/harpoon.nix
Normal file
20
home/modules/devtools/neovim/plugins/harpoon.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
|
||||
keymapsSilent = true;
|
||||
|
||||
keymaps = {
|
||||
addFile = "<leader>a";
|
||||
toggleQuickMenu = "<C-e>";
|
||||
navFile = {
|
||||
"1" = "<C-j>";
|
||||
"2" = "<C-k>";
|
||||
"3" = "<C-l>";
|
||||
"4" = "<C-m>";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
87
home/modules/devtools/neovim/plugins/lsp.nix
Normal file
87
home/modules/devtools/neovim/plugins/lsp.nix
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
silent = true;
|
||||
diagnostic = {
|
||||
# Navigate in diagnostics
|
||||
"<leader>k" = "goto_prev";
|
||||
"<leader>j" = "goto_next";
|
||||
};
|
||||
|
||||
lspBuf = {
|
||||
gd = "definition";
|
||||
gD = "references";
|
||||
gt = "type_definition";
|
||||
gi = "implementation";
|
||||
K = "hover";
|
||||
"<F2>" = "rename";
|
||||
};
|
||||
};
|
||||
|
||||
# Language server
|
||||
servers = {
|
||||
# Average webdev LSPs
|
||||
cssls.enable = true; # CSS
|
||||
tailwindcss.enable = true; # TailwindCSS
|
||||
html.enable = true; # HTML
|
||||
astro.enable = false; # AstroJS
|
||||
phpactor.enable = true; # PHP
|
||||
svelte.enable = false; # Svelte
|
||||
vuels.enable = false; # Vue
|
||||
|
||||
# Python
|
||||
pyright.enable = true;
|
||||
|
||||
# Markdown
|
||||
marksman.enable = true;
|
||||
|
||||
# Nix
|
||||
nixd.enable = true;
|
||||
|
||||
# Docker
|
||||
dockerls.enable = true;
|
||||
|
||||
# Bash
|
||||
bashls.enable = true;
|
||||
|
||||
# C/C++
|
||||
clangd.enable = true;
|
||||
|
||||
# C#
|
||||
csharp-ls.enable = true;
|
||||
|
||||
# Yaml
|
||||
yamlls.enable = true;
|
||||
|
||||
# Lua
|
||||
lua-ls = {
|
||||
enable = true;
|
||||
settings.telemetry.enable = false;
|
||||
settings.diagnostics = {
|
||||
globals = ["vim"];
|
||||
};
|
||||
};
|
||||
tsserver = {
|
||||
enable = false; # TS/JS
|
||||
};
|
||||
# Rust
|
||||
rust-analyzer = {
|
||||
enable = true;
|
||||
installRustc = true;
|
||||
installCargo = true;
|
||||
settings = {
|
||||
checkOnSave = true;
|
||||
check = {
|
||||
command = "clippy";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
47
home/modules/devtools/neovim/plugins/lualine.nix
Normal file
47
home/modules/devtools/neovim/plugins/lualine.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
programs.nixvim.plugins.lualine = {
|
||||
enable = true;
|
||||
theme = "gruvbox-material";
|
||||
|
||||
globalstatus = true;
|
||||
|
||||
# +-------------------------------------------------+
|
||||
# | A | B | C X | Y | Z |
|
||||
# +-------------------------------------------------+
|
||||
sections = {
|
||||
lualine_a = ["mode"];
|
||||
lualine_b = ["branch"];
|
||||
lualine_c = ["filename" "diff"];
|
||||
|
||||
lualine_x = [
|
||||
"diagnostics"
|
||||
|
||||
# Show active language server
|
||||
{
|
||||
name.__raw = ''
|
||||
function()
|
||||
local msg = ""
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_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"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
20
home/modules/devtools/neovim/plugins/markdown-preview.nix
Normal file
20
home/modules/devtools/neovim/plugins/markdown-preview.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.markdown-preview = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
auto_close = false;
|
||||
theme = "dark";
|
||||
};
|
||||
};
|
||||
|
||||
files."after/ftplugin/markdown.lua".keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>m";
|
||||
action = ":MarkdownPreview<cr>";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
22
home/modules/devtools/neovim/plugins/neo-tree.nix
Normal file
22
home/modules/devtools/neovim/plugins/neo-tree.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>n";
|
||||
action = ":Neotree action=focus reveal toggle<CR>";
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
|
||||
closeIfLastWindow = true;
|
||||
window = {
|
||||
width = 30;
|
||||
autoExpandWidth = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
44
home/modules/devtools/neovim/plugins/nonels.nix
Normal file
44
home/modules/devtools/neovim/plugins/nonels.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
programs.nixvim.plugins.none-ls = {
|
||||
enable = true;
|
||||
settings = {
|
||||
cmd = ["bash -c nvim"];
|
||||
debug = true;
|
||||
};
|
||||
sources = {
|
||||
code_actions = {
|
||||
statix.enable = true;
|
||||
gitsigns.enable = true;
|
||||
};
|
||||
diagnostics = {
|
||||
statix.enable = true;
|
||||
deadnix.enable = true;
|
||||
pylint.enable = true;
|
||||
checkstyle.enable = true;
|
||||
};
|
||||
formatting = {
|
||||
alejandra.enable = true;
|
||||
stylua.enable = true;
|
||||
shfmt.enable = true;
|
||||
nixpkgs_fmt.enable = true;
|
||||
google_java_format.enable = false;
|
||||
prettier = {
|
||||
enable = true;
|
||||
disableTsServerFormatter = true;
|
||||
};
|
||||
black = {
|
||||
enable = true;
|
||||
settings = ''
|
||||
{
|
||||
extra_args = { "--fast" },
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
completion = {
|
||||
luasnip.enable = true;
|
||||
spell.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
32
home/modules/devtools/neovim/plugins/startify.nix
Normal file
32
home/modules/devtools/neovim/plugins/startify.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
programs.nixvim.plugins.startify = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
custom_header = [
|
||||
""
|
||||
" ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
" ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
" ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
" ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
" ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
" ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
|
||||
# When opening a file or bookmark, change to its directory.
|
||||
change_to_dir = false;
|
||||
|
||||
# By default, the fortune header uses ASCII characters, because they work for everyone.
|
||||
# If you set this option to 1 and your 'encoding' is "utf-8", Unicode box-drawing characters will
|
||||
# be used instead.
|
||||
use_unicode = true;
|
||||
|
||||
lists = [{type = "dir";}];
|
||||
files_number = 30;
|
||||
|
||||
skiplist = [
|
||||
"flake.lock"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
17
home/modules/devtools/neovim/plugins/tagbar.nix
Normal file
17
home/modules/devtools/neovim/plugins/tagbar.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.tagbar = {
|
||||
enable = true;
|
||||
settings.width = 50;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-g>";
|
||||
action = ":TagbarToggle<cr>";
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
33
home/modules/devtools/neovim/plugins/telescope.nix
Normal file
33
home/modules/devtools/neovim/plugins/telescope.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
# Find files using Telescope command-line sugar.
|
||||
"<leader>ff" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
"<leader>b" = "buffers";
|
||||
"<leader>fh" = "help_tags";
|
||||
"<leader>fd" = "diagnostics";
|
||||
|
||||
# FZF like bindings
|
||||
"<C-p>" = "git_files";
|
||||
"<leader>p" = "oldfiles";
|
||||
"<C-f>" = "live_grep";
|
||||
};
|
||||
|
||||
settings.defaults = {
|
||||
file_ignore_patterns = [
|
||||
"^.git/"
|
||||
"^.mypy_cache/"
|
||||
"^__pycache__/"
|
||||
"^output/"
|
||||
"^data/"
|
||||
"%.ipynb"
|
||||
];
|
||||
set_env.COLORTERM = "truecolor";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
26
home/modules/devtools/neovim/plugins/treesitter.nix
Normal file
26
home/modules/devtools/neovim/plugins/treesitter.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
|
||||
nixvimInjections = true;
|
||||
|
||||
settings = {
|
||||
highlight.enable = true;
|
||||
indent.enable = true;
|
||||
};
|
||||
folding = true;
|
||||
};
|
||||
|
||||
treesitter-refactor = {
|
||||
enable = true;
|
||||
highlightDefinitions = {
|
||||
enable = true;
|
||||
# Set to false if you have an `updatetime` of ~100.
|
||||
clearOnCursorMove = false;
|
||||
};
|
||||
};
|
||||
|
||||
hmts.enable = true;
|
||||
};
|
||||
}
|
||||
77
home/modules/devtools/neovim/plugins/vimtex.nix
Normal file
77
home/modules/devtools/neovim/plugins/vimtex.nix
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.vimtex = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
view_method = "zathura";
|
||||
|
||||
quickfix_enabled = true;
|
||||
quickfix_open_on_warning = false;
|
||||
|
||||
# Ignore undesired errors and warnings
|
||||
quickfix_ignore_filters = [
|
||||
"Underfull"
|
||||
"Overfull"
|
||||
"specifier changed to"
|
||||
"Token not allowed in a PDF string"
|
||||
];
|
||||
|
||||
# TOC settings
|
||||
toc_config = {
|
||||
name = "TOC";
|
||||
layers = ["content" "todo"];
|
||||
resize = true;
|
||||
split_width = 50;
|
||||
todo_sorted = false;
|
||||
show_help = true;
|
||||
show_numbers = true;
|
||||
mode = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
files."after/ftplugin/tex.lua".keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "m";
|
||||
action = ":VimtexView<cr>";
|
||||
}
|
||||
];
|
||||
|
||||
autoCmd = [
|
||||
{
|
||||
event = ["BufEnter" "BufWinEnter"];
|
||||
pattern = "*.tex";
|
||||
command = "set filetype=tex \"| VimtexTocOpen";
|
||||
}
|
||||
|
||||
# Folding
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = ["tex" "latex"];
|
||||
callback.__raw = ''
|
||||
function ()
|
||||
vim.o.foldmethod = 'expr'
|
||||
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
|
||||
vim.o.foldtext = 'vimtex#fold#text()'
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
||||
# Compile on initialization
|
||||
{
|
||||
event = "User";
|
||||
pattern = "VimtexEventInitPost";
|
||||
callback = "vimtex#compiler#compile";
|
||||
}
|
||||
|
||||
# Cleanup on exit
|
||||
{
|
||||
event = "User";
|
||||
pattern = "VimtexEventQuit";
|
||||
command = "call vimtex#compiler#clean(0)";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
5
home/modules/devtools/neovim/plugins/yanky.nix
Normal file
5
home/modules/devtools/neovim/plugins/yanky.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
programs.nixvim.plugins.yanky = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user