From 606e5bed8e2be9a1d68ee69501400406e250005a Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 10 Jul 2025 20:05:30 +0200 Subject: [PATCH] Sync config for all systems --- nix/user/sh.nix | 21 +++++-- nvim/plugins.lua | 148 ++++++++++++++++++++++++++++------------------- 2 files changed, 104 insertions(+), 65 deletions(-) diff --git a/nix/user/sh.nix b/nix/user/sh.nix index 8d0a0b9..f20c75f 100644 --- a/nix/user/sh.nix +++ b/nix/user/sh.nix @@ -50,6 +50,12 @@ HISTCONTROL='erasedups:ignoreboth' HISTIGNORE='&:[ ]*:exit:ls:bg:fg:history:clear' unsetopt beep + + if [[ "$(uname -s)" == "Darwin" ]]; then + export RUSTUP_HOME="$HOME/.rustup" + export CARGO_HOME="$HOME/.cargo" + [ -f "$CARGO_HOME/env" ] && . "$CARGO_HOME/env" + fi; ''; }; @@ -75,7 +81,7 @@ programs.ripgrep.enable = true; programs.btop.enable = true; programs.ranger.enable = true; - + home.packages = with pkgs; [ fd du-dust @@ -83,7 +89,8 @@ ripgrep-all viddy duf - (python3.withPackages (ps: [ ps.llm ps.llm-gemini])) + (python3.withPackages(ps: [ ps.llm ps.llm-gemini ])) + #nerdfonts ]; home.sessionVariables = lib.mkMerge [ { @@ -91,9 +98,15 @@ } ]; - home.shellAliases = lib.mkMerge [ { - open = "explorer.exe ."; + home.shellAliases = lib.mkMerge [ + { lst = "lsd --tree"; } + + # This is the correct way to use lib.mkIf within lib.mkMerge + # (lib.mkIf pkgs.stdenv.targetPlatform.isWindows { + (lib.mkIf (lib.strings.hasSuffix "windows" pkgs.system) { + open = "explorer.exe ."; + }) ]; } diff --git a/nvim/plugins.lua b/nvim/plugins.lua index 3f88df9..a837ebe 100644 --- a/nvim/plugins.lua +++ b/nvim/plugins.lua @@ -36,7 +36,7 @@ cmp.setup({ [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ @@ -101,6 +101,20 @@ local lspconfig = require("lspconfig") -- lspconfig.flow.setup({ capabilities = capabilities }) -- lspconfig.nil_ls.setup({ capabilities = capabilities }) +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true +} + +local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'} +for _, ls in ipairs(language_servers) do + require('lspconfig')[ls].setup({ + capabilities = capabilities + -- you can add other fields for setting up lsp server in this table + }) +end +require('ufo').setup() + require("yanky").setup({ ring = { history_length = 100, @@ -261,71 +275,11 @@ require('gitsigns').setup { }, } -require("obsidian").setup({ - workspaces = { - { - name = "work", - path = "/mnt/c/Users/marti/Documents/notes/Work", - }, - }, - templates = { - folder = "_templates", - date_format = "%Y-%m-%d, %a", - time_format = "%H:%M", - }, - ui = { - checkboxes = { - [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, - [">"] = { char = "", hl_group = "ObsidianRightArrow" }, - ["x"] = { char = "", hl_group = "ObsidianDone" }, - ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, - ["!"] = { char = "", hl_group = "ObsidianImportant" }, - ["?"] = { char = "?", hl_group = "ObsidianImportant" }, - }, - }, - disable_frontmatter = false, - note_frontmatter_func = function(note) - -- Add the title of the note as an alias. - if note.title then - note:add_alias(note.title) - end - - local out = { id = note.id, tags = note.tags } - - -- `note.metadata` contains any manually added fields in the frontmatter. - -- So here we just make sure those fields are kept in the frontmatter. - 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_path_func = function(spec) - -- This is equivalent to the default behavior. - local path = spec.dir / spec.title - return path:with_suffix(".md") - end, - -- daily_notes = { - -- -- Optional, if you keep daily notes in a separate directory. - -- folder = "Journal", - -- -- Optional, if you want to change the date format for the ID of daily notes. - -- date_format = "%Y-%m-%d", - -- -- Optional, default tags to add to each new daily note created. - -- default_tags = { "journal" }, - -- -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' - -- template = "daily.md" - -- }, - -}) - require("conform").setup({ python = {"black"}, rust = {"rustfmt"}, go = {"gofmt"}, }) - require("trouble").setup() require("todo-comments").setup() @@ -345,3 +299,75 @@ end dap.listeners.before.event_exited.dapui_config = function() dapui.close() end + +if vim.fn.has("mac") then + workspaces = { + { + name = "privat", + path = "~/Documents/notes/privat", + }, + { + name = "joplin", + path = "~/Documents/notes/fromjoplin", + }, + } + daily_notes = { + folder = "Journal", + date_format = "%Y-%m-%d", + default_tags = { "journal" }, + template = "daily.md" + } +elseif vim.fn.has("win32") then + workspaces = { + { + name = "work", + path = "/mnt/c/Users/marti/Documents/notes/Work", + }, + { + name = "privat", + path = "/mnt/c/Users/marti/Documents/notes/privat", + }, + } + daily_notes = {} +end + +require("obsidian").setup({ + workspaces = workspaces, + templates = { + folder = "_templates", + date_format = "%Y-%m-%d %a", + time_format = "%H:%M", + }, + ui = { + checkboxes = { + [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, + [">"] = { char = "", hl_group = "ObsidianRightArrow" }, + ["x"] = { char = "", hl_group = "ObsidianDone" }, + ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, + ["!"] = { char = "", hl_group = "ObsidianImportant" }, + ["?"] = { char = "?", hl_group = "ObsidianImportant" } + }, + }, + disable_frontmatter = false, + note_frontmatter_func = function(note) + -- Add the title of the note as an alias. + if note.title then + note:add_alias(note.title) + end + + local out = { id = note.id, tags = note.tags } + + 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_path_func = function(spec) + local path = spec.dir / spec.title + return path:with_suffix(".md") + end, + daily_notes = daily_notes, +})