From f68ac5a89a35b295a0d446fe77eddfbf17202831 Mon Sep 17 00:00:00 2001 From: js0ny Date: Thu, 20 Nov 2025 21:32:35 +0000 Subject: [PATCH] obsidian, zed --- home/.chezmoiignore.tmpl | 3 + .../nvim/lua/config/colorscheme.lua | 6 +- nixcfgs/.gitignore | 1 + nixcfgs/modules/home/programs/starship.nix | 8 +- nixcfgs/users/js0ny/default.nix | 11 + .../programs/desktop/wayland-wm/packages.nix | 1 + .../users/js0ny/programs/obsidian/default.nix | 14 ++ .../js0ny/programs/obsidian/vimrc-support.nix | 126 ++++++++++ nixcfgs/users/js0ny/programs/zed-editor.nix | 223 +++++++++++++++++- nixcfgs/users/js0ny/zephyrus.nix | 1 + 10 files changed, 386 insertions(+), 8 deletions(-) create mode 100644 nixcfgs/users/js0ny/programs/obsidian/default.nix create mode 100644 nixcfgs/users/js0ny/programs/obsidian/vimrc-support.nix diff --git a/home/.chezmoiignore.tmpl b/home/.chezmoiignore.tmpl index 87afe49..2055f61 100644 --- a/home/.chezmoiignore.tmpl +++ b/home/.chezmoiignore.tmpl @@ -69,6 +69,9 @@ vim:ft=gotmpl .config/rofi .config/waybar .config/ghostty + .config/zed/settings.json + .config/zed/keymap.json + .config/starship.toml .local/share/kio/** .local/share/fonts/** {{ end }} diff --git a/home/dot_config/nvim/lua/config/colorscheme.lua b/home/dot_config/nvim/lua/config/colorscheme.lua index 3df70e9..ff17745 100644 --- a/home/dot_config/nvim/lua/config/colorscheme.lua +++ b/home/dot_config/nvim/lua/config/colorscheme.lua @@ -35,11 +35,9 @@ end if get_system_theme() == 'dark' then vim.o.background = 'dark' - vim.cmd.colorscheme("rose-pine") + vim.cmd.colorscheme("catppuccin-mocha") else vim.o.background = 'light' - vim.cmd.colorscheme("rose-pine") + vim.cmd.colorscheme("catppuccin-latte") end -vim.cmd.colorscheme("rose-pine-moon") - diff --git a/nixcfgs/.gitignore b/nixcfgs/.gitignore index 1046b48..1e9c618 100644 --- a/nixcfgs/.gitignore +++ b/nixcfgs/.gitignore @@ -1 +1,2 @@ secrets # TODO +users/js0ny/programs/desktop/wayland-wm/hyprland/ diff --git a/nixcfgs/modules/home/programs/starship.nix b/nixcfgs/modules/home/programs/starship.nix index d29b113..08a6580 100644 --- a/nixcfgs/modules/home/programs/starship.nix +++ b/nixcfgs/modules/home/programs/starship.nix @@ -1,5 +1,4 @@ {...}: { - catppuccin.starship.enable = false; programs.starship = { enable = true; enableBashIntegration = true; @@ -7,5 +6,12 @@ enableFishIntegration = true; enableNushellIntegration = true; enableIonIntegration = true; + settings = { + character = { + success_symbol = "[[󰄛](green) ❯](peach)"; + error_symbol = "[[󰄛](red) ❯](peach)"; + vimcmd_symbol = "[󰄛 ❮](subtext1)"; # For use with zsh-vi-mode + }; + }; }; } diff --git a/nixcfgs/users/js0ny/default.nix b/nixcfgs/users/js0ny/default.nix index 3ea268d..ed896fa 100644 --- a/nixcfgs/users/js0ny/default.nix +++ b/nixcfgs/users/js0ny/default.nix @@ -19,5 +19,16 @@ in { programs.home-manager.enable = true; + xdg.configFile = { + "nixpkgs/config.nix" = { + text = ''{allowUnfree = true;} ''; + enable = true; + }; + "nix/nix.conf" = { + text = ''use-xdg-base-directories = true ''; + enable = true; + }; + }; + home.sessionVariables.TERMINAL = config.currentUser.defaultTerminal; } diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/packages.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/packages.nix index 3b31d81..5838c51 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/packages.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/packages.nix @@ -54,4 +54,5 @@ in { }; services.cliphist.enable = true; services.dunst.enable = true; + catppuccin.dunst.enable = false; } diff --git a/nixcfgs/users/js0ny/programs/obsidian/default.nix b/nixcfgs/users/js0ny/programs/obsidian/default.nix new file mode 100644 index 0000000..5c9d9a0 --- /dev/null +++ b/nixcfgs/users/js0ny/programs/obsidian/default.nix @@ -0,0 +1,14 @@ +{...}: { + imports = [ + ./vimrc-support.nix + ]; + programs.obsidian = { + enable = true; + vaults."HomeManagerDryRun" = { + enable = true; + target = "HomeManagerDryRun"; # relative to $HOME + settings = { + }; + }; + }; +} diff --git a/nixcfgs/users/js0ny/programs/obsidian/vimrc-support.nix b/nixcfgs/users/js0ny/programs/obsidian/vimrc-support.nix new file mode 100644 index 0000000..74f9ea0 --- /dev/null +++ b/nixcfgs/users/js0ny/programs/obsidian/vimrc-support.nix @@ -0,0 +1,126 @@ +{...}: { + programs.obsidian.defaultSettings = { + extraFiles.".obsidian.vimrc" = { + target = "../.obsidian.vimrc"; + text = '' + " Put this in OBSIDIAN_VAULT/.obsidian.vimrc + set clipboard=unnamed " Sync with System Clipboard + + + + """ Visual mode surrounding + + " {{{ Vim-like Ex commands + exmap write obcommand editor:save-file + exmap w obcommand editor:save-file + exmap quit obcommand workspace:close-tab-group + exmap q obcommand workspace:close-tab-group + exmap bprevious obcommand workspace:previous-tab + exmap bp obcommand workspace:previous-tab + exmap bnext obcommand workspace:next-tab + exmap bn obcommand workspace:next-tab + exmap vsplit obcommand workspace:split-vertical + exmap split obcommand workspace:split-horizontal + exmap wincmdh obcommand editor:focus-left + exmap wincmdi obcommand editor:focus-right + exmap wincmde obcommand editor:focus-top + exmap wincmdn obcommand editor:focus-bottom + exmap bd obcommand workspace:close + " }}} + + + " {{{ User-defined Ex commands + exmap SpaceKeysLeader obcommand spacekeys:leader + exmap Reload :source .obsidian.vimrc + exmap HistPrev obcommand app:go-back + exmap HistNext obcommand app:go-forward + exmap ViewSource obcommand editor:toggle-source + exmap ViewPreview obcommand markdown:toggle-preview + exmap PickAny obcommand darlal-switcher-plus:switcher-plus:open + exmap PickCmd obcommand darlal-switcher-plus:switcher-plus:open-commands + exmap PickRecent obcommand darlal-switcher-plus:switcher-plus:open-related-items + exmap FoldToggle obcommand editor:toggle-fold + exmap FoldLess obcommand editor:fold-less + exmap FoldMore obcommand editor:fold-more + exmap FoldAll obcommand editor:fold-all + exmap UnfoldAll obcommand editor:unfold-all + exmap BufferDeleteOthers obcommand workspace:close-others + exmap AddCallout obcommand editor:insert-callout + exmap AddBold obcommand editor:toogle-bold + exmap AddItalic obcommand editor:toogle-italic + exmap AddInternalLink obcommand editor:insert-internal-link + exmap AddHighlight obcommand editor:toogle-highlight + exmap Addcode obcommand editor:toogle-code + exmap Adddel obcommand editor:toogle-strikethrough + exmap ToggleLeft obcommand app:toggle-left-sidebar + exmap ToggleRight obcommand app:toggle-right-sidebar + exmap ToggleRibbon obcommand app:toggle-ribbon + exmap TogglePin obcommand workspace:toggle-pin + exmap ToggleStackedTab obcommand workspace:toggle-stacked-tabs + exmap ThemeSwitch obcommand theme:switch + exmap UpSkipFold jscommand {view.editor.exec('goUp')} + exmap DownSkipFold jscommand {view.editor.exec('goDown')} + "" exmap HeadingPrev jsfile .mdHelpers.js {jumpHeading(true)} + "" exmap HeadingNext jsfile .mdHelpers.js {jumpHeading(false)} + "" exmap SmarterIndent jsfile .mdHelpers.js {smarterIndent()} + exmap FollowLink obcommand editor:follow-link + exmap SurroundWikiLink surround [[ ]] + exmap SurroundBold surround ** ** + exmap SurroundItalic surround * * + exmap SurroundDoubleQuotes surround " " + exmap SurroundSingleQuotes surround ' ' + exmap SurroundBackticks surround ` ` + exmap SurroundBrackets surround ( ) + exmap SurronudCurlyBrackets surround { } + "" }}} + " + map mL :SurroundWikiLink + map m[ :SurroundWikiLink + ""nunmap s + ""vunmap s + map m" :SurroundDoubleQuotes + map m' :SurroundSingleQuotes + map m` :SurroundBackticks + map mb :SurroundBrackets + map m( :SurroundBrackets + map m) :SurroundBrackets + map m{ :SurronudCurlyBrackets + map m} :SurronudCurlyBrackets + + nnoremap H :bp + nnoremap L :bn + noremap J 5j + noremap K 5k + "" Y to yank to end of line + "noremap Y y$ + nmap :FollowLink + "nmap >> :SmarterIndent + " + " + """" g-commands + "nnoremap gh :HistPrev + "nnoremap gl :HistNext + "nnoremap gs :ViewSource + "nnoremap gp :ViewPreview + "" nmap [[ :HeadingPrev + "" nmap ]] :HeadingNext + " + "nnoremap za :FoldToggle + "" Use Tab to toggle fold, Org Mode style + nnoremap :FoldToggle + "imap :SmarterIndenti + nnoremap zr :FoldLess + nnoremap zm :FoldMore + nnoremap zM :FoldAll + nnoremap zR :UnfoldAll + + vnoremap ~ :Adddel " Add delete to selection + vnoremap ` c`"` " editor:toogle-code is buggy + vnoremap * :AddBold " Add bold to selection + vnoremap _ :AddItalic " Add italic to selection + vnoremap = :AddHighlight " Add highlight to selection + vnoremap [ :AddInternalLink " Add internal link to selection + ''; + }; + }; +} diff --git a/nixcfgs/users/js0ny/programs/zed-editor.nix b/nixcfgs/users/js0ny/programs/zed-editor.nix index 6196f5a..38e3e02 100644 --- a/nixcfgs/users/js0ny/programs/zed-editor.nix +++ b/nixcfgs/users/js0ny/programs/zed-editor.nix @@ -1,13 +1,230 @@ {pkgs, ...}: { + catppuccin.zed.enable = false; programs.zed-editor = { enable = true; + package = pkgs.zed-editor-fhs; extensions = [ - "dockerfile" "catppuccin" - "toml" "material-icon-theme" "git-firefly" - "make" ]; + userKeymaps = [ + { + context = "Workspace"; + bindings = {}; + } + { + context = "Editor"; + bindings = { + alt-k = "editor::AddSelectionAbove"; + alt-j = "editor::AddSelectionBelow"; + }; + } + { + context = "vim_mode == visual || vim_mode == operator"; + bindings = { + H = "vim::StartOfLine"; + L = "vim::EndOfLine"; + }; + } + { + context = "vim_mode == normal"; + bindings = { + H = "pane::ActivatePreviousItem"; + L = "pane::ActivateNextItem"; + Y = [ + "workspace::SendKeystrokes" + "y $" + ]; + }; + } + { + context = "Editor && vim_mode == normal && !VimWaiting && !menu"; + bindings = { + "space space" = "file_finder::Toggle"; + "space ;" = "command_palette::Toggle"; + "space !" = "workspace::NewTerminal"; + "space /" = "pane::DeploySearch"; + "space f c" = "zed::OpenSettings"; + "space f e c" = "zed::OpenSettings"; + "space f t" = "project_panel::ToggleFocus"; + "space c f" = "editor::Format"; + "space b D" = "workspace::CloseInactiveTabsAndPanes"; + "ctrl-w alt-h" = "workspace::ToggleLeftDock"; + "ctrl-w alt-l" = "workspace::ToggleRightDock"; + "ctrl-w alt-j" = "workspace::ToggleBottomDock"; + "[ d" = "editor::GoToPreviousDiagnostic"; + "] d" = "editor::GoToDiagnostic"; + "[ g" = "editor::GoToPreviousHunk"; + "] g" = "editor::GoToHunk"; + }; + } + { + context = "vim_mode == normal || vim_mode == visual || vim_mode == operator"; + bindings = { + j = "vim::Down"; + k = "vim::Up"; + l = "vim::Right"; + n = "search::SelectNextMatch"; + N = "search::SelectPreviousMatch"; + J = [ + "workspace::SendKeystrokes" + "j j j j j" + ]; + K = [ + "workspace::SendKeystrokes" + "k k k k k" + ]; + }; + } + { + context = "ProjectPanel && not_editing"; + bindings = { + j = "menu::SelectNext"; + k = "menu::SelectPrevious"; + l = "project_panel::ExpandSelectedEntry"; + A = "project_panel::NewDirectory"; + a = "project_panel::NewFile"; + d = "project_panel::Delete"; + }; + } + { + context = "Terminal"; + bindings = { + ctrl-p = [ + "terminal::SendKeystroke" + "ctrl-p" + ]; + ctrl-n = [ + "terminal::SendKeystroke" + "ctrl-n" + ]; + ctrl-T = "workspace::NewTerminal"; + ctrl-w = null; + "ctrl-w ctrl-w" = [ + "terminal::SendKeystroke" + "ctrl-w" + ]; + "ctrl-w h" = "workspace::ActivatePaneLeft"; + "ctrl-w k" = "workspace::ActivatePaneUp"; + "ctrl-w l" = "workspace::ActivatePaneRight"; + "ctrl-w j" = "workspace::ActivatePaneDown"; + }; + } + { + context = "vim_mode == normal || vim_mode == visual"; + bindings = { + s = "vim::PushSneak"; + shift-s = "vim::PushSneakBackward"; + }; + } + ]; + + userSettings = { + icon_theme = "Material Icon Theme"; + theme = { + mode = "system"; + light = "Catppuccin Latte"; + dark = "Catppuccin Mocha"; + }; + tabs = { + show_diagnostics = "errors"; + show_close_button = "hover"; + file_icons = true; + }; + base_keymap = "VSCode"; + vim_mode = true; + vim = { + use_system_clipboard = "on_yank"; + use_smartcase_find = true; + }; + features = { + edit_prediction_provider = "zed"; + }; + outline_panel = { + dock = "right"; + }; + edit_predictions = { + disabled_globs = [ + "*.bean" + "*.env" + "secrets.yaml" + ]; + copilot = { + proxy = null; + proxy_no_verify = null; + }; + }; + ui_font_size = 16; + buffer_font_size = null; + relative_line_numbers = true; + buffer_font_family = "Maple Mono NF CN"; + remove_trailing_whitespace_on_save = true; + agent = { + default_model = { + provider = "openrouter"; + model = "openai/gpt-5.1-codex"; + }; + }; + inlay_hints = { + enabled = true; + show_type_hints = true; + show_parameter_hints = true; + }; + terminal = { + detect_venv = { + on = { + directories = [ + ".venv" + ]; + }; + }; + dock = "bottom"; + env = { + EDITOR = "zeditor --wait"; + }; + shell = { + program = "zsh"; + }; + option_as_meta = true; + }; + file_types = { + JSON = [ + "*.code-snippets" + ]; + }; + telemetry = { + diagnostics = false; + metrics = false; + }; + languages = { + YAML = { + tab_size = 2; + }; + Nix = { + tab_size = 2; + formatter = { + external = { + command = "alejandra"; + arguments = [ + "--quiet" + "--" + ]; + }; + }; + completions = { + lsp_insert_mode = "replace"; + }; + }; + Lua = { + tab_size = 2; + formatter = { + external = { + command = "stylua"; + }; + }; + }; + }; + }; }; } diff --git a/nixcfgs/users/js0ny/zephyrus.nix b/nixcfgs/users/js0ny/zephyrus.nix index 951db68..6333269 100644 --- a/nixcfgs/users/js0ny/zephyrus.nix +++ b/nixcfgs/users/js0ny/zephyrus.nix @@ -49,6 +49,7 @@ ./programs/thunderbird.nix ./programs/obs-studio.nix ./programs/ghostty.nix + ./programs/obsidian # Desktop Linux ./programs/desktop/plasma