mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-05-11 21:35:06 +02:00
neovim: Switch to using flake-parts modules
This commit is contained in:
parent
b8747c4685
commit
5a7381b266
13 changed files with 609 additions and 654 deletions
67
flake.lock
generated
67
flake.lock
generated
|
|
@ -68,23 +68,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"diagram.nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1724882438,
|
||||
"narHash": "sha256-FH9i/I2DiCBpU1b8aTHCNDviBIS7IBng2D30OQH29RU=",
|
||||
"owner": "3rd",
|
||||
"repo": "diagram.nvim",
|
||||
"rev": "1022def2b5b2c70895e381f13a75abee6327a23c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "3rd",
|
||||
"ref": "feature/toggle",
|
||||
"repo": "diagram.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fioul": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
|
|
@ -505,11 +488,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735882644,
|
||||
"narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=",
|
||||
"lastModified": 1737043064,
|
||||
"narHash": "sha256-I/OuxGwXwRi5gnFPsyCvVR+IfFstA+QXEpHu1hvsgD8=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
|
||||
"rev": "94ee657f6032d913fe0ef49adaa743804635b0bb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -610,11 +593,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736089250,
|
||||
"narHash": "sha256-/LPWMiiJGPHGd7ZYEgmbE2da4zvBW0acmshUjYC3WG4=",
|
||||
"lastModified": 1737075266,
|
||||
"narHash": "sha256-u1gk5I1an975FOAMMdS6oBKnSIsZza5ZKhaeBZAskVo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "172b91bfb2b7f5c4a8c6ceac29fd53a01ef07196",
|
||||
"rev": "12851ae7467bad8ef422b20806ab4d6d81e12d29",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -805,11 +788,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736085891,
|
||||
"narHash": "sha256-bTl9fcUo767VaSx4Q5kFhwiDpFQhBKna7lNbGsqCQiA=",
|
||||
"lastModified": 1736819234,
|
||||
"narHash": "sha256-deQVtIH4UJueELJqluAICUtX7OosD9paTP+5FgbiSwI=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "ba9b3173b0f642ada42b78fb9dfc37ca82266f6c",
|
||||
"rev": "bd921223ba7cdac346477d7ea5204d6f4736fcc6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -1193,11 +1176,11 @@
|
|||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736219611,
|
||||
"narHash": "sha256-osQC3uZOQQrTPTlhEBE6mesPCkYDDOSLsJNNATQZqmw=",
|
||||
"lastModified": 1737385899,
|
||||
"narHash": "sha256-/zyvdstDpPhc5lhFMtKgyQdU2oXGXDb0cg4BY91NKvg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "a352bb89b0cd180f5c767689c4cc310109cd4ad8",
|
||||
"rev": "115994f18e439a1cca9cdaaf15c004870256814d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -1305,7 +1288,6 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"comma": "comma",
|
||||
"diagram.nvim": "diagram.nvim",
|
||||
"fioul": "fioul",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-root": "flake-root",
|
||||
|
|
@ -1329,8 +1311,7 @@
|
|||
"rust-overlay": "rust-overlay_8",
|
||||
"simulationcraft": "simulationcraft",
|
||||
"treefmt-nix": "treefmt-nix_3",
|
||||
"vim-headerguard": "vim-headerguard",
|
||||
"wiki.vim": "wiki.vim"
|
||||
"vim-headerguard": "vim-headerguard"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
|
@ -1715,11 +1696,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736115332,
|
||||
"narHash": "sha256-FBG9d7e0BTFfxVdw4b5EmNll2Mv7hfRc54hbB4LrKko=",
|
||||
"lastModified": 1737054102,
|
||||
"narHash": "sha256-saLiCRQ5RtdTnznT/fja7GxcYRAzeY3k8S+IF/2s/2A=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "1788ca5acd4b542b923d4757d4cfe4183cc6a92d",
|
||||
"rev": "97871d416166803134ba64597a1006f3f670fbde",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -1825,22 +1806,6 @@
|
|||
"repo": "vim-headerguard",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wiki.vim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1735084629,
|
||||
"narHash": "sha256-GL0++z5mmBkJ1SpM6jbvkVQQMgWTtqHpwagc7Jn1BVs=",
|
||||
"owner": "lervag",
|
||||
"repo": "wiki.vim",
|
||||
"rev": "80bb6dd1684a6cf13025733e4d810e36ad0ae9f3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lervag",
|
||||
"repo": "wiki.vim",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
10
flake.nix
10
flake.nix
|
|
@ -88,14 +88,6 @@
|
|||
url = "github:drmikehenry/vim-headerguard";
|
||||
flake = false;
|
||||
};
|
||||
"wiki.vim" = {
|
||||
url = "github:lervag/wiki.vim";
|
||||
flake = false;
|
||||
};
|
||||
"diagram.nvim" = {
|
||||
url = "github:3rd/diagram.nvim/feature/toggle";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
|
@ -112,9 +104,9 @@
|
|||
|
||||
imports = [
|
||||
./pkgs
|
||||
./neovim/pkg.nix
|
||||
./hostconfig
|
||||
./templates
|
||||
./neovim
|
||||
inputs.treefmt-nix.flakeModule
|
||||
inputs.flake-root.flakeModule
|
||||
];
|
||||
|
|
|
|||
|
|
@ -20,26 +20,23 @@ in
|
|||
config = {
|
||||
workAddr = "quentin.boyer@${decode workDomain}";
|
||||
|
||||
extraNixvim = [
|
||||
(
|
||||
{ helpers, ... }:
|
||||
{
|
||||
extraConfigLuaPre = ''
|
||||
team_picker = dofile("${./telescope-team.lua}")
|
||||
'';
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>R";
|
||||
mode = [ "n" ];
|
||||
action = helpers.mkRaw "team_picker";
|
||||
}
|
||||
];
|
||||
commands = {
|
||||
Review = "lua team_picker()";
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
programs.nixvim =
|
||||
{ lib, ... }:
|
||||
{
|
||||
extraConfigLuaPre = ''
|
||||
team_picker = dofile("${./telescope-team.lua}")
|
||||
'';
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>R";
|
||||
mode = [ "n" ];
|
||||
action = lib.nixvim.mkRaw "team_picker";
|
||||
}
|
||||
];
|
||||
commands = {
|
||||
Review = "lua team_picker()";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
(pkgs.writeShellScriptBin "nwadminSendmail" ''
|
||||
|
|
|
|||
|
|
@ -15,13 +15,9 @@
|
|||
default = "";
|
||||
};
|
||||
|
||||
options.extraNixvim = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.anything;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
imports = [
|
||||
inputs.nix-index-database.hmModules.nix-index
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
extraInfo
|
||||
];
|
||||
|
||||
|
|
@ -45,52 +41,55 @@
|
|||
EDITOR = "nvim";
|
||||
};
|
||||
|
||||
home.packages =
|
||||
(with pkgs; [
|
||||
bat
|
||||
comma
|
||||
fd
|
||||
sd
|
||||
choose
|
||||
file
|
||||
gdb
|
||||
gnumake
|
||||
jq
|
||||
man-pages
|
||||
oscclip
|
||||
pandoc
|
||||
raclette
|
||||
ripgrep
|
||||
rsync
|
||||
tokei
|
||||
unzip
|
||||
wget
|
||||
frg
|
||||
nix-output-monitor
|
||||
bat-extras.prettybat
|
||||
just
|
||||
bottom
|
||||
keychain
|
||||
rclone
|
||||
nix-du
|
||||
programs.nixvim = _: {
|
||||
enable = true;
|
||||
imports = [ flake.nixvimModules.neovimTraxys ];
|
||||
};
|
||||
|
||||
# Useful for pandoc to latex
|
||||
(texlive.combine {
|
||||
inherit (texlive)
|
||||
scheme-medium
|
||||
fncychap
|
||||
wrapfig
|
||||
capt-of
|
||||
framed
|
||||
upquote
|
||||
needspace
|
||||
tabulary
|
||||
varwidth
|
||||
titlesec
|
||||
;
|
||||
})
|
||||
])
|
||||
++ [ (pkgs.neovimTraxys.extend { imports = config.extraNixvim; }) ];
|
||||
home.packages = with pkgs; [
|
||||
bat
|
||||
comma
|
||||
fd
|
||||
sd
|
||||
choose
|
||||
file
|
||||
gdb
|
||||
gnumake
|
||||
jq
|
||||
man-pages
|
||||
oscclip
|
||||
pandoc
|
||||
raclette
|
||||
ripgrep
|
||||
rsync
|
||||
tokei
|
||||
unzip
|
||||
wget
|
||||
frg
|
||||
nix-output-monitor
|
||||
bat-extras.prettybat
|
||||
just
|
||||
bottom
|
||||
keychain
|
||||
rclone
|
||||
nix-du
|
||||
|
||||
# Useful for pandoc to latex
|
||||
(texlive.combine {
|
||||
inherit (texlive)
|
||||
scheme-medium
|
||||
fncychap
|
||||
wrapfig
|
||||
capt-of
|
||||
framed
|
||||
upquote
|
||||
needspace
|
||||
tabulary
|
||||
varwidth
|
||||
titlesec
|
||||
;
|
||||
})
|
||||
];
|
||||
|
||||
nix.registry = {
|
||||
"my".flake = flake;
|
||||
|
|
|
|||
466
neovim/config/default.nix
Normal file
466
neovim/config/default.nix
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
{ flake }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
helpers,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./lsp.nix
|
||||
./notes.nix
|
||||
./completion.nix
|
||||
];
|
||||
|
||||
_module.args.flake = flake;
|
||||
|
||||
colorschemes.tokyonight = {
|
||||
settings.style = "night";
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.mini = {
|
||||
enable = true;
|
||||
modules.icons = { };
|
||||
mockDevIcons = true;
|
||||
};
|
||||
|
||||
performance = {
|
||||
byteCompileLua = {
|
||||
enable = true;
|
||||
nvimRuntime = true;
|
||||
configs = true;
|
||||
plugins = true;
|
||||
};
|
||||
combinePlugins = {
|
||||
enable = true;
|
||||
standalonePlugins = [
|
||||
"vimplugin-treesitter-grammar-nix"
|
||||
"nvim-treesitter"
|
||||
"openscad.nvim"
|
||||
"yanky.nvim"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
plugins.lz-n.enable = true;
|
||||
|
||||
autoGroups.BigFileOptimizer = { };
|
||||
autoCmd = [
|
||||
{
|
||||
event = "BufReadPost";
|
||||
pattern = [
|
||||
"*.md"
|
||||
"*.rs"
|
||||
"*.lua"
|
||||
"*.sh"
|
||||
"*.bash"
|
||||
"*.zsh"
|
||||
"*.js"
|
||||
"*.jsx"
|
||||
"*.ts"
|
||||
"*.tsx"
|
||||
"*.c"
|
||||
".h"
|
||||
"*.cc"
|
||||
".hh"
|
||||
"*.cpp"
|
||||
".cph"
|
||||
];
|
||||
group = "BigFileOptimizer";
|
||||
callback = helpers.mkRaw ''
|
||||
function(auEvent)
|
||||
local bufferCurrentLinesCount = vim.api.nvim_buf_line_count(0)
|
||||
|
||||
if bufferCurrentLinesCount > 2048 then
|
||||
vim.notify("bigfile: disabling features", vim.log.levels.WARN)
|
||||
|
||||
vim.cmd("TSBufDisable refactor.highlight_definitions")
|
||||
vim.g.matchup_matchparen_enabled = 0
|
||||
require("nvim-treesitter.configs").setup({
|
||||
matchup = {
|
||||
enable = false
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
globals = {
|
||||
neo_tree_remove_legacy_commands = 1;
|
||||
mapleader = " ";
|
||||
};
|
||||
|
||||
opts = {
|
||||
termguicolors = true;
|
||||
number = true;
|
||||
tabstop = 4;
|
||||
shiftwidth = 4;
|
||||
scrolloff = 7;
|
||||
signcolumn = "yes";
|
||||
cmdheight = 2;
|
||||
pumheight = 15;
|
||||
cot = [
|
||||
"menu"
|
||||
"menuone"
|
||||
"noselect"
|
||||
];
|
||||
updatetime = 100;
|
||||
colorcolumn = "100";
|
||||
# Too many false positives
|
||||
spell = false;
|
||||
listchars = "tab:>-,lead:·,nbsp:␣,trail:•";
|
||||
fsync = true;
|
||||
|
||||
timeout = true;
|
||||
timeoutlen = 300;
|
||||
};
|
||||
|
||||
commands = {
|
||||
"SpellFr" = "setlocal spelllang=fr";
|
||||
};
|
||||
|
||||
filetype = {
|
||||
filename = {
|
||||
Jenkinsfile = "groovy";
|
||||
};
|
||||
extension = {
|
||||
lalrpop = "lalrpop";
|
||||
};
|
||||
};
|
||||
|
||||
keymaps =
|
||||
let
|
||||
modeKeys =
|
||||
mode:
|
||||
lib.attrsets.mapAttrsToList (
|
||||
key: action:
|
||||
{ inherit key mode; } // (if builtins.isString action then { inherit action; } else action)
|
||||
);
|
||||
nm = modeKeys [ "n" ];
|
||||
in
|
||||
helpers.keymaps.mkKeymaps { options.silent = true; } (nm {
|
||||
"ft" = "<cmd>Neotree<CR>";
|
||||
"fG" = "<cmd>Neotree git_status<CR>";
|
||||
"fR" = "<cmd>Neotree remote<CR>";
|
||||
"fc" = "<cmd>Neotree close<CR>";
|
||||
"bp" = "<cmd>Telescope buffers<CR>";
|
||||
|
||||
"<C-s>" = "<cmd>Telescope spell_suggest<CR>";
|
||||
"mk" = "<cmd>Telescope keymaps<CR>";
|
||||
"fg" = "<cmd>Telescope git_files<CR>";
|
||||
|
||||
"gr" = "<cmd>Telescope lsp_references<CR>";
|
||||
"gI" = "<cmd>Telescope lsp_implementations<CR>";
|
||||
"gW" = "<cmd>Telescope lsp_workspace_symbols<CR>";
|
||||
"gF" = "<cmd>Telescope lsp_document_symbols<CR>";
|
||||
"ge" = "<cmd>Telescope diagnostics bufnr=0<CR>";
|
||||
"gE" = "<cmd>Telescope diagnostics<CR>";
|
||||
|
||||
"<leader>h" = {
|
||||
action = "<cmd>lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())<CR>";
|
||||
options = {
|
||||
desc = "toggle inlay hints";
|
||||
};
|
||||
};
|
||||
"yH" = {
|
||||
action = "<Cmd>Telescope yank_history<CR>";
|
||||
options.desc = "history";
|
||||
};
|
||||
"<leader>wS" = {
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
require('telescope.builtin').live_grep({
|
||||
cwd = "~/wiki",
|
||||
glob_pattern = "*.md"
|
||||
})
|
||||
end
|
||||
'';
|
||||
options.desc = "search in wiki";
|
||||
};
|
||||
"<leader>Y" = {
|
||||
action = helpers.mkRaw ''
|
||||
function ()
|
||||
vim.go.operatorfunc = "v:lua.osc52_yank_cb";
|
||||
local yank = require('vim.ui.clipboard.osc52').copy('+')
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "yank through osc52";
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
++ [
|
||||
{
|
||||
key = "<leader>rn";
|
||||
mode = [ "n" ];
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end
|
||||
'';
|
||||
options.expr = true;
|
||||
}
|
||||
];
|
||||
|
||||
plugins.nvim-osc52 = {
|
||||
enable = true;
|
||||
package = pkgs.vimPlugins.nvim-osc52;
|
||||
keymaps.enable = true;
|
||||
};
|
||||
|
||||
plugins.gitsigns.enable = true;
|
||||
plugins.gitmessenger.enable = true;
|
||||
|
||||
# plugins.firenvim.enable = false;
|
||||
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
ui-select.enable = true;
|
||||
};
|
||||
settings = {
|
||||
defaults.layout_strategy = "vertical";
|
||||
};
|
||||
};
|
||||
|
||||
extraFiles."queries/rust/injections.scm".text = ''
|
||||
;; extends
|
||||
|
||||
(call_expression
|
||||
function: ((identifier) @_func (#eq? @_func "JS"))
|
||||
arguments: (arguments (raw_string_literal (string_content) @injection.content))
|
||||
(#set! injection.language "javascript"))
|
||||
|
||||
(token_tree
|
||||
(identifier) @_func (#eq? @_func "JS")
|
||||
(token_tree (raw_string_literal (string_content) @injection.content))
|
||||
(#set! injection.language "javascript"))
|
||||
'';
|
||||
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
indent.enable = true;
|
||||
highlight.enable = true;
|
||||
};
|
||||
|
||||
nixvimInjections = true;
|
||||
|
||||
grammarPackages = with config.plugins.treesitter.package.passthru.builtGrammars; [
|
||||
arduino
|
||||
asm
|
||||
bash
|
||||
bitbake
|
||||
c
|
||||
cpp
|
||||
cuda
|
||||
dart
|
||||
devicetree
|
||||
diff
|
||||
dockerfile
|
||||
editorconfig
|
||||
fish
|
||||
gitattributes
|
||||
gitcommit
|
||||
gitignore
|
||||
git_rebase
|
||||
groovy
|
||||
html
|
||||
ini
|
||||
javascript
|
||||
json
|
||||
just
|
||||
lalrpop
|
||||
latex
|
||||
linkerscript
|
||||
lua
|
||||
make
|
||||
markdown
|
||||
markdown_inline
|
||||
mermaid
|
||||
meson
|
||||
ninja
|
||||
nix
|
||||
printf
|
||||
python
|
||||
regex
|
||||
rst
|
||||
rust
|
||||
slint
|
||||
sql
|
||||
tlaplus
|
||||
toml
|
||||
typst
|
||||
vim
|
||||
vimdoc
|
||||
xml
|
||||
yaml
|
||||
zig
|
||||
];
|
||||
};
|
||||
|
||||
plugins.treesitter-refactor = {
|
||||
enable = true;
|
||||
highlightDefinitions = {
|
||||
enable = true;
|
||||
clearOnCursorMove = true;
|
||||
};
|
||||
smartRename = {
|
||||
enable = true;
|
||||
};
|
||||
navigation = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
plugins.treesitter-context = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.vim-matchup = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
include_match_words = true;
|
||||
};
|
||||
enable = true;
|
||||
};
|
||||
plugins.headerguard.enable = true;
|
||||
|
||||
plugins.comment = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.plantuml-syntax.enable = true;
|
||||
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
scope = {
|
||||
enabled = true;
|
||||
|
||||
show_start = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
plugins.typst-vim.enable = true;
|
||||
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.trouble = {
|
||||
enable = true;
|
||||
lazyLoad.settings.cmd = "Trouble";
|
||||
};
|
||||
|
||||
plugins.noice = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
messages = {
|
||||
view = "mini";
|
||||
view_error = "mini";
|
||||
view_warn = "mini";
|
||||
};
|
||||
|
||||
lsp.override = {
|
||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||
"vim.lsp.util.stylize_markdown" = true;
|
||||
"cmp.entry.get_documentation" = true;
|
||||
};
|
||||
presets = {
|
||||
bottom_search = true;
|
||||
command_palette = true;
|
||||
long_message_to_split = true;
|
||||
inc_rename = true;
|
||||
lsp_doc_border = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
plugins.openscad = {
|
||||
enable = false;
|
||||
settings = {
|
||||
load_snippets = true;
|
||||
};
|
||||
};
|
||||
|
||||
plugins.snacks.enable = true;
|
||||
|
||||
extraConfigLuaPre = lib.mkBefore ''
|
||||
if vim.env.PROF then
|
||||
require("snacks.profiler").startup({
|
||||
startup = {
|
||||
event = "VimEnter"
|
||||
}
|
||||
})
|
||||
end
|
||||
'';
|
||||
|
||||
extraConfigLuaPost = ''
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
|
||||
require("cmp_git").setup({})
|
||||
|
||||
-- debug.sethook(function()
|
||||
-- local file = io.open("/home/traxys/nvim_bt", "a")
|
||||
-- file:write(debug.traceback("backtrace"))
|
||||
-- file:close()
|
||||
-- end, "c", 43)
|
||||
'';
|
||||
|
||||
plugins.which-key.enable = true;
|
||||
|
||||
plugins.leap.enable = true;
|
||||
|
||||
plugins.yanky = {
|
||||
enable = true;
|
||||
settings.picker.telescope = {
|
||||
useDefaultMappings = true;
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
files."ftplugin/nix.lua" = {
|
||||
opts = {
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
expandtab = true;
|
||||
};
|
||||
extraConfigLua = ''
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
'';
|
||||
};
|
||||
|
||||
files."ftdetect/sql.lua" = {
|
||||
globals.omni_sql_no_default_maps = 0;
|
||||
globals.omni_sql_default_compl_type = "syntax";
|
||||
};
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# sca2d
|
||||
djlint
|
||||
muon
|
||||
gh
|
||||
];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
telescope-ui-select-nvim
|
||||
vim-snippets
|
||||
vim-just
|
||||
ltex_extra-nvim
|
||||
vim-wakatime
|
||||
];
|
||||
}
|
||||
|
|
@ -1,469 +1,49 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
helpers,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{ inputs, self, ... }:
|
||||
{
|
||||
imports = [
|
||||
./lsp.nix
|
||||
./notes.nix
|
||||
./completion.nix
|
||||
|
||||
./modules/commands.nix
|
||||
|
||||
./plugins/headerguard.nix
|
||||
./plugins/lsp-signature.nix
|
||||
./plugins/diagram-nvim.nix
|
||||
inputs.nixvim.flakeModules.default
|
||||
];
|
||||
|
||||
colorschemes.tokyonight = {
|
||||
settings.style = "night";
|
||||
enable = true;
|
||||
nixvim = {
|
||||
packages.enable = true;
|
||||
checks.enable = true;
|
||||
};
|
||||
|
||||
plugins.mini = {
|
||||
enable = true;
|
||||
modules.icons = { };
|
||||
mockDevIcons = true;
|
||||
};
|
||||
|
||||
performance = {
|
||||
byteCompileLua = {
|
||||
enable = true;
|
||||
nvimRuntime = true;
|
||||
configs = true;
|
||||
plugins = true;
|
||||
flake.nixvimModules = {
|
||||
config = import ./config { flake = self; };
|
||||
plugins = import ./plugins {
|
||||
inherit (inputs) vim-headerguard;
|
||||
};
|
||||
combinePlugins = {
|
||||
enable = true;
|
||||
standalonePlugins = [
|
||||
"vimplugin-treesitter-grammar-nix"
|
||||
"nvim-treesitter"
|
||||
"openscad.nvim"
|
||||
"yanky.nvim"
|
||||
modules = ./modules;
|
||||
|
||||
neovimTraxys = {
|
||||
imports = [
|
||||
self.nixvimModules.config
|
||||
self.nixvimModules.plugins
|
||||
self.nixvimModules.modules
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
plugins.lz-n.enable = true;
|
||||
|
||||
autoGroups.BigFileOptimizer = { };
|
||||
autoCmd = [
|
||||
perSystem =
|
||||
{
|
||||
event = "BufReadPost";
|
||||
pattern = [
|
||||
"*.md"
|
||||
"*.rs"
|
||||
"*.lua"
|
||||
"*.sh"
|
||||
"*.bash"
|
||||
"*.zsh"
|
||||
"*.js"
|
||||
"*.jsx"
|
||||
"*.ts"
|
||||
"*.tsx"
|
||||
"*.c"
|
||||
".h"
|
||||
"*.cc"
|
||||
".hh"
|
||||
"*.cpp"
|
||||
".cph"
|
||||
];
|
||||
group = "BigFileOptimizer";
|
||||
callback = helpers.mkRaw ''
|
||||
function(auEvent)
|
||||
local bufferCurrentLinesCount = vim.api.nvim_buf_line_count(0)
|
||||
|
||||
if bufferCurrentLinesCount > 2048 then
|
||||
vim.notify("bigfile: disabling features", vim.log.levels.WARN)
|
||||
|
||||
vim.cmd("TSBufDisable refactor.highlight_definitions")
|
||||
vim.g.matchup_matchparen_enabled = 0
|
||||
require("nvim-treesitter.configs").setup({
|
||||
matchup = {
|
||||
enable = false
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
globals = {
|
||||
neo_tree_remove_legacy_commands = 1;
|
||||
mapleader = " ";
|
||||
};
|
||||
|
||||
opts = {
|
||||
termguicolors = true;
|
||||
number = true;
|
||||
tabstop = 4;
|
||||
shiftwidth = 4;
|
||||
scrolloff = 7;
|
||||
signcolumn = "yes";
|
||||
cmdheight = 2;
|
||||
pumheight = 15;
|
||||
cot = [
|
||||
"menu"
|
||||
"menuone"
|
||||
"noselect"
|
||||
];
|
||||
updatetime = 100;
|
||||
colorcolumn = "100";
|
||||
# Too many false positives
|
||||
spell = false;
|
||||
listchars = "tab:>-,lead:·,nbsp:␣,trail:•";
|
||||
fsync = true;
|
||||
|
||||
timeout = true;
|
||||
timeoutlen = 300;
|
||||
};
|
||||
|
||||
commands = {
|
||||
"SpellFr" = "setlocal spelllang=fr";
|
||||
};
|
||||
|
||||
filetype = {
|
||||
filename = {
|
||||
Jenkinsfile = "groovy";
|
||||
};
|
||||
extension = {
|
||||
lalrpop = "lalrpop";
|
||||
};
|
||||
};
|
||||
|
||||
keymaps =
|
||||
let
|
||||
modeKeys =
|
||||
mode:
|
||||
lib.attrsets.mapAttrsToList (
|
||||
key: action:
|
||||
{ inherit key mode; } // (if builtins.isString action then { inherit action; } else action)
|
||||
);
|
||||
nm = modeKeys [ "n" ];
|
||||
in
|
||||
helpers.keymaps.mkKeymaps { options.silent = true; } (nm {
|
||||
"ft" = "<cmd>Neotree<CR>";
|
||||
"fG" = "<cmd>Neotree git_status<CR>";
|
||||
"fR" = "<cmd>Neotree remote<CR>";
|
||||
"fc" = "<cmd>Neotree close<CR>";
|
||||
"bp" = "<cmd>Telescope buffers<CR>";
|
||||
|
||||
"<C-s>" = "<cmd>Telescope spell_suggest<CR>";
|
||||
"mk" = "<cmd>Telescope keymaps<CR>";
|
||||
"fg" = "<cmd>Telescope git_files<CR>";
|
||||
|
||||
"gr" = "<cmd>Telescope lsp_references<CR>";
|
||||
"gI" = "<cmd>Telescope lsp_implementations<CR>";
|
||||
"gW" = "<cmd>Telescope lsp_workspace_symbols<CR>";
|
||||
"gF" = "<cmd>Telescope lsp_document_symbols<CR>";
|
||||
"ge" = "<cmd>Telescope diagnostics bufnr=0<CR>";
|
||||
"gE" = "<cmd>Telescope diagnostics<CR>";
|
||||
|
||||
"<leader>h" = {
|
||||
action = "<cmd>lua vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())<CR>";
|
||||
options = {
|
||||
desc = "toggle inlay hints";
|
||||
system,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixvimConfigurations = {
|
||||
neovimTraxys = inputs.nixvim.lib.evalNixvim {
|
||||
inherit system;
|
||||
modules = [
|
||||
self.nixvimModules.neovimTraxys
|
||||
{
|
||||
test.warnings = expect: [
|
||||
(expect "count" 1)
|
||||
(expect "any" "As of Neovim 0.10, native support for OSC52 has been added.")
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
"yH" = {
|
||||
action = "<Cmd>Telescope yank_history<CR>";
|
||||
options.desc = "history";
|
||||
};
|
||||
"<leader>wS" = {
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
require('telescope.builtin').live_grep({
|
||||
cwd = "~/wiki",
|
||||
glob_pattern = "*.md"
|
||||
})
|
||||
end
|
||||
'';
|
||||
options.desc = "search in wiki";
|
||||
};
|
||||
"<leader>Y" = {
|
||||
action = helpers.mkRaw ''
|
||||
function ()
|
||||
vim.go.operatorfunc = "v:lua.osc52_yank_cb";
|
||||
local yank = require('vim.ui.clipboard.osc52').copy('+')
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "yank through osc52";
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
++ [
|
||||
{
|
||||
key = "<leader>rn";
|
||||
mode = [ "n" ];
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end
|
||||
'';
|
||||
options.expr = true;
|
||||
}
|
||||
];
|
||||
|
||||
plugins.nvim-osc52 = {
|
||||
enable = true;
|
||||
package = pkgs.vimPlugins.nvim-osc52;
|
||||
keymaps.enable = true;
|
||||
};
|
||||
|
||||
plugins.gitsigns.enable = true;
|
||||
plugins.gitmessenger.enable = true;
|
||||
|
||||
# plugins.firenvim.enable = false;
|
||||
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
ui-select.enable = true;
|
||||
};
|
||||
settings = {
|
||||
defaults.layout_strategy = "vertical";
|
||||
};
|
||||
};
|
||||
|
||||
extraFiles."queries/rust/injections.scm".text = ''
|
||||
;; extends
|
||||
|
||||
(call_expression
|
||||
function: ((identifier) @_func (#eq? @_func "JS"))
|
||||
arguments: (arguments (raw_string_literal (string_content) @injection.content))
|
||||
(#set! injection.language "javascript"))
|
||||
|
||||
(token_tree
|
||||
(identifier) @_func (#eq? @_func "JS")
|
||||
(token_tree (raw_string_literal (string_content) @injection.content))
|
||||
(#set! injection.language "javascript"))
|
||||
'';
|
||||
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
indent.enable = true;
|
||||
highlight.enable = true;
|
||||
};
|
||||
|
||||
nixvimInjections = true;
|
||||
|
||||
grammarPackages = with config.plugins.treesitter.package.passthru.builtGrammars; [
|
||||
arduino
|
||||
asm
|
||||
bash
|
||||
bitbake
|
||||
c
|
||||
cpp
|
||||
cuda
|
||||
dart
|
||||
devicetree
|
||||
diff
|
||||
dockerfile
|
||||
editorconfig
|
||||
fish
|
||||
gitattributes
|
||||
gitcommit
|
||||
gitignore
|
||||
git_rebase
|
||||
groovy
|
||||
html
|
||||
ini
|
||||
javascript
|
||||
json
|
||||
just
|
||||
lalrpop
|
||||
latex
|
||||
linkerscript
|
||||
lua
|
||||
make
|
||||
markdown
|
||||
markdown_inline
|
||||
mermaid
|
||||
meson
|
||||
ninja
|
||||
nix
|
||||
printf
|
||||
python
|
||||
regex
|
||||
rst
|
||||
rust
|
||||
slint
|
||||
sql
|
||||
tlaplus
|
||||
toml
|
||||
typst
|
||||
vim
|
||||
vimdoc
|
||||
xml
|
||||
yaml
|
||||
zig
|
||||
];
|
||||
};
|
||||
|
||||
plugins.treesitter-refactor = {
|
||||
enable = true;
|
||||
highlightDefinitions = {
|
||||
enable = true;
|
||||
clearOnCursorMove = true;
|
||||
};
|
||||
smartRename = {
|
||||
enable = true;
|
||||
};
|
||||
navigation = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
plugins.treesitter-context = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.vim-matchup = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
include_match_words = true;
|
||||
};
|
||||
enable = true;
|
||||
};
|
||||
plugins.headerguard.enable = true;
|
||||
|
||||
plugins.comment = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.plantuml-syntax.enable = true;
|
||||
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
scope = {
|
||||
enabled = true;
|
||||
|
||||
show_start = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
plugins.typst-vim.enable = true;
|
||||
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
plugins.trouble = {
|
||||
enable = true;
|
||||
lazyLoad.settings.cmd = "Trouble";
|
||||
};
|
||||
|
||||
plugins.noice = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
messages = {
|
||||
view = "mini";
|
||||
view_error = "mini";
|
||||
view_warn = "mini";
|
||||
};
|
||||
|
||||
lsp.override = {
|
||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||
"vim.lsp.util.stylize_markdown" = true;
|
||||
"cmp.entry.get_documentation" = true;
|
||||
};
|
||||
presets = {
|
||||
bottom_search = true;
|
||||
command_palette = true;
|
||||
long_message_to_split = true;
|
||||
inc_rename = true;
|
||||
lsp_doc_border = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
plugins.openscad = {
|
||||
enable = false;
|
||||
settings = {
|
||||
load_snippets = true;
|
||||
};
|
||||
};
|
||||
|
||||
plugins.snacks.enable = true;
|
||||
|
||||
extraConfigLuaPre = lib.mkBefore ''
|
||||
if vim.env.PROF then
|
||||
require("snacks.profiler").startup({
|
||||
startup = {
|
||||
event = "VimEnter"
|
||||
}
|
||||
})
|
||||
end
|
||||
'';
|
||||
|
||||
extraConfigLuaPost = ''
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
|
||||
require("cmp_git").setup({})
|
||||
|
||||
-- debug.sethook(function()
|
||||
-- local file = io.open("/home/traxys/nvim_bt", "a")
|
||||
-- file:write(debug.traceback("backtrace"))
|
||||
-- file:close()
|
||||
-- end, "c", 43)
|
||||
'';
|
||||
|
||||
plugins.which-key.enable = true;
|
||||
|
||||
plugins.leap.enable = true;
|
||||
|
||||
plugins.yanky = {
|
||||
enable = true;
|
||||
settings.picker.telescope = {
|
||||
useDefaultMappings = true;
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
files."ftplugin/nix.lua" = {
|
||||
opts = {
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
expandtab = true;
|
||||
};
|
||||
extraConfigLua = ''
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
'';
|
||||
};
|
||||
|
||||
files."ftdetect/sql.lua" = {
|
||||
globals.omni_sql_no_default_maps = 0;
|
||||
globals.omni_sql_default_compl_type = "syntax";
|
||||
};
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# sca2d
|
||||
djlint
|
||||
muon
|
||||
gh
|
||||
];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
telescope-ui-select-nvim
|
||||
vim-snippets
|
||||
vim-just
|
||||
ltex_extra-nvim
|
||||
vim-wakatime
|
||||
];
|
||||
}
|
||||
|
|
|
|||
3
neovim/modules/default.nix
Normal file
3
neovim/modules/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
imports = [ ./commands.nix ];
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
{ inputs, self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
inputs',
|
||||
self',
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
{
|
||||
packages = {
|
||||
neovimTraxys = inputs'.nixvim.legacyPackages.makeNixvimWithModule {
|
||||
module = {
|
||||
imports = [ ./default.nix ];
|
||||
};
|
||||
extraSpecialArgs = {
|
||||
flake = self;
|
||||
};
|
||||
pkgs = pkgs.extend (
|
||||
final: prev:
|
||||
{
|
||||
inherit (inputs'.nixpkgs-ts.legacyPackages) tree-sitter;
|
||||
vimPlugins = prev.vimPlugins.extend (
|
||||
final': prev': {
|
||||
vim-headerguard = prev.vimUtils.buildVimPlugin {
|
||||
pname = "vim-headerguard";
|
||||
src = inputs.vim-headerguard;
|
||||
version = inputs.vim-headerguard.shortRev;
|
||||
};
|
||||
wiki-vim = prev.vimUtils.buildVimPlugin {
|
||||
pname = "wiki.vim";
|
||||
src = inputs."wiki.vim";
|
||||
version = inputs."wiki.vim".shortRev;
|
||||
|
||||
dependencies = with prev'; [
|
||||
plenary-nvim
|
||||
telescope-nvim
|
||||
];
|
||||
};
|
||||
diagram-nvim = prev.vimUtils.buildVimPlugin {
|
||||
pname = "diagram.nvim";
|
||||
src = inputs."diagram.nvim";
|
||||
version = inputs."diagram.nvim".shortRev;
|
||||
|
||||
dependencies = with prev'; [ image-nvim ];
|
||||
};
|
||||
|
||||
nvim-cmp = final'.blink-compat;
|
||||
}
|
||||
);
|
||||
}
|
||||
// self'.packages
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
checks.launch-neovim = inputs.nixvim.lib.${system}.check.mkTestDerivationFromNvim {
|
||||
nvim = self'.packages.neovimTraxys.extend (
|
||||
{ lib, ... }:
|
||||
{
|
||||
test.checkWarnings = false;
|
||||
plugins.image.enable = lib.mkForce false;
|
||||
plugins.diagram-nvim.enable = lib.mkForce false;
|
||||
}
|
||||
);
|
||||
name = "Neovim configuration";
|
||||
};
|
||||
};
|
||||
}
|
||||
8
neovim/plugins/default.nix
Normal file
8
neovim/plugins/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ vim-headerguard }:
|
||||
{
|
||||
imports = [
|
||||
./diagram-nvim.nix
|
||||
(import ./headerguard.nix { inherit vim-headerguard; })
|
||||
./lsp-signature.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
{ vim-headerguard }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
|
|
@ -17,7 +18,21 @@ with lib;
|
|||
cfg = config.plugins.headerguard;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [ vim-headerguard ];
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
vimPlugins = prev.vimPlugins.extend (
|
||||
final': prev': {
|
||||
vim-headerguard = prev.vimUtils.buildVimPlugin {
|
||||
pname = "vim-headerguard";
|
||||
src = vim-headerguard;
|
||||
version = vim-headerguard.shortRev;
|
||||
};
|
||||
}
|
||||
);
|
||||
})
|
||||
];
|
||||
|
||||
extraPlugins = [ pkgs.vimPlugins.vim-headerguard ];
|
||||
|
||||
globals.headerguard_use_cpp_comments = cfg.useCppComment;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue