obsidian, zed

This commit is contained in:
js0ny 2025-11-20 21:32:35 +00:00
parent 42beae4b0a
commit f68ac5a89a
10 changed files with 386 additions and 8 deletions

View file

@ -69,6 +69,9 @@ vim:ft=gotmpl
.config/rofi .config/rofi
.config/waybar .config/waybar
.config/ghostty .config/ghostty
.config/zed/settings.json
.config/zed/keymap.json
.config/starship.toml
.local/share/kio/** .local/share/kio/**
.local/share/fonts/** .local/share/fonts/**
{{ end }} {{ end }}

View file

@ -35,11 +35,9 @@ end
if get_system_theme() == 'dark' then if get_system_theme() == 'dark' then
vim.o.background = 'dark' vim.o.background = 'dark'
vim.cmd.colorscheme("rose-pine") vim.cmd.colorscheme("catppuccin-mocha")
else else
vim.o.background = 'light' vim.o.background = 'light'
vim.cmd.colorscheme("rose-pine") vim.cmd.colorscheme("catppuccin-latte")
end end
vim.cmd.colorscheme("rose-pine-moon")

1
nixcfgs/.gitignore vendored
View file

@ -1 +1,2 @@
secrets # TODO secrets # TODO
users/js0ny/programs/desktop/wayland-wm/hyprland/

View file

@ -1,5 +1,4 @@
{...}: { {...}: {
catppuccin.starship.enable = false;
programs.starship = { programs.starship = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
@ -7,5 +6,12 @@
enableFishIntegration = true; enableFishIntegration = true;
enableNushellIntegration = true; enableNushellIntegration = true;
enableIonIntegration = true; enableIonIntegration = true;
settings = {
character = {
success_symbol = "[[󰄛](green) ](peach)";
error_symbol = "[[󰄛](red) ](peach)";
vimcmd_symbol = "[󰄛 ](subtext1)"; # For use with zsh-vi-mode
};
};
}; };
} }

View file

@ -19,5 +19,16 @@ in {
programs.home-manager.enable = true; 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; home.sessionVariables.TERMINAL = config.currentUser.defaultTerminal;
} }

View file

@ -54,4 +54,5 @@ in {
}; };
services.cliphist.enable = true; services.cliphist.enable = true;
services.dunst.enable = true; services.dunst.enable = true;
catppuccin.dunst.enable = false;
} }

View file

@ -0,0 +1,14 @@
{...}: {
imports = [
./vimrc-support.nix
];
programs.obsidian = {
enable = true;
vaults."HomeManagerDryRun" = {
enable = true;
target = "HomeManagerDryRun"; # relative to $HOME
settings = {
};
};
};
}

View file

@ -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<CR>
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<CR>
map m[ :SurroundWikiLink<CR>
""nunmap s
""vunmap s
map m" :SurroundDoubleQuotes<CR>
map m' :SurroundSingleQuotes<CR>
map m` :SurroundBackticks<CR>
map mb :SurroundBrackets<CR>
map m( :SurroundBrackets<CR>
map m) :SurroundBrackets<CR>
map m{ :SurronudCurlyBrackets<CR>
map m} :SurronudCurlyBrackets<CR>
nnoremap H :bp<CR>
nnoremap L :bn<CR>
noremap J 5j
noremap K 5k
"" Y to yank to end of line
"noremap Y y$
nmap <CR> :FollowLink<CR>
"nmap >> :SmarterIndent<CR>
"
"
"""" g-commands
"nnoremap gh :HistPrev<CR>
"nnoremap gl :HistNext<CR>
"nnoremap gs :ViewSource<CR>
"nnoremap gp :ViewPreview<CR>
"" nmap [[ :HeadingPrev<CR>
"" nmap ]] :HeadingNext<CR>
"
"nnoremap za :FoldToggle<CR>
"" Use Tab to toggle fold, Org Mode style
nnoremap <Tab> :FoldToggle<CR>
"imap <Tab> <Esc>:SmarterIndent<CR>i
nnoremap zr :FoldLess<CR>
nnoremap zm :FoldMore<CR>
nnoremap zM :FoldAll<CR>
nnoremap zR :UnfoldAll<CR>
vnoremap ~ :Adddel<CR> " Add delete to selection
vnoremap ` c`<C-r>"`<Esc> " editor:toogle-code is buggy
vnoremap * :AddBold<CR> " Add bold to selection
vnoremap _ :AddItalic<CR> " Add italic to selection
vnoremap = :AddHighlight<CR> " Add highlight to selection
vnoremap [ :AddInternalLink<CR> " Add internal link to selection
'';
};
};
}

View file

@ -1,13 +1,230 @@
{pkgs, ...}: { {pkgs, ...}: {
catppuccin.zed.enable = false;
programs.zed-editor = { programs.zed-editor = {
enable = true; enable = true;
package = pkgs.zed-editor-fhs;
extensions = [ extensions = [
"dockerfile"
"catppuccin" "catppuccin"
"toml"
"material-icon-theme" "material-icon-theme"
"git-firefly" "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";
};
};
};
};
};
};
}

View file

@ -49,6 +49,7 @@
./programs/thunderbird.nix ./programs/thunderbird.nix
./programs/obs-studio.nix ./programs/obs-studio.nix
./programs/ghostty.nix ./programs/ghostty.nix
./programs/obsidian
# Desktop Linux # Desktop Linux
./programs/desktop/plasma ./programs/desktop/plasma