big module system implementation
This commit is contained in:
31
home/modules/devtools/neovim/autocommands.nix
Normal file
31
home/modules/devtools/neovim/autocommands.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
programs.nixvim.autoCmd = [
|
||||
# Open help in a vertical split
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = "help";
|
||||
command = "wincmd L";
|
||||
}
|
||||
|
||||
# Enable spellcheck for some filetypes
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = [
|
||||
"tex"
|
||||
"latex"
|
||||
"markdown"
|
||||
];
|
||||
command = "setlocal spell spelllang=en,se";
|
||||
}
|
||||
{
|
||||
event = "TextYankPost";
|
||||
desc = "Highlight when yanking (copying) text";
|
||||
# group = "vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true })";
|
||||
callback = {
|
||||
__raw = "function()
|
||||
vim.highlight.on_yank()
|
||||
end";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
53
home/modules/devtools/neovim/completion.nix
Normal file
53
home/modules/devtools/neovim/completion.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
opts.completeopt = ["menu" "menuone" "noselect"];
|
||||
|
||||
plugins = {
|
||||
luasnip.enable = true;
|
||||
|
||||
lspkind = {
|
||||
enable = true;
|
||||
|
||||
cmp = {
|
||||
enable = true;
|
||||
menu = {
|
||||
nvim_lsp = "[LSP]";
|
||||
nvim_lua = "[api]";
|
||||
path = "[path]";
|
||||
luasnip = "[snip]";
|
||||
buffer = "[buffer]";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmp = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
|
||||
mapping = {
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
||||
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
||||
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||
};
|
||||
|
||||
sources = [
|
||||
{name = "path";}
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{
|
||||
name = "buffer";
|
||||
# Words from other open buffers can also be suggested.
|
||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
home/modules/devtools/neovim/default.nix
Normal file
33
home/modules/devtools/neovim/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.modules.devtools.neovim;
|
||||
in {
|
||||
imports = [
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
./autocommands.nix
|
||||
./completion.nix
|
||||
./keymappings.nix
|
||||
./options.nix
|
||||
./plugins
|
||||
./todo.nix
|
||||
];
|
||||
options = {
|
||||
modules.devtools.neovim.enable = mkEnableOption "Enables neovim";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
luaLoader.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
94
home/modules/devtools/neovim/keymappings.nix
Normal file
94
home/modules/devtools/neovim/keymappings.nix
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.nixvim = {
|
||||
globals = {
|
||||
mapleader = " ";
|
||||
maplocalleader = " ";
|
||||
};
|
||||
|
||||
keymaps = let
|
||||
normal =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "n";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
# "<C-c>" = "<cmd> %y+ <CR>";
|
||||
"<C-v>" = "p";
|
||||
"<C-a>" = "ggVG";
|
||||
"<Space>" = "<NOP>";
|
||||
|
||||
# Esc to clear search results
|
||||
"<esc>" = ":noh<CR>";
|
||||
|
||||
# fix Y behaviour
|
||||
Y = "y$";
|
||||
|
||||
# back and fourth between the two most recent files
|
||||
"<C-c>" = ":b#<CR>";
|
||||
|
||||
# close by Ctrl+x
|
||||
"<C-x>" = ":close<CR>";
|
||||
|
||||
# save by Space+s or Ctrl+s
|
||||
"<leader>s" = ":w<CR>";
|
||||
"<C-s>" = ":w<CR>";
|
||||
|
||||
# navigate to left/right window
|
||||
"<leader>h" = "<C-w>h";
|
||||
"<leader>l" = "<C-w>l";
|
||||
|
||||
# Press 'H', 'L' to jump to start/end of a line (first/last character)
|
||||
L = "$";
|
||||
H = "^";
|
||||
|
||||
# resize with arrows
|
||||
"<C-Up>" = ":resize -2<CR>";
|
||||
"<C-Down>" = ":resize +2<CR>";
|
||||
"<C-Left>" = ":vertical resize +2<CR>";
|
||||
"<C-Right>" = ":vertical resize -2<CR>";
|
||||
|
||||
# move current line up/down
|
||||
# M = Alt key
|
||||
"<M-k>" = ":move-2<CR>";
|
||||
"<M-j>" = ":move+<CR>";
|
||||
|
||||
"<leader>rp" = ":!remi push<CR>";
|
||||
};
|
||||
visual =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "v";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
"<C-c>" = "y";
|
||||
# better indenting
|
||||
">" = ">gv";
|
||||
"<" = "<gv";
|
||||
"<TAB>" = ">gv";
|
||||
"<S-TAB>" = "<gv";
|
||||
|
||||
# move selected line / block of text in visual mode
|
||||
"K" = ":m '<-2<CR>gv=gv";
|
||||
"J" = ":m '>+1<CR>gv=gv";
|
||||
};
|
||||
insert =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "i";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
"<C-v>" = "<esc>p";
|
||||
};
|
||||
in
|
||||
config.lib.nixvim.keymaps.mkKeymaps
|
||||
{options.silent = true;}
|
||||
(normal ++ visual ++ insert);
|
||||
};
|
||||
}
|
||||
72
home/modules/devtools/neovim/options.nix
Normal file
72
home/modules/devtools/neovim/options.nix
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
globals = {
|
||||
# Disable useless providers
|
||||
loaded_ruby_provider = 0; # Ruby
|
||||
loaded_perl_provider = 0; # Perl
|
||||
loaded_python_provider = 0; # Python 2
|
||||
};
|
||||
|
||||
clipboard = {
|
||||
# Use system clipboard
|
||||
register = "unnamedplus";
|
||||
|
||||
providers.wl-copy.enable = true;
|
||||
};
|
||||
|
||||
opts = {
|
||||
updatetime = 100; # Faster completion
|
||||
|
||||
# Line numbers
|
||||
relativenumber = false; # Relative line numbers
|
||||
number = true; # Display the absolute line number of the current line
|
||||
hidden = true; # Keep closed buffer open in the background
|
||||
showmode = false;
|
||||
mouse = "a"; # Enable mouse control
|
||||
mousemodel = "popup"; # Mouse right-click extends the current selection
|
||||
splitbelow = true; # A new window is put below the current one
|
||||
splitright = true; # A new window is put right of the current one
|
||||
list = true;
|
||||
listchars = {
|
||||
tab = "▷ ";
|
||||
trail = "·";
|
||||
nbsp = "○";
|
||||
extends = "◣";
|
||||
precedes = "◢";
|
||||
};
|
||||
|
||||
swapfile = false; # Disable the swap file
|
||||
modeline = true; # Tags such as 'vim:ft=sh'
|
||||
modelines = 100; # Sets the type of modelines
|
||||
undofile = true; # Automatically save and restore undo history
|
||||
incsearch = true; # Incremental search: show match for partly typed search command
|
||||
inccommand = "split"; # Search and replace: preview changes in quickfix list
|
||||
ignorecase = true; # When the search query is lower-case, match both lower and upper-case
|
||||
# patterns
|
||||
smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper
|
||||
# case characters
|
||||
scrolloff = 4; # Number of screen lines to show around the cursor
|
||||
cursorline = true; # Highlight the screen line of the cursor
|
||||
cursorcolumn = false; # Highlight the screen column of the cursor
|
||||
signcolumn = "yes"; # Whether to show the signcolumn
|
||||
colorcolumn = ""; # Columns to highlight
|
||||
laststatus = 3; # When to use a status line for the last window
|
||||
fileencoding = "utf-8"; # File-content encoding for the current buffer
|
||||
# termguicolors = true; # Enables 24-bit RGB color in the |TUI|
|
||||
spell = false; # Highlight spelling mistakes (local to window)
|
||||
wrap = false; # Prevent text from wrapping
|
||||
|
||||
# Tab options
|
||||
tabstop = 4; # Number of spaces a <Tab> in the text stands for (local to buffer)
|
||||
shiftwidth = 4; # Number of spaces used for each step of (auto)indent (local to buffer)
|
||||
expandtab = true; # Expand <Tab> to spaces in Insert mode (local to buffer)
|
||||
autoindent = true; # Do clever autoindenting
|
||||
|
||||
textwidth = 0; # Maximum width of text that is being inserted. A longer line will be
|
||||
# broken after white space to get this width.
|
||||
|
||||
# Folding
|
||||
foldlevel = 99; # Folds with a level higher than this number will be closed
|
||||
};
|
||||
};
|
||||
}
|
||||
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;
|
||||
};
|
||||
}
|
||||
26
home/modules/devtools/neovim/todo.nix
Normal file
26
home/modules/devtools/neovim/todo.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
programs.nixvim = {
|
||||
highlight.Todo = {
|
||||
fg = "Blue";
|
||||
bg = "Yellow";
|
||||
};
|
||||
|
||||
match.TODO = "TODO";
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-t>";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require('telescope.builtin').live_grep({
|
||||
default_text="TODO",
|
||||
initial_mode="normal"
|
||||
})
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user