Compare commits
3 Commits
efd2771d8c
...
fdaa327ab8
| Author | SHA1 | Date | |
|---|---|---|---|
| fdaa327ab8 | |||
| 9ec68b1939 | |||
| 34dd35f575 |
@@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd "$ZK_PATH" || echo "No zettelkasten directory found"
|
|
||||||
git a . && git commit -m "Update" && git push
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ! -d ~/.zk ]; then
|
|
||||||
echo "[zk] Setting up zettelkasten"
|
|
||||||
gh repo clone zk ~/.zk
|
|
||||||
else
|
|
||||||
echo "[zk] Zettelkasten already set up."
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -p "Would you like open your zettelkasten? [y/N] " -n 1 -r
|
|
||||||
echo
|
|
||||||
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
if [ -x "$(command -v zk)" ]; then
|
|
||||||
zk
|
|
||||||
else
|
|
||||||
echo "Error: 'zk' command not found or not executable"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
|
require("zk.utils")
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
" Change local buffer to directory of current file after the plugin has loaded
|
" Change local buffer to directory of current file after the plugin has loaded
|
||||||
autocmd VimEnter * lcd %:p:h
|
execute 'autocmd BufEnter' g:zk_path . '/*.md' 'silent lcd %:p:h'
|
||||||
|
|
||||||
" " Override wiki index mapping to also cd into the wiki
|
" " Override wiki index mapping to also cd into the wiki
|
||||||
nm <leader>ww <plug>(wiki-index)
|
nm <leader>ww <plug>(wiki-index)
|
||||||
@@ -76,7 +78,7 @@ let g:wiki_templates = [
|
|||||||
"
|
"
|
||||||
|
|
||||||
let g:wiki_filetypes=['md']
|
let g:wiki_filetypes=['md']
|
||||||
let g:wiki_root='~/.zk'
|
let g:wiki_root=g:zk_path
|
||||||
let g:wiki_global_load=0
|
let g:wiki_global_load=0
|
||||||
let g:wiki_link_creation = {
|
let g:wiki_link_creation = {
|
||||||
\ 'md': {
|
\ 'md': {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
require("zk.cmp")
|
require("zk.cmp")
|
||||||
|
require("zk.utils")
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
let s:zk_preview_enabled = 0
|
let s:zk_preview_enabled = 0
|
||||||
let s:live_server_job = -1
|
let s:live_server_job = -1
|
||||||
au BufEnter /home/h/.zk/*.md silent exe '!echo "%" > /home/h/.zk/current-zettel.txt'
|
execute 'au BufEnter' g:zk_path . '/*.md' 'silent exe "!echo %" ">" g:zk_path . "/current-zettel.txt"'
|
||||||
function! ToggleZKPreview()
|
function! ToggleZKPreview()
|
||||||
if s:zk_preview_enabled == 1
|
if s:zk_preview_enabled == 1
|
||||||
let s:zk_preview_enabled = 0
|
let s:zk_preview_enabled = 0
|
||||||
@@ -11,10 +12,10 @@ function! ToggleZKPreview()
|
|||||||
au! ZKPreview
|
au! ZKPreview
|
||||||
else
|
else
|
||||||
let s:zk_preview_enabled = 1
|
let s:zk_preview_enabled = 1
|
||||||
let s:live_server_job = jobstart('live-server --watch=/home/h/.zk/current-zettel-content.html --open=current-zettel-content.html --port=8080')
|
let s:live_server_job = jobstart('live-server --watch=' . g:zk_path . '/current-zettel-content.html --open=current-zettel-content.html --port=8080')
|
||||||
augroup ZKPreview
|
augroup ZKPreview
|
||||||
au BufEnter /home/h/.zk/*.md silent exe '!cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
|
execute 'au BufEnter' g:zk_path . '/*.md' 'silent exe "!cat %:r.html" ">" g:zk_path . "/current-zettel-content.html"'
|
||||||
au BufWritePost /home/h/.zk/*.md silent exe '!make && cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
|
execute 'au BufWritePost' g:zk_path . '/*.md' 'silent exe "!make && cat %:r.html" ">" g:zk_path . "/current-zettel-content.html"'
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
2
dots/.config/nvim/lua/zk/utils.lua
Normal file
2
dots/.config/nvim/lua/zk/utils.lua
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
vim.g.zk_path = os.getenv("ZK_PATH") or (os.getenv("HOME") .. "/.zk")
|
||||||
|
return vim.g.zk_path
|
||||||
30
flake.lock
generated
30
flake.lock
generated
@@ -121,11 +121,11 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "pkgs/firefox-addons",
|
"dir": "pkgs/firefox-addons",
|
||||||
"lastModified": 1776744173,
|
"lastModified": 1777176175,
|
||||||
"narHash": "sha256-9pZQWypgc0H1lgyuGmLqEL5IKVdHMw/NoO/iFcoSrW0=",
|
"narHash": "sha256-l/0TJCLEarrsyHIKNhAjI4+7lkyGsFqojyx1X1h64Ks=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nur-expressions",
|
"repo": "nur-expressions",
|
||||||
"rev": "a803876f3cfc65f8858d413cef2b7d10d50a81d7",
|
"rev": "515c8c1296021efe49ba1b1318ff27a43e93442b",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -342,11 +342,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776777932,
|
"lastModified": 1777196875,
|
||||||
"narHash": "sha256-0R3Yow/NzSeVGUke5tL7CCkqmss4Vmi6BbV6idHzq/8=",
|
"narHash": "sha256-6M/rTHxFRdKJ6WZYxrCl68qIyh3BvjWBmYC7Vufolbg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "5d5640599a0050b994330328b9fd45709c909720",
|
"rev": "38bf0202cae280174cbb80fc24a63978f16333f7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -451,11 +451,11 @@
|
|||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775490113,
|
"lastModified": 1776983936,
|
||||||
"narHash": "sha256-2ZBhDNZZwYkRmefK5XLOusCJHnoeKkoN95hoSGgMxWM=",
|
"narHash": "sha256-ZOQyNqSvJ8UdrrqU1p7vaFcdL53idK+LOM8oRWEWh6o=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "c775c2772ba56e906cbeb4e0b2db19079ef11ff7",
|
"rev": "2096f3f411ce46e88a79ae4eafcfc9df8ed41c61",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -467,11 +467,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776548001,
|
"lastModified": 1776877367,
|
||||||
"narHash": "sha256-ZSK0NL4a1BwVbbTBoSnWgbJy9HeZFXLYQizjb2DPF24=",
|
"narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b12141ef619e0a9c1c84dc8c684040326f27cdcc",
|
"rev": "0726a0ecb6d4e08f6adced58726b95db924cef57",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -714,11 +714,11 @@
|
|||||||
"tinted-zed": "tinted-zed"
|
"tinted-zed": "tinted-zed"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776170745,
|
"lastModified": 1776893932,
|
||||||
"narHash": "sha256-Tl1aZVP5EIlT+k0+iAKH018GLHJpLz3hhJ0LNQOWxCc=",
|
"narHash": "sha256-AFD5cf9eNqXq1brHS63xeZy2xKZMgG9J86XJ9I2eLn8=",
|
||||||
"owner": "danth",
|
"owner": "danth",
|
||||||
"repo": "stylix",
|
"repo": "stylix",
|
||||||
"rev": "e3861617645a43c9bbefde1aa6ac54dd0a44bfa9",
|
"rev": "84971726c7ef0bb3669a5443e151cc226e65c518",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
../../modules/taskwarrior
|
../../modules/taskwarrior
|
||||||
../../modules/terminal
|
../../modules/terminal
|
||||||
|
../../modules/zk
|
||||||
../../modules/torrenting
|
../../modules/torrenting
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
shell.bash.aliases.lang-js = true;
|
shell.bash.aliases.lang-js = true;
|
||||||
shell.bash.addBinToPath = true;
|
shell.bash.addBinToPath = true;
|
||||||
torrenting.enable = true;
|
torrenting.enable = true;
|
||||||
|
zk.enable = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
|
|||||||
45
home/modules/zk/default.nix
Normal file
45
home/modules/zk/default.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.zk;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.zk = {
|
||||||
|
enable = lib.mkEnableOption "zettelkasten";
|
||||||
|
path = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = config.home.homeDirectory + "/.zk";
|
||||||
|
description = "Path to the zettelkasten directory";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home = {
|
||||||
|
sessionVariables.ZK_PATH = cfg.path;
|
||||||
|
packages = [
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "zk";
|
||||||
|
runtimeInputs = with pkgs; [ tmux ];
|
||||||
|
text = builtins.readFile ./scripts/zk.sh;
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "save-zk";
|
||||||
|
runtimeInputs = with pkgs; [ git ];
|
||||||
|
text = builtins.readFile ./scripts/save-zk.sh;
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "setup-zk";
|
||||||
|
runtimeInputs = with pkgs; [ gh ];
|
||||||
|
text = builtins.readFile ./scripts/setup-zk.sh;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
2
home/modules/zk/scripts/save-zk.sh
Normal file
2
home/modules/zk/scripts/save-zk.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cd "$ZK_PATH" || { echo "No zettelkasten directory found"; exit 1; }
|
||||||
|
git add . && git commit -m "Update" && git push
|
||||||
13
home/modules/zk/scripts/setup-zk.sh
Normal file
13
home/modules/zk/scripts/setup-zk.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
if [ ! -d "$ZK_PATH" ]; then
|
||||||
|
echo "[zk] Setting up zettelkasten"
|
||||||
|
gh repo clone zk "$ZK_PATH"
|
||||||
|
else
|
||||||
|
echo "[zk] Zettelkasten already set up."
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "Would you like open your zettelkasten? [y/N] " -n 1 -r
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
$EDITOR "$ZK_PATH"
|
||||||
|
fi
|
||||||
4
dots/.bin/zk → home/modules/zk/scripts/zk.sh
Executable file → Normal file
4
dots/.bin/zk → home/modules/zk/scripts/zk.sh
Executable file → Normal file
@@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
current_zettel_path="$ZK_PATH/$(cat "$ZK_PATH/current-zettel.txt")"
|
current_zettel_path="$ZK_PATH/$(cat "$ZK_PATH/current-zettel.txt")"
|
||||||
|
|
||||||
if [ "$TERM_PROGRAM" = tmux ]; then
|
if [ -n "$TMUX" ]; then
|
||||||
cd "$ZK_PATH" && $EDITOR "$current_zettel_path"
|
cd "$ZK_PATH" && $EDITOR "$current_zettel_path"
|
||||||
else
|
else
|
||||||
echo 'Not in tmux'
|
echo 'Not in tmux'
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
programs.gamemode.enable = true;
|
programs.gamemode.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
lutris
|
# lutris
|
||||||
mangohud
|
mangohud
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user