more nvim config

This commit is contained in:
Vivian 2024-03-21 14:41:17 +01:00
parent 586f01ac58
commit 123fd7b129
10 changed files with 171 additions and 61 deletions

View file

@ -30,7 +30,6 @@ in {
mattermost-desktop mattermost-desktop
mullvad-vpn mullvad-vpn
neofetch neofetch
nixfmt
nixpkgs-review nixpkgs-review
plex-media-player plex-media-player
plexamp plexamp
@ -77,8 +76,11 @@ in {
enable = true; enable = true;
profiles.default = { isDefault = true; }; profiles.default = { isDefault = true; };
}; };
kitty = {
enable = true;
shellIntegration.enableZshIntegration = true;
};
}; };
# Syncthing # Syncthing
services.syncthing.enable = true; services.syncthing.enable = true;
xdg.userDirs = let home = config.home.homeDirectory; xdg.userDirs = let home = config.home.homeDirectory;

View file

@ -1,6 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
let cfg = config.themes.v.catppuccin; let
cfg = config.themes.v.catppuccin;
in { in {
options.themes.v.catppuccin = { enable = mkEnableOption "catppuccin"; }; options.themes.v.catppuccin = { enable = mkEnableOption "catppuccin"; };
config = let config = let
@ -13,6 +14,9 @@ in {
package = pkgs.bibata-cursors-translucent; package = pkgs.bibata-cursors-translucent;
}; };
programs.kitty.theme = "Catppuccin-Frappe";
programs.kitty.font.name = "DejaVuSansMono Nerd Font";
gtk = { gtk = {
enable = true; enable = true;
theme = { theme = {

View file

@ -1,3 +1,3 @@
{ ... }: { { ... }: {
imports = [ ./catppuccin.nix ./nvim ./riff.nix ./vscode.nix ./git.nix ./rust.nix ]; imports = [ ./catppuccin ./nvim ./riff.nix ./vscode.nix ./git.nix ./rust.nix ];
} }

View file

@ -1,12 +1,20 @@
{ config, pkgs, lib, ... }: {
let cfg = config.programs.v.nvim; config,
in with lib; { pkgs,
options.programs.v.nvim = { enable = mkEnableOption "nvim"; }; lib,
...
}:
let
cfg = config.programs.v.nvim;
in
with lib;
{
options.programs.v.nvim = {
enable = mkEnableOption "nvim";
};
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ fd ]; home.packages = with pkgs; [ fd ];
home.file.".config/nvim/lua/startup/themes/my_theme.lua" = { home.file.".config/nvim/lua".source = ./lua;
source = ./dashboard.lua;
};
programs.nixvim = { programs.nixvim = {
enable = true; enable = true;
package = pkgs.neovim-unwrapped; package = pkgs.neovim-unwrapped;
@ -55,16 +63,22 @@ in with lib; {
key = "<leader>fr"; key = "<leader>fr";
action = ":Telescope frecency<CR>"; action = ":Telescope frecency<CR>";
} }
{
mode = "n";
key = "<leader>ob";
action = "require('obsidian_picker').obsidian_picker";
lua = true;
}
# Commenting # Commenting
{ {
mode = "n"; mode = "n";
key = "<C-_>"; key = "<C-/>";
action = "require('Comment.api').toggle.linewise.current"; action = "require('Comment.api').toggle.linewise.current";
lua = true; lua = true;
} }
{ {
mode = "x"; mode = "x";
key = "<C-_>"; key = "<C-/>";
action = '' action = ''
function() function()
local esc = vim.api.nvim_replace_termcodes( local esc = vim.api.nvim_replace_termcodes(
@ -138,8 +152,7 @@ in with lib; {
mode = "n"; mode = "n";
key = "<leader>nf"; key = "<leader>nf";
lua = true; lua = true;
action = action = "function() require('neotest').run.run(vim.fn.expand('%')) end";
"function() require('neotest').run.run(vim.fn.expand('%')) end";
} }
# LSP # LSP
{ {
@ -162,6 +175,9 @@ in with lib; {
extraConfigLua = ""; extraConfigLua = "";
plugins = { plugins = {
image = {
enable = true;
};
bufferline.enable = true; bufferline.enable = true;
nix.enable = true; nix.enable = true;
luasnip.enable = true; luasnip.enable = true;
@ -170,7 +186,6 @@ in with lib; {
enable = true; enable = true;
theme = "my_theme"; theme = "my_theme";
}; };
none-ls.enable = false;
obsidian = { obsidian = {
enable = true; enable = true;
settings = { settings = {
@ -219,7 +234,9 @@ in with lib; {
ignoreDoneAlready = true; ignoreDoneAlready = true;
ignore = [ "ltex" ]; ignore = [ "ltex" ];
}; };
notification = { overrideVimNotify = true; }; notification = {
overrideVimNotify = true;
};
}; };
neotest = { neotest = {
enable = true; enable = true;
@ -252,8 +269,20 @@ in with lib; {
extensions.fzf-native.enable = true; extensions.fzf-native.enable = true;
extensions.fzf-native.fuzzy = true; extensions.fzf-native.fuzzy = true;
extensions.frecency.enable = true; extensions.frecency.enable = true;
extraOptions = { };
}; };
comment-nvim.enable = true; comment-nvim.enable = true;
none-ls = {
enable = true;
sources = {
formatting = {
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
};
};
};
lsp = { lsp = {
enable = true; enable = true;
keymaps = { keymaps = {
@ -274,6 +303,7 @@ in with lib; {
nil_ls.enable = true; nil_ls.enable = true;
dockerls.enable = true; dockerls.enable = true;
rust-analyzer = { rust-analyzer = {
enable = true;
installCargo = false; installCargo = false;
installRustc = false; installRustc = false;
}; };
@ -285,12 +315,15 @@ in with lib; {
enabled = true; enabled = true;
cache_config = true; cache_config = true;
}; };
pycodestyle = { maxLineLength = 100; }; pycodestyle = {
maxLineLength = 100;
};
}; };
}; };
elixirls.enable = true; elixirls.enable = true;
clangd.enable = true; clangd.enable = true;
yamlls.enable = true; yamlls.enable = true;
lua-ls.enable = true;
}; };
}; };
trouble.enable = true; trouble.enable = true;
@ -306,13 +339,11 @@ in with lib; {
enable = true; enable = true;
autoEnableSources = true; autoEnableSources = true;
settings = { settings = {
snippet.expand = cmdline.":".sources = [ { name = "path"; } ];
"function(args) require('luasnip').lsp_expand(args.body) end"; snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
mapping = { mapping = {
"<S-Tab>" = "<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; "<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<Tab>" =
"cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<CR>" = "cmp.mapping.confirm({ select = true })"; "<CR>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()"; "<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()"; "<C-e>" = "cmp.mapping.close()";

View file

@ -0,0 +1,44 @@
local pickers = require "telescope.pickers"
local finders = require "telescope.finders"
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local obsidian_commands = require("obsidian.commands").commands
local results = {}
for key, _ in pairs(obsidian_commands) do
table.insert(results, string.sub(key, 9))
end
local obsidian_picker = function(opts)
opts = opts or require("telescope.themes").get_dropdown{}
pickers.new(opts, {
prompt_title = "Obsidian",
finder = finders.new_table {
results = results,
-- entry_maker = function(entry)
-- return {
-- value = entry,
-- display = entry[1],
-- ordinal = entry[1],
-- }
-- end
},
sorter = conf.generic_sorter(opts),
attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
vim.cmd(':Obsidian' .. selection[1])
end)
return true
end,
}):find()
end
-- obsidian_picker()
return {
obsidian_picker = obsidian_picker
}

View file

@ -0,0 +1,35 @@
local pickers = require "telescope.pickers"
local finders = require "telescope.finders"
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local obsidian_commands = require("obsidian.commands").commands
local results = {}
for key, _ in pairs(obsidian_commands) do
table.insert(results, string.sub(key, 9))
end
local obsidian_picker = function(opts)
opts = opts or require("telescope.themes").get_dropdown {}
pickers.new(opts, {
prompt_title = "Obsidian",
finder = finders.new_table {
results = results,
},
sorter = conf.generic_sorter(opts),
attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
vim.cmd(':Obsidian' .. selection[1])
end)
return true
end,
}):find()
end
return {
obsidian_picker = obsidian_picker
}

View file

@ -1,4 +1,4 @@
{ lib, ... }: { lib, pkgs, ... }:
with lib.hm.gvariant; with lib.hm.gvariant;
let let
@ -120,7 +120,7 @@ in {
} // generate_custom_keybindings { } // generate_custom_keybindings {
"terminal" = { "terminal" = {
binding = "<Super>Return"; binding = "<Super>Return";
command = "kgx"; command = "${pkgs.kitty}/bin/kitty";
name = "Open Terminal"; name = "Open Terminal";
}; };
"firefox" = { "firefox" = {

54
flake.lock generated
View file

@ -764,11 +764,11 @@
"systems": "systems_10" "systems": "systems_10"
}, },
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1710146030,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -840,11 +840,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703887061, "lastModified": 1709087332,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "gitignore.nix", "repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -918,11 +918,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1710714957, "lastModified": 1710820906,
"narHash": "sha256-eZCxuF58YWgaJMMRrn8oRkwRhxooe5kBS/s2wRVr9PA=", "narHash": "sha256-2bNMraoRB4pdw/HtxgYTFeMhEekBZeQ53/a8xkqpbZc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "7b3fca5adcf6c709874a8f2e0c364fe9c58db989", "rev": "022464438a85450abb23d93b91aa82e0addd71fb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -944,11 +944,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1710754079, "lastModified": 1710837180,
"narHash": "sha256-i2GEmGDjFP8K86x5OcH0JbCoYZqLW5H+P866pVTSxU4=", "narHash": "sha256-WVkLclGrUliLJUl+XaJplo09VdxyqHxZtkEmmDW2QYY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lanzaboote", "repo": "lanzaboote",
"rev": "67dbf85b7c35b5e0be476facf1b360b791e4a3ae", "rev": "ded8d23709f94aedb1407bee9e26581f258e9e3a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1393,11 +1393,11 @@
}, },
"nixpkgs_7": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1710803033, "lastModified": 1710861126,
"narHash": "sha256-7sRXMRZPHUbHY9n3unU5/2SxT50MH9uJAFr1vkjiQYc=", "narHash": "sha256-q8fiy9mgUvTAt2OMjiVpQgDlykyGury9Fpsm0jekBfY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c2f60aeadc7af3f832c1ffa86bae06518d227fbf", "rev": "2dcadb7087e38314cebb15af65f8f2a15d2940cc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1408,11 +1408,11 @@
}, },
"nixpkgs_8": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1710631334, "lastModified": 1710806803,
"narHash": "sha256-rL5LSYd85kplL5othxK5lmAtjyMOBg390sGBTb3LRMM=", "narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c75037bbf9093a2acb617804ee46320d6d1fea5a", "rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1449,11 +1449,11 @@
"pre-commit-hooks": "pre-commit-hooks" "pre-commit-hooks": "pre-commit-hooks"
}, },
"locked": { "locked": {
"lastModified": 1710799652, "lastModified": 1710936779,
"narHash": "sha256-TWX1slRN1IQcalrY64ltQUpVhbxGnT0PaIHqNcC0VtY=", "narHash": "sha256-ecYnUzSWqRae10pp7J6ZE2BznTPJ9f8sLiIoDBQtRBw=",
"owner": "pta2002", "owner": "pta2002",
"repo": "nixvim", "repo": "nixvim",
"rev": "975f1ca526e37c9cb9c646399f03613ea77f5ec2", "rev": "4f6e90212c7ec56d7c03611fb86befa313e7f61f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1464,11 +1464,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1710833135, "lastModified": 1710940845,
"narHash": "sha256-vtF350PUNgnQpVSy0EPS5uwza8gIFpaIx9dDk14EWI4=", "narHash": "sha256-hDL4J2VgG0fmCuq+X1M6e7nVp2a5xHl05PfQZlANhkQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "cee2a9bfe726df39af812591e8b17e8a2f319bd5", "rev": "1593636f37dc0b788e75fb843916ce1afd21fcd0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1509,11 +1509,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1708018599, "lastModified": 1710843117,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", "narHash": "sha256-b6iKQeHegzpc697rxTPA3bpwGN3m50eLCgdQOmceFuE=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", "rev": "e8dc1b4fe80c6fcededde7700e6a23bcdf7f3347",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -139,16 +139,10 @@
deploy.packages.${system}.deploy-rs deploy.packages.${system}.deploy-rs
deadnix deadnix
statix statix
# nixfmt
# nixpkgs-fmt
nixUnstable nixUnstable
# nil
vault vault
yamllint yamllint
jq jq
# (vault-push-approle-envs self { })
# (vault-push-approles self { })
# fast-repl
fup-repl fup-repl
]; ];
}; };