From 67ee375ba79a13fd4bdbc7f684d337781d36da54 Mon Sep 17 00:00:00 2001 From: Jonas Hahn Date: Sat, 1 Nov 2025 23:53:51 +0100 Subject: [PATCH] auto up 23:53:40 up 0:02, 2 users, load average: 0.88, 0.49, 0.20 auto up 00:24:13 up 0:32, 2 users, load average: 0.84, 0.77, 0.74 auto up 17:13:21 up 4:51, 2 users, load average: 1.17, 1.00, 0.87 auto up 18:55:47 up 0:01, 2 users, load average: 0.67, 0.36, 0.14 auto up 18:57:31 up 0:00, 2 users, load average: 0.71, 0.18, 0.06 auto up 19:03:28 up 0:09, 2 users, load average: 0.22, 0.38, 0.26 auto up 01:08:17 up 6:30, 2 users, load average: 0.62, 0.57, 0.51 auto up 02:38:43 up 0:05, 3 users, load average: 0.52, 0.53, 0.25 auto up 10:53:19 up 0:00, 2 users, load average: 1.01, 0.25, 0.08 --- lazy-lock.json | 33 ++++++++++++++++----------------- lua/conf.lua | 1 + lua/config/keymaps.lua | 12 ++++-------- lua/config/options.lua | 9 +++++++++ lua/custom/uni/init.lua | 32 ++++++++++++++++++++++++++++++++ lua/plugins/misc.lua | 6 +++++- lua/plugins/typstar.lua | 4 ++++ 7 files changed, 71 insertions(+), 26 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 397fbf2..c32d296 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,33 +1,32 @@ { - "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "aerial.nvim": { "branch": "master", "commit": "c7cbbad40c2065fccfd1f1863bb2c08180c0533d" }, + "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, + "aerial.nvim": { "branch": "master", "commit": "5e687b5a14004fa2dd9eccbee042b96869fe1557" }, "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "2388dcd61731ae158bf7dad2ae0419291837e557" }, - "gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" }, + "fzf-lua": { "branch": "main", "commit": "a8458b79a957a6e3e217d84106a0fd4b9470ff4c" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, + "lazy.nvim": { "branch": "main", "commit": "e6a8824858757ca9cd4f5ae1a72d845fa5c46a39" }, + "lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" }, "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" }, "lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "a1067cf84b4ff81b66d2bf4d01f4cbdb5de40bd0" }, - "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lspconfig": { "branch": "master", "commit": "b3cce1419ca67871ae782b3e529652f8a016f0de" }, - "nvim-tree.lua": { "branch": "master", "commit": "e179ad2f83b5955ab0af653069a493a1828c2697" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, + "nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" }, + "nvim-tree.lua": { "branch": "master", "commit": "64e2192f5250796aa4a7f33c6ad888515af50640" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telekasten.nvim": { "branch": "main", "commit": "b3ac2b07f2df504bb80112fec349714086a80037" }, "telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "telescope.nvim": { "branch": "master", "commit": "71ef4dc501c3eb3ed0e9cab2e0fb8e4e016def53" }, "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, - "typstar": { "branch": "main", "commit": "b0613321025cdbd89dbb9ccbc73e62a6b72a80fe" }, - "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } + "vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lua/conf.lua b/lua/conf.lua index b1272c8..25ee155 100644 --- a/lua/conf.lua +++ b/lua/conf.lua @@ -4,5 +4,6 @@ config.season = "S3" -- Current semester config.projects = vim.fn.expand("~/projects") config.uni_dir = vim.fn.expand("~/projects/university/" .. config.season) config.user = vim.fn.system('whoami'):gsub('\n', '') +config.book_file = vim.fn.expand("~/projects/university/book.typ") return config diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 4942b9d..3d08c7b 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -28,7 +28,7 @@ vim.keymap.set('n', 'va', 'ggVG') vim.keymap.set('n', 'tr', ':tabnew:termi') -- Indent all will be replaced by the formatting of lsp where the lsp is installed -vim.keymap.set('n', 'ia', 'gg=Gzz') +vim.keymap.set('n', 'ia', 'gg=Gzz') -- This can break vim.keymap.set('n', 'ya', 'ggVG"+y') vim.keymap.set('n', 'ss', ':wa') vim.keymap.set("n", "nn", ":e ~/synced/brainstore/zettelkasten/quick", { silent = true }) @@ -51,10 +51,11 @@ vim.keymap.set("n", "fs", toggle_fold, opts) -- close all folds vim.keymap.set('n', 'occ', ':e ~/.config/nvim/init.lua`.zz') vim.keymap.set('n', 'oct', ':e ~/synced/vault/contacts/contacts.txt`.zz') vim.keymap.set('n', 'ock', ':e ~/.config/nvim/lua/config/keymaps.lua`.zz') + vim.keymap.set('n', 'ocd', ':e ~/.config/nvim/lua/config/autocmds.lua`.zz') vim.keymap.set('n', 'oco', ':e ~/.config/nvim/lua/config/options.lua`.zz') vim.keymap.set('n', 'ocl', ':e ~/.config/nvim/lua/config/lazy.lua`.zz') -vim.keymap.set('n', 'oczl', ':e ~/.config/nvim/lua/plugins/lsp.lua`.zz') +vim.keymap.set('n', 'oczl', ':e ~/.config/nvim/lua/config/lsp.lua`.zz') vim.keymap.set('n', 'ocp', ':e ~/.config/nvim/lua/plugins/misc.lua`.zz') vim.keymap.set('n', 'ocf', ':e ~/.config/nvim/lua/utils/functions.lua`.zz') vim.keymap.set('n', 'oca', ':e ~/.config/nvim/lua/utils/after.lua`.zz') @@ -62,6 +63,7 @@ vim.keymap.set('n', 'oq', ':e ~/synced/brainstore/input.txt`.zz') vim.keymap.set('n', 'ot', ':e ~/synced/brainstore/todos/todo.txt`.zz') vim.keymap.set('n', 'od', ':e ~/synced/brainstore/todos/done.txt`.zz') vim.keymap.set('n', 'ou', ':e ~/projects/university/' .. conf.season .. '/input.txt`.zz') +vim.keymap.set('n', 'fd', ':e ~/projects/university/' .. conf.season .. '/input.txt`.zz') vim.keymap.set('n', 'oz', ':e ~/.zshrc`.zz') vim.keymap.set('n', 'oaa', ':e ~/.common_shell`.zz') vim.keymap.set('n', 'ow', ':e ~/synced/brainstore/waste.txt') @@ -112,12 +114,6 @@ vim.keymap.set('v', 'p', function() vim.cmd('normal! "+p') end, { desc = 'Yank to clipboard and keep the selection' }) -vim.keymap.set('v', 'p', function() - local unnamed_content = vim.fn.getreg('""') - vim.api.nvim_command('normal! p') - vim.fn.setreg('""', unnamed_content) -end, { desc = 'Paste from unnamed register (don\'t overwrite it) in visual mode' }) - vim.keymap.set('v', 'y', function() vim.cmd('normal! "+y') vim.cmd('normal! gv') diff --git a/lua/config/options.lua b/lua/config/options.lua index 1261d35..38a7022 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -26,3 +26,12 @@ vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" vim.opt.foldlevelstart = 99 -- open all folds by default vim.opt.fillchars = "fold:╌" + +vim.g.GPGDefaultRecipients = {"C6772451703DE183A4983CBA063DC054484835A6"} + +vim.o.expandtab = true -- Use spaces instead of tabs +vim.o.shiftwidth = 4 -- Number of spaces per indentation +vim.o.tabstop = 4 -- Number of spaces a tab counts for +vim.o.smarttab = true -- Insert 'shiftwidth' spaces when pressing Tab +vim.o.autoindent = true -- Maintain indent of current line +vim.o.smartindent = true -- Smart auto-indenting diff --git a/lua/custom/uni/init.lua b/lua/custom/uni/init.lua index a423385..ad3723c 100644 --- a/lua/custom/uni/init.lua +++ b/lua/custom/uni/init.lua @@ -116,6 +116,36 @@ function M.get_newest_vl_file(files) return newest_file end +-- Function to insert chapter reference at top summary section +local function add_chapter_to_summary(course, new_vl_name) + local book_file = vim.fn.expand(conf.book_file) + local rel_path = string.format("%s/VL/%s", course.path:match("university/(.+)$"), new_vl_name) + local default_title = new_vl_name + local chapter_line = string.format(' - #chapter("%s")[%s]\n', rel_path, default_title:match("^(.-)%.")) + + local lines = {} + for l in io.lines(book_file) do + table.insert(lines, l) + end + + local out = io.open(book_file, "w") + local inserted = false + local right_block = false + for _, l in ipairs(lines) do + -- insert after the course's existing index line + if not inserted and l:match('"' .. course.path:match("university/(.+)$") .. '/index.typ"') then + right_block = true + end + if not inserted and right_block and l:match("^%s*$") then + out:write(chapter_line .. "\n" .. l) + inserted = true + else + out:write(l .. "\n") + end + end + out:close() +end + -- Function to create a new VL file based on the template and incrementing the number function M.create_new_vl(course) local vl_dir = course.path .. "/VL" @@ -145,6 +175,8 @@ function M.create_new_vl(course) -- Copy the template if it exists vim.fn.system({ "cp", template_path, new_vl_path }) + add_chapter_to_summary(course, new_vl_name) + -- Open the new VL file vim.cmd("edit " .. new_vl_path) else diff --git a/lua/plugins/misc.lua b/lua/plugins/misc.lua index c36d387..14b2e48 100644 --- a/lua/plugins/misc.lua +++ b/lua/plugins/misc.lua @@ -20,6 +20,10 @@ return { -- 'Exafunction/windsurf.vim', -- event = 'BufEnter' --}, + { + "Ascyii/vim-gnupg", + dev = true + }, { "akinsho/toggleterm.nvim", config = function() @@ -45,7 +49,7 @@ return { 'Ascyii/telekasten.nvim', dev = true, config = function() - local base_zet = "~/synced/brainstore/zettelkasten" + local base_zet = "~/Nextcloud/Notes" -- Again can only use opts when not using config require("telekasten").setup({ diff --git a/lua/plugins/typstar.lua b/lua/plugins/typstar.lua index e875698..8d33bb4 100644 --- a/lua/plugins/typstar.lua +++ b/lua/plugins/typstar.lua @@ -27,6 +27,10 @@ return { "ti", ":TypstarInsertRnote", }, + { + "td", + ":TypstarDeleteRnote", + }, { "to", ":TypstarOpenDrawing",