mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
init nvf
This commit is contained in:
@@ -36,11 +36,13 @@
|
|||||||
nur.url = "github:nix-community/NUR";
|
nur.url = "github:nix-community/NUR";
|
||||||
zen-browser.url =
|
zen-browser.url =
|
||||||
"git+https://git.sr.ht/~canasta/zen-browser-flake/"; # updated flake
|
"git+https://git.sr.ht/~canasta/zen-browser-flake/"; # updated flake
|
||||||
|
nvf.url = "github:notashelf/nvf";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ nixpkgs, ... }: {
|
outputs = inputs@{ nixpkgs, ... }: {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
nixy = # CHANGEME: This should match the 'hostname' in your variables.nix file
|
nixy =
|
||||||
|
# CHANGEME: This should match the 'hostname' in your variables.nix file
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
@@ -55,7 +57,6 @@
|
|||||||
./hosts/laptop/configuration.nix # CHANGEME: change the path to match your host folder
|
./hosts/laptop/configuration.nix # CHANGEME: change the path to match your host folder
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
15
home/programs/nvf/default.nix
Normal file
15
home/programs/nvf/default.nix
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{ inputs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.nvf.homeManagerModules.default
|
||||||
|
./mini.nix
|
||||||
|
./options.nix
|
||||||
|
./languages
|
||||||
|
./snippets
|
||||||
|
./visual.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nvf = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
10
home/programs/nvf/languages/completion.nix
Normal file
10
home/programs/nvf/languages/completion.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
programs.nvf.settings = {
|
||||||
|
vim = {
|
||||||
|
assistant.copilot.cmp.enable = true;
|
||||||
|
assistant.copilot.enable = true;
|
||||||
|
autocomplete.nvim-cmp.enable = true;
|
||||||
|
# autocomplete.nvim-cmp.setupOpts.signature.enabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
76
home/programs/nvf/languages/default.nix
Normal file
76
home/programs/nvf/languages/default.nix
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./completion.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nvf.settings = {
|
||||||
|
vim = {
|
||||||
|
languages = {
|
||||||
|
# Options applied to all languages
|
||||||
|
enableLSP = true;
|
||||||
|
enableFormat = true;
|
||||||
|
enableTreesitter = true;
|
||||||
|
enableExtraDiagnostics = true;
|
||||||
|
enableDAP = true;
|
||||||
|
|
||||||
|
# Languages
|
||||||
|
nix = {
|
||||||
|
enable = true;
|
||||||
|
format = {
|
||||||
|
type = "nixfmt";
|
||||||
|
package = pkgs.nixfmt-rfc-style;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
markdown = {
|
||||||
|
enable = true;
|
||||||
|
lsp.enable = true;
|
||||||
|
format.type = "prettierd";
|
||||||
|
format.enable = false;
|
||||||
|
};
|
||||||
|
ts.enable = true;
|
||||||
|
html.enable = true;
|
||||||
|
css.enable = true;
|
||||||
|
tailwind.enable = true;
|
||||||
|
go.enable = true;
|
||||||
|
bash.enable = true;
|
||||||
|
svelte = {
|
||||||
|
enable = true;
|
||||||
|
lsp.enable = true;
|
||||||
|
treesitter.enable = true;
|
||||||
|
format.enable = true;
|
||||||
|
extraDiagnostics.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
formatOnSave = true;
|
||||||
|
# lspkind.enable = true;
|
||||||
|
trouble.enable = true;
|
||||||
|
# lspSignature.enable = true;
|
||||||
|
otter-nvim.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
debugger = {
|
||||||
|
nvim-dap = {
|
||||||
|
enable = true;
|
||||||
|
ui.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# startPlugins = [ pkgs.vimPlugins.nvim-treesitter.withAllGrammars ];
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = true;
|
||||||
|
addDefaultGrammars = true;
|
||||||
|
autotagHtml = true;
|
||||||
|
# Maybe just install every single one?
|
||||||
|
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||||
|
yaml # Affects obsidian note frontmatter
|
||||||
|
latex
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
29
home/programs/nvf/mini.nix
Normal file
29
home/programs/nvf/mini.nix
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
programs.nvf.settings = {
|
||||||
|
vim = {
|
||||||
|
mini = {
|
||||||
|
icons.enable = true;
|
||||||
|
statusline.enable = true;
|
||||||
|
git.enable = true;
|
||||||
|
diff.enable = true;
|
||||||
|
align.enable = true;
|
||||||
|
notify.enable = true;
|
||||||
|
operators.enable = true;
|
||||||
|
starter.enable = true;
|
||||||
|
comment.enable = true;
|
||||||
|
move.enable = true;
|
||||||
|
pairs.enable = true;
|
||||||
|
splitjoin.enable = true;
|
||||||
|
bracketed.enable = true;
|
||||||
|
indentscope = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts.draw.animation = lib.generators.mkLuaInline ''require("mini.indentscope").gen_animation.none()'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
3
home/programs/nvf/notes/default.nix
Normal file
3
home/programs/nvf/notes/default.nix
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
191
home/programs/nvf/notes/obsidian.nix
Normal file
191
home/programs/nvf/notes/obsidian.nix
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
util,
|
||||||
|
colorScheme',
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
vault_path = "notes/obsidian";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
vim = {
|
||||||
|
notes.obsidian = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
mappings = [ ];
|
||||||
|
log_level = lib.generators.mkLuaInline "vim.log.levels.ERROR";
|
||||||
|
|
||||||
|
workspaces = [
|
||||||
|
{
|
||||||
|
name = "personal";
|
||||||
|
path = "~/${vault_path}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
notes_subdir = "Notes";
|
||||||
|
attachments.img_folder = "Assets";
|
||||||
|
daily_notes = {
|
||||||
|
folder = "Daily";
|
||||||
|
date_format = "%Y-%m-%d";
|
||||||
|
default_tags = [ "daily-notes" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
picker = {
|
||||||
|
name = "fzf-lua";
|
||||||
|
mappings.new = "<C-x>";
|
||||||
|
mappings.insert_link = "<C-l>";
|
||||||
|
tag_mappings.tag_note = "<C-x>";
|
||||||
|
tag_mappings.insert_tag = "<C-l>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# [[this]] type of links
|
||||||
|
preferred_link_style = "wiki";
|
||||||
|
|
||||||
|
disable_frontmatter = false;
|
||||||
|
note_frontmatter_func =
|
||||||
|
lib.generators.mkLuaInline # lua
|
||||||
|
''
|
||||||
|
function (note)
|
||||||
|
if note.title then
|
||||||
|
note:add_alias(note.title)
|
||||||
|
end
|
||||||
|
|
||||||
|
local out = { id = note.id, aliases = note.aliases, tags = note.tags }
|
||||||
|
|
||||||
|
if not note.date then
|
||||||
|
local date = tostring(os.date("%Y-%m-%d"))
|
||||||
|
out.date = date
|
||||||
|
end
|
||||||
|
|
||||||
|
if note.title then
|
||||||
|
out.title = note.title
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Keep existing items
|
||||||
|
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
|
||||||
|
for k, v in pairs(note.metadata) do
|
||||||
|
out[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
note_id_func =
|
||||||
|
lib.generators.mkLuaInline # lua
|
||||||
|
''
|
||||||
|
function(title)
|
||||||
|
local name = ""
|
||||||
|
if title ~= nil then
|
||||||
|
name = title
|
||||||
|
else
|
||||||
|
-- Ask the user for a name
|
||||||
|
name = vim.fn.input("Enter note name: ")
|
||||||
|
if name == "" then
|
||||||
|
-- If no name is given, generate a random one.
|
||||||
|
for _ = 1, 5 do
|
||||||
|
name = name .. string.char(math.random(65, 90))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- transform the name into a valid file name and append the date in ISO 8601 format
|
||||||
|
local suffix = name:gsub(" ", "-"):lower():gsub("[^a-z0-9-æøå]", "")
|
||||||
|
return tostring(os.date("%Y%m%dT%H%M")) .. "-" .. suffix
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
follow_url_func =
|
||||||
|
lib.generators.mkLuaInline # lua
|
||||||
|
''
|
||||||
|
function(url)
|
||||||
|
vim.fn.jobstart({"wl-copy", url})
|
||||||
|
vim.fn.jobstart({"notify-send", "Copied " .. url .. " to clipboard."})
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
follow_img_func =
|
||||||
|
lib.generators.mkLuaInline # lua
|
||||||
|
''
|
||||||
|
function(url)
|
||||||
|
vim.ui.open(url)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
attachments = {
|
||||||
|
img_name_func =
|
||||||
|
lib.generators.mkLuaInline # lua
|
||||||
|
''
|
||||||
|
function()
|
||||||
|
return tostring(os.date("%Y%m%dT%H%M")) .. "-"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ui.hl_groups = with colorScheme'; {
|
||||||
|
ObsidianTodo.fg = base0A;
|
||||||
|
ObsidianDone.fg = base0B;
|
||||||
|
ObsidianRightArrow.fg = base09;
|
||||||
|
# ObsidianTilde.fg = base0F;
|
||||||
|
# ObsidianImportant.fg = base08;
|
||||||
|
ObsidianBullet.fg = base0D;
|
||||||
|
ObsidianRefText.fg = base0E;
|
||||||
|
ObsidianExtLinkIcon.fg = base0E;
|
||||||
|
ObsidianTag.fg = base0C;
|
||||||
|
ObsidianBlockID.fg = base0C;
|
||||||
|
ObsidianHighlightText.bg = base0A;
|
||||||
|
ObsidianHighlightText.fg = base01;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
highlight =
|
||||||
|
with colorScheme';
|
||||||
|
lib.mapAttrs' (name: value: lib.nameValuePair "@markup.heading.${name}.markdown" { fg = value; }) {
|
||||||
|
"1" = base08;
|
||||||
|
"2" = base0A;
|
||||||
|
"3" = base0B;
|
||||||
|
"4" = base0C;
|
||||||
|
"5" = base0D;
|
||||||
|
"6" = base0E;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
(util.mkKeymap "n" "<leader>od" ":ObsidianToday<cr>" "Daily note")
|
||||||
|
(util.mkKeymap "n" "<leader>oD" ":ObsidianDailies<cr>" "Daily note history")
|
||||||
|
|
||||||
|
(util.mkKeymap "n" "<leader>oo" ":ObsidianQuickSwitch<cr>" "Open note")
|
||||||
|
(util.mkKeymap "n" "<leader>os" ":ObsidianSearch<cr>" "Search notes")
|
||||||
|
(util.mkKeymap "n" "<leader>oa" ":ObsidianOpen<cr>" "Open in app")
|
||||||
|
(util.mkKeymap "n" "<leader>or" ":ObsidianRename<cr>" "Rename note")
|
||||||
|
|
||||||
|
(util.mkKeymap "n" "<leader>ob" ":ObsidianBacklinks<cr>" "Backlinks")
|
||||||
|
(util.mkKeymap "n" "<leader>ot" ":ObsidianTags<cr>" "Tags")
|
||||||
|
|
||||||
|
(util.mkKeymap "n" "<leader>op" ":ObsidianPasteImg<cr>" "Paste image")
|
||||||
|
];
|
||||||
|
|
||||||
|
utility.images.image-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
backend = "kitty";
|
||||||
|
integrations.markdown = {
|
||||||
|
enabled = true;
|
||||||
|
only_render_image_at_cursor = true;
|
||||||
|
download_remote_images = true;
|
||||||
|
clear_in_insert_mode = true;
|
||||||
|
resolve_image_path =
|
||||||
|
lib.generators.mkLuaInline # lua
|
||||||
|
''
|
||||||
|
function(document_path, image_path, fallback)
|
||||||
|
if string.find(document_path, "${vault_path}") then
|
||||||
|
return os.getenv("HOME") .. "/${vault_path}/" .. image_path
|
||||||
|
else
|
||||||
|
return fallback(document_path, image_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
60
home/programs/nvf/options.nix
Normal file
60
home/programs/nvf/options.nix
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
programs.nvf.settings = {
|
||||||
|
vim = {
|
||||||
|
useSystemClipboard = true;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
# 2-space indents
|
||||||
|
tabstop = 2;
|
||||||
|
softtabstop = 2;
|
||||||
|
shiftwidth = 2;
|
||||||
|
expandtab = true;
|
||||||
|
autoindent = true;
|
||||||
|
smartindent = true;
|
||||||
|
breakindent = true;
|
||||||
|
|
||||||
|
# Searching
|
||||||
|
hlsearch = true;
|
||||||
|
incsearch = true;
|
||||||
|
ignorecase = true;
|
||||||
|
smartcase = true;
|
||||||
|
|
||||||
|
# Splitting
|
||||||
|
splitbelow = true;
|
||||||
|
splitright = true;
|
||||||
|
|
||||||
|
# Undo
|
||||||
|
undofile = true;
|
||||||
|
undolevels = 10000;
|
||||||
|
swapfile = false;
|
||||||
|
backup = false;
|
||||||
|
|
||||||
|
# Disable folding
|
||||||
|
foldlevel = 99;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
termguicolors = true;
|
||||||
|
timeoutlen = 1000;
|
||||||
|
preserveindent = true;
|
||||||
|
showmode = false;
|
||||||
|
scrolloff = 4;
|
||||||
|
conceallevel = 3;
|
||||||
|
cmdheight = 0;
|
||||||
|
sidescrolloff = 4;
|
||||||
|
cursorline = true;
|
||||||
|
linebreak = true;
|
||||||
|
wrap = false;
|
||||||
|
writebackup = false;
|
||||||
|
encoding = "utf-8";
|
||||||
|
fileencoding = "utf-8";
|
||||||
|
signcolumn = "yes";
|
||||||
|
fillchars = "eob: "; # Disable the "~" chars at end of buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
tex_flavor = "latex";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
57
home/programs/nvf/snippets/default.nix
Normal file
57
home/programs/nvf/snippets/default.nix
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
programs.nvf.settings = {
|
||||||
|
vim = {
|
||||||
|
snippets.luasnip = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
update_events = "TextChanged,TextChangedI";
|
||||||
|
store_selection_keys = "<Tab>";
|
||||||
|
delete_check_events = "TextChanged";
|
||||||
|
enable_autosnippets = true;
|
||||||
|
history = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lazy.plugins.luasnip.event = "BufEnter";
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<tab>";
|
||||||
|
lua = true;
|
||||||
|
expr = true;
|
||||||
|
action = # lua
|
||||||
|
''
|
||||||
|
function()
|
||||||
|
local ls = require("luasnip")
|
||||||
|
if ls.expand_or_locally_jumpable() then
|
||||||
|
vim.schedule(function()
|
||||||
|
ls.expand_or_jump()
|
||||||
|
end)
|
||||||
|
return "<ignore>"
|
||||||
|
else
|
||||||
|
return vim.api.nvim_replace_termcodes("<tab>", true, true, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<S-tab>";
|
||||||
|
lua = true;
|
||||||
|
action = # lua
|
||||||
|
''
|
||||||
|
function()
|
||||||
|
local ls = require("luasnip")
|
||||||
|
if ls.jumpable(-1) then
|
||||||
|
vim.schedule(function()
|
||||||
|
ls.jump(-1)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
51
home/programs/nvf/visual.nix
Normal file
51
home/programs/nvf/visual.nix
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
programs.nvf.settings.vim = {
|
||||||
|
filetree.neo-tree = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
add_blank_line_at_top = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
telescope = {
|
||||||
|
enable = true;
|
||||||
|
mappings.findFiles = "<leader> ";
|
||||||
|
};
|
||||||
|
ui.noice.enable = true;
|
||||||
|
binds.whichKey.enable = true;
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>e";
|
||||||
|
mode = "n";
|
||||||
|
silent = true;
|
||||||
|
action = ":Neotree toggle<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
visuals = {
|
||||||
|
nvim-web-devicons.enable = true;
|
||||||
|
};
|
||||||
|
theme = {
|
||||||
|
enable = true;
|
||||||
|
name = "base16";
|
||||||
|
base16-colors = {
|
||||||
|
base00 = config.lib.stylix.colors.base00;
|
||||||
|
base01 = config.lib.stylix.colors.base01;
|
||||||
|
base02 = config.lib.stylix.colors.base02;
|
||||||
|
base03 = config.lib.stylix.colors.base03;
|
||||||
|
base04 = config.lib.stylix.colors.base04;
|
||||||
|
base05 = config.lib.stylix.colors.base05;
|
||||||
|
base06 = config.lib.stylix.colors.base06;
|
||||||
|
base07 = config.lib.stylix.colors.base07;
|
||||||
|
base08 = config.lib.stylix.colors.base08;
|
||||||
|
base09 = config.lib.stylix.colors.base09;
|
||||||
|
base0A = config.lib.stylix.colors.base0A;
|
||||||
|
base0B = config.lib.stylix.colors.base0B;
|
||||||
|
base0C = config.lib.stylix.colors.base0C;
|
||||||
|
base0D = config.lib.stylix.colors.base0D;
|
||||||
|
base0E = config.lib.stylix.colors.base0E;
|
||||||
|
base0F = config.lib.stylix.colors.base0F;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user