Compare commits

..

No commits in common. "d6ad8105680fe53708e1705d61a412c4a40b6b7a" and "d4be10dddacf1a120eca310461f2051a0d5ffc6d" have entirely different histories.

28 changed files with 238 additions and 286 deletions

View file

@ -149,7 +149,6 @@ in
# nix # nix
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles") (nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles") (nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
(nom-system-command "nixos-test" "sudo nixos-rebuild test --flake ~/.dotfiles")
manix manix
nix-index nix-index
nix-output-monitor nix-output-monitor

View file

@ -1,90 +1,57 @@
{ config, lib, pkgs, ... }: { config
, lib
, pkgs
, ...
}:
with lib; with lib;
let let
cfg = config.my.programs.nvim; cfg = config.my.programs.nvim;
toLua = value: with builtins; boolToString = bool: if bool then "true" else "false";
if value == null then "nil" else quote = str: ''"${toString str}"'';
if isBool value then boolToString value else id = x: x;
if isInt value || isFloat value then toString value else listToString = sep: f: list: ''{ ${concatStringsSep sep (map f list)} }'';
if isString value then string value else listToStringOneLine = listToString ", ";
if isAttrs value then attrs value else listToStringMultiLine' = listToString ",\n" id;
if isList value then list value else
abort "should never happen (value = ${value})";
string = str: ''"${toString str}"'';
attrs = set:
let
toKeyword = name: value: "${name} = ${toLua value}";
keywords = concatStringsSep ", " (mapAttrsToList toKeyword set);
in
"{ " + keywords + " }";
listContent = values: concatStringsSep ", " (map toLua values);
list = values: "{ " + listContent values + " }";
luaList = values: "{" + (concatStringsSep ", " values) + "}";
keybinding = { key, cmd, func, mode, desc }: keybinding = { key, cmd, func, mode, desc }:
let let
cmdString = cmdString =
if cmd != null then toLua cmd else if cmd != null
if func != null then func else then quote cmd
abort "Either cmd or function must be set"; else
descString = optionalString (desc != null) "desc = ${toLua desc},"; (
if func != null
then func
else abort "Either cmd or function must be set"
);
descString = optionalString (desc != null) "desc = ${quote desc},";
in in
''{ ${toLua key}, ${cmdString}, mode = ${toLua mode}, ${descString} }''; ''{ ${quote key}, ${cmdString}, mode = ${listToStringOneLine quote mode}, ${descString} }'';
lazySpecFromPlugin = lazySpecFromPlugin =
{ cmd { plugin, dependencies, init, conf, lazy, event, enabled, cmd, ft, priority, keys }:
, conf listToStringMultiLine'
, dependencies
, enabled
, event
, ft
, init
, keys
, lazy
, opts
, plugin
, priority
}:
luaList
([ ([
"dir = ${string plugin}" "dir = ${quote plugin}"
"name = ${toLua (getName plugin)}" "name = ${quote (getName plugin)}"
] ]
++ (optional (opts != null) "opts = ${toLua opts}") ++ (optional (lazy != null) "lazy = ${boolToString lazy}")
++ (optional (lazy != null) "lazy = ${toLua lazy}") ++ (optional (!enabled) "enabled = ${boolToString enabled}")
++ (optional (!enabled) "enabled = ${toLua enabled}") ++ (optional (dependencies != [ ]) "dependencies = ${listToStringMultiLine' (map lazySpecFromPlugin dependencies)}")
++ (optional (dependencies != [ ]) "dependencies = ${luaList (map lazySpecFromPlugin dependencies)}") ++ (optional (init != null) "init = function(plugin)\n${toString init}\nend")
++ (optional (init != null) "init = function(plugin)\n${init}\nend") ++ (optional (conf != null) "config = function(plugin, opts)\n${toString conf}\nend")
++ (optional (conf != null) "config = function(plugin, opts)\n${conf}\nend") ++ (optional (keys != [ ]) "keys = ${listToStringMultiLine' (map keybinding keys)}")
++ (optional (keys != [ ]) "keys = ${luaList (map keybinding keys)}") ++ (optional (event != [ ]) "event = ${listToStringOneLine quote event}")
++ (optional (event != [ ]) "event = ${toLua event}") ++ (optional (cmd != [ ]) "cmd = ${listToStringOneLine quote cmd}")
++ (optional (cmd != [ ]) "cmd = ${toLua cmd}") ++ (optional (ft != [ ]) "ft = ${listToStringOneLine quote ft}")
++ (optional (ft != [ ]) "ft = ${toLua ft}") ++ (optional (priority != null) "priority = ${toString priority}")
++ (optional (priority != null) "priority = ${toLua priority}")
); );
lazySpecs = luaList (map lazySpecFromPlugin cfg.plugins); lazySpecs = listToStringMultiLine' (map lazySpecFromPlugin cfg.plugins);
lazy = /* lua */ '' lazy = /* lua */ ''
require("lazy").setup(${lazySpecs}) require("lazy").setup(${lazySpecs})
''; '';
initLua =
let
text = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
in
pkgs.runCommand "init.lua" { inherit text; } ''
touch $out
echo -n "$text" > $out
${getExe pkgs.stylua} $out
'';
in in
{ {
imports = lib.my.listModulesRec ./plugins; imports = [ ./plugins ];
options.my.programs.nvim = { options.my.programs.nvim = {
enable = mkEnableOption "nvim"; enable = mkEnableOption "nvim";
@ -104,27 +71,6 @@ in
Lua function to be executed when the plugin is loaded. Lua function to be executed when the plugin is loaded.
''; '';
}; };
opts = mkOption {
type =
let
valueType = nullOr
(oneOf [
str
bool
int
float
(listOf valueType)
(attrsOf valueType)
]) // {
description = "Lua value";
};
in
nullOr (attrsOf valueType);
default = null;
description = ''
Lua table to be passed to te plugin config function.
'';
};
dependencies = mkOption { dependencies = mkOption {
type = listOf sub; type = listOf sub;
default = [ ]; default = [ ];
@ -249,9 +195,17 @@ in
else neovide else neovide
) )
]; ];
xdg.configFile."nvim/init.lua" = {
xdg.configFile."nvim/init.lua".source = initLua; source =
let
text = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
in
pkgs.runCommand "init.lua" { inherit text; } ''
touch $out
echo -n "$text" > $out
${getExe pkgs.stylua} $out
'';
};
programs.neovim = { programs.neovim = {
enable = true; enable = true;
package = pkgs.neovim-nightly; package = pkgs.neovim-nightly;

View file

@ -0,0 +1,5 @@
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
})
vim.cmd("Copilot disable")

View file

@ -1,24 +1,30 @@
{ pkgs, ... }: { lib, pkgs, ... }:
with builtins; with builtins;
{ {
config.my.programs.nvim.plugins = with pkgs.vimPlugins; [ config.my.programs.nvim.plugins = with pkgs.vimPlugins; [
{
plugin = which-key-nvim;
lazy = false;
conf = readFile ./which-key-nvim.lua;
}
{
plugin = catppuccin-nvim;
conf = readFile ./catppuccin-nvim.lua;
lazy = false;
priority = 99;
}
{ {
plugin = formatter-nvim; plugin = formatter-nvim;
cmd = [ "Format" "Fmt" ];
keys = [ keys = [
{ { key = "="; cmd = "<cmd>Format<cr>"; desc = "format (formatter)"; }
key = "=";
cmd = "<cmd>Format<cr>";
desc = "format (formatter)";
}
]; ];
conf = readFile ./lua/formatter-nvim.lua; conf = readFile ./formatter-nvim.lua;
} }
{ {
plugin = oil-nvim; plugin = oil-nvim;
lazy = false; lazy = false;
opts = { }; conf = readFile ./oil-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; }
@ -27,7 +33,7 @@ with builtins;
{ {
plugin = mini-nvim; plugin = mini-nvim;
lazy = false; lazy = false;
conf = readFile ./lua/mini-nvim.lua; conf = readFile ./mini-nvim.lua;
} }
{ {
plugin = trouble-nvim; plugin = trouble-nvim;
@ -38,35 +44,31 @@ with builtins;
{ key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; } { key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; }
{ key = "<leader>xt"; cmd = "<cmd>TodoTrouble<cr>"; desc = "Todo (Trouble)"; } { key = "<leader>xt"; cmd = "<cmd>TodoTrouble<cr>"; desc = "Todo (Trouble)"; }
{ key = "<leader>xT"; cmd = "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>"; desc = "Todo/Fix/Fixme (Trouble)"; } { key = "<leader>xT"; cmd = "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>"; desc = "Todo/Fix/Fixme (Trouble)"; }
{ key = "<leader>ft"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; } { key = "<leader>st"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
{ {
key = "[q"; key = "[q";
func = /* lua */ '' func = /* lua */ ''function()
function() if require("trouble").is_open() then
if require("trouble").is_open() then require("trouble").previous({ skip_groups = true, jump = true })
require("trouble").previous({ skip_groups = true, jump = true }) else
else vim.cmd.cprev()
vim.cmd.cprev() end
end end'';
end
'';
desc = "Previous trouble/quickfix item"; desc = "Previous trouble/quickfix item";
} }
{ {
key = "]q"; key = "]q";
func = /* lua */ '' func = /* lua */ ''function()
function() if require("trouble").is_open() then
if require("trouble").is_open() then require("trouble").next({ skip_groups = true, jump = true })
require("trouble").next({ skip_groups = true, jump = true }) else
else vim.cmd.cnext()
vim.cmd.cnext() end
end end'';
end
'';
desc = "Next trouble/quickfix item"; desc = "Next trouble/quickfix item";
} }
]; ];
opts = { }; conf = readFile ./trouble-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; }
@ -74,12 +76,14 @@ with builtins;
} }
{ {
plugin = nvim-cmp; plugin = nvim-cmp;
conf = readFile ./lua/nvim-cmp.lua; conf = readFile ./nvim-cmp.lua;
event = [ "InsertEnter" ]; event = [ "InsertEnter" ];
dependencies = [ dependencies = [
{ {
plugin = nvim-autopairs; plugin = nvim-autopairs;
opts = { }; conf = /* lua */ ''
require("nvim-autopairs").setup({})
'';
} }
{ plugin = cmp-async-path; } { plugin = cmp-async-path; }
{ plugin = cmp-buffer; } { plugin = cmp-buffer; }
@ -88,26 +92,55 @@ with builtins;
{ plugin = cmp_luasnip; } { plugin = cmp_luasnip; }
{ {
plugin = codeium-nvim; plugin = codeium-nvim;
opts = { }; conf = /* lua */ ''
require("codeium").setup({})
'';
} }
{ plugin = friendly-snippets; } { plugin = friendly-snippets; }
{ plugin = lspkind-nvim; } { plugin = lspkind-nvim; }
{ plugin = luasnip; } { plugin = luasnip; }
]; ];
} }
{
plugin = todo-comments-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./todo-comments-nvim.lua;
dependencies = [{ plugin = plenary-nvim; }];
}
{ {
plugin = direnv-vim; plugin = direnv-vim;
lazy = false; lazy = false;
} }
{
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
conf =
let
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers);
};
in
readFile ./nvim-treesitter.lua + ''
vim.opt.runtimepath:append("${parserDir}")
require'nvim-treesitter.configs'.setup {
parser_install_dir = "${parserDir}",
}
'';
dependencies = [
{ plugin = nvim-ts-context-commentstring; }
];
}
{ {
plugin = nvim-lspconfig; plugin = nvim-lspconfig;
event = [ "BufRead" "BufNewFile" ]; event = [ "BufRead" "BufNewFile" ];
conf = readFile ./lua/nvim-lspconfig.lua; conf = readFile ./nvim-lspconfig.lua;
dependencies = [ dependencies = [
{ plugin = lsp_signature-nvim; } { plugin = lsp_signature-nvim; }
{ {
plugin = null-ls-nvim; plugin = null-ls-nvim;
conf = readFile ./lua/null-ls-nvim.lua; conf = readFile ./null-ls-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = plenary-nvim; } { plugin = plenary-nvim; }
@ -117,27 +150,36 @@ with builtins;
{ plugin = lsp_lines-nvim; } { plugin = lsp_lines-nvim; }
{ {
plugin = nvim-ufo; plugin = nvim-ufo;
conf = readFile ./lua/nvim-ufo.lua; conf = readFile ./nvim-ufo.lua;
dependencies = [ dependencies = [
{ plugin = promise-async; } { plugin = promise-async; }
]; ];
} }
{ {
plugin = neodev-nvim; plugin = neodev-nvim;
conf = readFile ./lua/neodev-nvim.lua; conf = readFile ./neodev-nvim.lua;
} }
{ {
plugin = inc-rename-nvim; plugin = inc-rename-nvim;
opts = { conf = /* lua */ ''
input_buffer_type = "dressing"; require("inc_rename").setup {
}; input_buffer_type = "dressing",
}
'';
dependencies = [ dependencies = [
{ plugin = dressing-nvim; } {
plugin = dressing-nvim;
}
]; ];
} }
{ plugin = actions-preview-nvim; } { plugin = actions-preview-nvim; }
]; ];
} }
{
plugin = statuscol-nvim;
event = [ "VeryLazy" ];
conf = readFile ./statuscol-nvim.lua;
}
{ {
plugin = vim-fugitive; plugin = vim-fugitive;
cmd = [ cmd = [
@ -170,25 +212,44 @@ with builtins;
plugin = vim-tmux-navigator; plugin = vim-tmux-navigator;
event = [ "VeryLazy" ]; event = [ "VeryLazy" ];
} }
{
plugin = gitsigns-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
{ {
plugin = nvim-lastplace; plugin = nvim-lastplace;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { conf = readFile ./nvim-lastplace.lua;
lastplace_ignore_buftype = [ "quickfix" "nofile" "help" ]; }
lastplace_ignore_filetype = [ "gitcommit" "gitrebase" "svn" "hgcommit" ]; {
lastplace_open_folds = true; plugin = nvim-treesitter-textsubjects;
}; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-treesitter-textsubjects.lua;
}
{
plugin = smartcolumn-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./smartcolumn-nvim.lua;
} }
{ {
plugin = telescope-nvim; plugin = telescope-nvim;
cmd = [ "Telescope" ]; cmd = [ "Telescope" ];
conf = builtins.readFile ./lua/telescope.lua; conf = builtins.readFile ./telescope.lua;
keys = [ keys = [
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; } { key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; } { key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
{ key = "<leader>fl"; cmd = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; desc = "Search lines"; } { key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Find recent files"; }
{ key = "<leader>fg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; } { key = "<leader>sl"; cmd = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; desc = "Search lines"; }
{ key = "<leader>fh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; } { key = "<leader>sg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; }
{ key = "<leader>sc"; cmd = "<cmd>Telescope command_history<cr>"; desc = "Command history"; }
{ key = "<leader>sC"; cmd = "<cmd>Telescope commands<cr>"; desc = "Commands"; }
{ key = "<leader>sd"; cmd = "<cmd>Telescope diagnostics<cr>"; desc = "Diagnostics"; }
{ key = "<leader>sh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; }
{ key = "<leader>sk"; cmd = "<cmd>Telescope keymaps<cr>"; desc = "Keymaps"; }
{ key = "<leader>ss"; cmd = "<cmd>Telescope lsp_document_symbols<cr>"; desc = "Symbols (Document)"; }
{ key = "<leader>sS"; cmd = "<cmd>Telescope lsp_workspace_symbols<cr>"; desc = "Symbols (Workspace)"; }
]; ];
dependencies = [ dependencies = [
{ plugin = plenary-nvim; } { plugin = plenary-nvim; }
@ -199,7 +260,7 @@ with builtins;
{ {
plugin = vim-startuptime; plugin = vim-startuptime;
cmd = [ "StartupTime" ]; cmd = [ "StartupTime" ];
conf = readFile ./lua/vim-startuptime.lua; conf = readFile ./vim-startuptime.lua;
} }
{ {
plugin = typst-vim; plugin = typst-vim;
@ -208,28 +269,47 @@ with builtins;
{ {
plugin = comment-nvim; plugin = comment-nvim;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { }; conf = /* lua */ ''
require("Comment").setup()
'';
} }
{ {
plugin = telekasten-nvim; plugin = telekasten-nvim;
dependencies = [ dependencies = [
{ plugin = telescope-nvim; } { plugin = telescope-nvim; }
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{
plugin = markdown-preview-nvim;
ft = [ "md" ];
}
]; ];
cmd = [ "Telekasten" ]; cmd = [ "Telekasten" ];
keys = [ keys = [
{ key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; } { key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; }
]; ];
conf = builtins.readFile ./lua/zettelkasten-nvim.lua; conf = builtins.readFile ./zettelkasten-nvim.lua;
}
{
plugin = markdown-preview-nvim;
ft = [ "md" ];
} }
{ {
plugin = nvim-surround; plugin = nvim-surround;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { }; conf = /* lua */ ''
require("nvim-surround").setup({})
'';
}
{
plugin = nvim-treesitter-context;
event = [ "BufReadPost" "BufNewFile" ];
conf = /* lua */ ''
require("treesitter-context").setup({})
'';
}
{
plugin = dressing-nvim;
event = [ "VeryLazy" ];
}
{
plugin = hmts-nvim;
ft = [ "nix" ];
} }
{ {
plugin = zen-mode-nvim; plugin = zen-mode-nvim;
@ -264,42 +344,5 @@ with builtins;
} }
]; ];
} }
{
plugin = refactoring-nvim;
keys = [
{ key = "<leader>re"; cmd = ": Refactor eextract "; desc = "Extract"; mode = [ "x" ]; }
{ key = "<leader>rf"; cmd = ": Refactor extract_to_file "; desc = "Extract to file"; mode = [ "x" ]; }
{ key = "<leader>rv"; cmd = ": Refactor extract_var "; desc = "Extract variable"; mode = [ "x" ]; }
{ key = "<leader>ri"; cmd = ": Refactor inline_var"; desc = "Inline variable"; mode = [ "n" "x" ]; }
{ key = "<leader>rI"; cmd = ": Refactor inline_func"; desc = "Inline function"; mode = [ "n" "x" ]; }
{ key = "<leader>rb"; cmd = ": Refactor extract_block"; desc = "Extract block"; mode = [ "n" ]; }
{ key = "<leader>rbf"; cmd = ": Refactor extract_block_to_file"; desc = "Extract block to file"; mode = [ "n" ]; }
];
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
{ plugin = nvim-lspconfig; }
];
init = /* lua */ ''
require("which-key").register({
["<leader>r"] = {
name = "refactoring",
},
})
'';
opts = { };
}
{
plugin = harpoon;
keys = [
{ key = "<leader>ha"; cmd = "<cmd>lua require('harpoon.mark').add_file()<cr>"; desc = "Add file"; }
{ key = "<leader>hh"; cmd = "<cmd>lua require('harpoon.ui').toggle_quick_menu()<cr>"; desc = "Harpoon"; }
{ key = "<leader>h1"; cmd = "<cmd>lua require('harpoon.ui').nav_file(1)<cr>"; desc = "Harpoon file 1"; }
{ key = "<leader>h2"; cmd = "<cmd>lua require('harpoon.ui').nav_file(2)<cr>"; desc = "Harpoon file 2"; }
{ key = "<leader>h3"; cmd = "<cmd>lua require('harpoon.ui').nav_file(3)<cr>"; desc = "Harpoon file 3"; }
{ key = "<leader>h4"; cmd = "<cmd>lua require('harpoon.ui').nav_file(4)<cr>"; desc = "Harpoon file 4"; }
];
opts = { };
}
]; ];
} }

View file

@ -3,6 +3,7 @@ local null_ls = require("null-ls")
null_ls.setup({ null_ls.setup({
sources = { sources = {
-- Code actions -- Code actions
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.code_actions.shellcheck, null_ls.builtins.code_actions.shellcheck,
null_ls.builtins.code_actions.statix, null_ls.builtins.code_actions.statix,
-- Completion -- Completion

View file

@ -0,0 +1,5 @@
require("nvim-lastplace").setup({
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
lastplace_open_folds = true,
})

View file

@ -0,0 +1,4 @@
require("oil").setup()
require("which-key").register({
d = { require("oil").toggle_float, "Directory (oil)" },
}, { prefix = "<leader>t" })

View file

@ -0,0 +1,4 @@
require("smartcolumn").setup({
colorcolumn = "120",
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
})

View file

@ -0,0 +1 @@
require("todo-comments").setup()

View file

@ -1,42 +0,0 @@
{ lib, pkgs, ... }:
with builtins;
{
config.my.programs.nvim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
conf =
let
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers);
};
in
readFile ./lua/nvim-treesitter.lua + ''
vim.opt.runtimepath:append("${parserDir}")
require'nvim-treesitter.configs'.setup {
parser_install_dir = "${parserDir}",
}
'';
dependencies = [
{ plugin = nvim-ts-context-commentstring; }
];
}
{
plugin = nvim-treesitter-textsubjects;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/nvim-treesitter-textsubjects.lua;
}
{
plugin = nvim-treesitter-context;
event = [ "BufReadPost" "BufNewFile" ];
opts = { };
}
{
plugin = hmts-nvim;
ft = [ "nix" ];
}
];
}

View file

@ -0,0 +1 @@
require("trouble").setup()

View file

@ -1,47 +0,0 @@
{ pkgs, ... }:
with builtins;
{
config.my.programs.nvim.plugins = with pkgs.vimPlugins; [
{
plugin = which-key-nvim;
lazy = false;
conf = readFile ./lua/which-key-nvim.lua;
}
{
plugin = catppuccin-nvim;
conf = readFile ./lua/catppuccin-nvim.lua;
lazy = false;
priority = 99;
}
{
plugin = todo-comments-nvim;
event = [ "BufReadPost" "BufNewFile" ];
dependencies = [{ plugin = plenary-nvim; }];
opts = { };
}
{
plugin = statuscol-nvim;
event = [ "VeryLazy" ];
conf = readFile ./lua/statuscol-nvim.lua;
}
{
plugin = smartcolumn-nvim;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
colorcolumn = "120";
disabled_filetypes = [ "help" "text" "markdown" "dashboard" ];
};
}
{
plugin = dressing-nvim;
event = [ "VeryLazy" ];
}
{
plugin = gitsigns-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
];
}

View file

@ -1,16 +1,14 @@
vim.o.timeout = true vim.o.timeout = true
vim.o.timeoutlen = 500 vim.o.timeoutlen = 500
-- Delete -- buffer
require("which-key").register({ require("which-key").register({
d = { b = {
name = "delete", name = "buffer",
b = { "<cmd>bd<cr>", "Delete buffer" }, b = { "<cmd>Telescope buffers<cr>", "List buffers" },
w = { "<C-w>c", "Delete window" }, d = { "<cmd>bd<cr>", "Delete buffer" },
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
-- buffer
require("which-key").register({ require("which-key").register({
["["] = { ["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" }, b = { "<cmd>bprevious<cr>", "Previous buffer" },
@ -27,6 +25,32 @@ require("which-key").register({
["|"] = { "<C-w>v", "Split window horizontally" }, ["|"] = { "<C-w>v", "Split window horizontally" },
["-"] = { "<C-w>s", "Split window vertically" }, ["-"] = { "<C-w>s", "Split window vertically" },
w = { "<C-w>w", "Switch window" }, w = { "<C-w>w", "Switch window" },
d = { "<C-w>c", "Delete window" },
},
}, { prefix = "<leader>" })
-- tab
require("which-key").register({
["<tab>"] = {
name = "tab",
["<tab>"] = { "<cmd>tabnew<cr>", "New tab" },
d = { "<cmd>tabclose<cr>", "Close tab" },
},
}, { prefix = "<leader>" })
require("which-key").register({
["["] = {
t = { "<cmd>tabprevious<cr>", "Previous tab" },
},
["]"] = {
t = { "<cmd>tabnext<cr>", "Next tab" },
},
})
-- file
require("which-key").register({
f = {
name = "file/find",
n = { "<cmd>enew<cr>", "New file" },
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })