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
mullvad-vpn
neofetch
nixfmt
nixpkgs-review
plex-media-player
plexamp
@ -44,7 +43,7 @@ in {
# Enable my own hm modules
themes.v.catppuccin.enable = true;
programs = {
programs = {
v = {
vscode.enable = true;
nvim.enable = true;
@ -77,8 +76,11 @@ in {
enable = true;
profiles.default = { isDefault = true; };
};
kitty = {
enable = true;
shellIntegration.enableZshIntegration = true;
};
};
# Syncthing
services.syncthing.enable = true;
xdg.userDirs = let home = config.home.homeDirectory;

View file

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