Compare commits

...

17 Commits

Author SHA1 Message Date
1d8aba920c auto up 15:54:41 up 1:28, 2 users, load average: 2.26, 2.48, 1.96 2025-11-18 15:54:43 +01:00
77dee32c29 auto up 09:41:45 up 1:27, 2 users, load average: 0.31, 0.36, 0.36 2025-11-18 09:41:47 +01:00
c4c8ef4893 auto up 11:24:53 up 0:07, 2 users, load average: 2.26, 1.72, 0.89 2025-11-17 11:24:55 +01:00
ea0b19b71a auto up 11:48:23 up 3:25, 2 users, load average: 0.17, 0.26, 0.17 2025-11-14 11:48:39 +01:00
b467a414c4 auto up 14:05:46 up 0:07, 2 users, load average: 0.42, 0.38, 0.20 2025-11-12 14:05:48 +01:00
067c267e26 auto up 17:06:41 up 0:01, 2 users, load average: 0.30, 0.13, 0.05 2025-11-07 17:06:43 +01:00
98bcb5f285 auto up 11:52:14 up 0:59, 2 users, load average: 0.27, 0.30, 0.33 2025-11-06 11:52:15 +01:00
67ee375ba7 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
2025-11-06 10:54:06 +01:00
38f3acc17f Minros 2025-10-03 13:29:45 +02:00
b3cbf4d2c9 Update typstar 2025-09-24 18:56:40 +02:00
ba038af54f Update and fix lsp update deprecation 2025-09-24 18:31:47 +02:00
80bb4e207a Skip usage of windsuf 2025-09-23 16:31:22 +02:00
e4cb69ad82 Fix double lsp 2025-09-18 23:18:19 +02:00
e2a6c21f81 Update readme 2025-09-01 17:07:32 +02:00
c351f5edd4 More lsps 2025-09-01 01:31:42 +02:00
dc95d79a11 Played around with the signcolum 2025-09-01 00:04:10 +02:00
949eb06300 Custom borders for hovering and diagnostics 2025-08-31 16:42:42 +02:00
19 changed files with 440 additions and 248 deletions

View File

@@ -1,11 +1,11 @@
# Neovim configuration in pure lua
You can configure the current semester that you are in for university integrations.
There are certain things required like `make` and `npm` for various plugins.
Configure the environment in `conf.lua`.
Most lsp require `npm` installed on the system.
## Dependencies
To install proper snippets and get the basic lsp the following programs are needed in path.
To install proper snippets and get lsp running install the following programs into your path
```
make
@@ -14,8 +14,3 @@ gcc
libc
bash
```
## General
This configuration is based on the lazy plugin manager.

View File

@@ -1,32 +1,34 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"aerial.nvim": { "branch": "master", "commit": "c7cbbad40c2065fccfd1f1863bb2c08180c0533d" },
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
"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": "bebc84e7ffc8fd86103f6ed6c590df72d524d342" },
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
"gruvbox.nvim": { "branch": "main", "commit": "12c2624287dc827edb5d72b2bc4c9619e692a554" },
"fzf-lua": { "branch": "main", "commit": "2388dcd61731ae158bf7dad2ae0419291837e557" },
"gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" },
"lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" },
"lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" },
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "5e085efe67fccb13372d54331d849219662a7e93" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "a1067cf84b4ff81b66d2bf4d01f4cbdb5de40bd0" },
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "408cf07b97535825cca6f1afa908d98348712ba6" },
"nvim-tree.lua": { "branch": "master", "commit": "fefa335f1c8f690eb668a1efd18ee4fc6d64cd3e" },
"nvim-lspconfig": { "branch": "master", "commit": "b3cce1419ca67871ae782b3e529652f8a016f0de" },
"nvim-tree.lua": { "branch": "master", "commit": "e179ad2f83b5955ab0af653069a493a1828c2697" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" },
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
"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" },
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
"typstar": { "branch": "main", "commit": "67a76bec16af7c726a77b9c3a15ef37b34967a9c" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
"typstar": { "branch": "main", "commit": "b0613321025cdbd89dbb9ccbc73e62a6b72a80fe" },
"vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" },
"which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" }
}

View File

@@ -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

View File

@@ -1,36 +1,45 @@
-- Save the last file on exit
vim.api.nvim_create_autocmd("VimLeave", {
callback = function()
local last_file = vim.fn.expand('%:p') -- Get the absolute path of the current file
if last_file ~= "" then -- The operator means not equal in lua
local file = io.open(vim.fn.stdpath('data') .. "/lastfile.txt", "w")
if file then
file:write(last_file)
file:close()
end
end
end,
callback = function()
local last_file = vim.fn.expand('%:p') -- Get the absolute path of the current file
if last_file ~= "" then -- The operator means not equal in lua
local file = io.open(vim.fn.stdpath('data') .. "/lastfile.txt", "w")
if file then
file:write(last_file)
file:close()
end
end
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "nix",
callback = function()
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
end,
pattern = "nix",
callback = function()
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "c",
callback = function()
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
end,
})
vim.api.nvim_create_augroup("RememberFolds", {
clear = true
clear = true
})
vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
group = "RememberFolds",
pattern = "*",
command = "silent! mkview",
group = "RememberFolds",
pattern = "*",
command = "silent! mkview",
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
group = "RememberFolds",
pattern = "*",
command = "silent! loadview",
group = "RememberFolds",
pattern = "*",
command = "silent! loadview",
})

View File

@@ -20,7 +20,7 @@ vim.keymap.set("n", "<leader>snf", "<cmd>set nonu<CR>")
vim.keymap.set("n", "n", "nzz", { silent = true })
vim.keymap.set("n", "N", "Nzz", { silent = true })
vim.keymap.set("n", "<C-o>", "<C-o>zz", { silent = true })
vim.keymap.set("n", "<C-i>", "<C-i>zz", { silent = true })
vim.keymap.set("n", "<`C-i>", "<C-i>zz", { silent = true })
vim.keymap.set("n", "<C-u>", "<C-u>zz", { silent = true })
vim.keymap.set("n", "<C-d>", "<C-d>zz", { silent = true })
vim.keymap.set('n', '<leader>a', 'm9ggVG"+y`9')
@@ -28,10 +28,10 @@ vim.keymap.set('n', '<leader>va', 'ggVG')
vim.keymap.set('n', '<leader>tr', ':tabnew<CR>:term<CR>i')
-- Indent all will be replaced by the formatting of lsp where the lsp is installed
vim.keymap.set('n', '<leader>ia', 'gg=G<C-o>zz')
vim.keymap.set('n', '<leader>ia', 'gg=G<C-o>zz') -- This can break
vim.keymap.set('n', '<leader>ya', 'ggVG"+y<C-o>')
vim.keymap.set('n', '<leader>ss', ':wa<CR>')
vim.keymap.set("n", "<leader>nn", ":e ~/synced/brainstore/zettelkasten/quick<CR>", { silent = true })
vim.keymap.set("n", "<leader>nn", ":e ~/Nextcloud/Notes/quick.txt<CR>", { silent = true })
-- Folding
local opts = { noremap = true, silent = true }
@@ -44,13 +44,14 @@ local function toggle_fold()
end
is_all_folded = not is_all_folded
end
vim.api.nvim_set_keymap("n", "<leader>ft", "za", opts) -- toggle fold under cursor
vim.keymap.set("n", "<leader>fs", toggle_fold, opts) -- close all folds
vim.api.nvim_set_keymap("n", "<leader>ft", "za", opts) -- toggle fold under cursor
vim.keymap.set("n", "<leader>fs", toggle_fold, opts) -- close all folds
-- Quickly open some buffers
vim.keymap.set('n', '<leader>occ', ':e ~/.config/nvim/init.lua<CR>`.zz')
vim.keymap.set('n', '<leader>oct', ':e ~/synced/vault/contacts/contacts.txt<CR>`.zz')
vim.keymap.set('n', '<leader>ock', ':e ~/.config/nvim/lua/config/keymaps.lua<CR>`.zz')
vim.keymap.set('n', '<leader>ocd', ':e ~/.config/nvim/lua/config/autocmds.lua<CR>`.zz')
vim.keymap.set('n', '<leader>oco', ':e ~/.config/nvim/lua/config/options.lua<CR>`.zz')
vim.keymap.set('n', '<leader>ocl', ':e ~/.config/nvim/lua/config/lazy.lua<CR>`.zz')
@@ -62,6 +63,7 @@ vim.keymap.set('n', '<leader>oq', ':e ~/synced/brainstore/input.txt<CR>`.zz')
vim.keymap.set('n', '<leader>ot', ':e ~/synced/brainstore/todos/todo.txt<CR>`.zz')
vim.keymap.set('n', '<leader>od', ':e ~/synced/brainstore/todos/done.txt<CR>`.zz')
vim.keymap.set('n', '<leader>ou', ':e ~/projects/university/' .. conf.season .. '/input.txt<CR>`.zz')
vim.keymap.set('n', '<leader>fd', ':e ~/projects/university/' .. conf.season .. '/input.txt<CR>`.zz')
vim.keymap.set('n', '<leader>oz', ':e ~/.zshrc<CR>`.zz')
vim.keymap.set('n', '<leader>oaa', ':e ~/.common_shell<CR>`.zz')
vim.keymap.set('n', '<leader>ow', ':e ~/synced/brainstore/waste.txt<CR>')
@@ -112,11 +114,7 @@ vim.keymap.set('v', '<leader>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('n', 'nh', ":noh<CR>")
vim.keymap.set('v', '<leader>y', function()
vim.cmd('normal! "+y')
@@ -201,8 +199,8 @@ vim.keymap.set("n", "<leader>r",
vim.fn.system(cmd)
if vim.v.shell_error == 0 then
local git_root = vim.fn.systemlist('git -C ' ..
vim.fn.fnameescape(current_file) .. ' rev-parse --show-toplevel')
[1]
vim.fn.fnameescape(current_file) .. ' rev-parse --show-toplevel')
[1]
vim.cmd('cd ' .. vim.fn.fnameescape(git_root))
else
vim.cmd('cd ' .. vim.fn.fnameescape(current_file))
@@ -216,6 +214,6 @@ vim.keymap.set('n', '<leader>ok', function()
local day_of_week = os.date("%a")
local path = "~/storage/notes/calendar/calendar_" .. os.date("%Y") .. ".txt"
local keys = ":e " ..
path .. "<CR>/" .. current_date .. " w" .. tonumber(week_number) .. " " .. day_of_week .. "<CR>$"
path .. "<CR>/" .. current_date .. " w" .. tonumber(week_number) .. " " .. day_of_week .. "<CR>$"
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, false, true), 'n', true)
end)

View File

@@ -34,3 +34,5 @@ require("lazy").setup({
enabled = false,
},
})
require("utils.after")

View File

@@ -1,7 +1,14 @@
vim.o.shiftwidth = 4;
vim.o.tabstop = 4;
vim.o.number = true;
vim.opt.relativenumber = true
vim.o.ignorecase = true;
--vim.o.guicursor = "n-v-c-sm-i-ci-ve:block";
vim.o.cursorline = true
vim.cmd([[
highlight CursorLine cterm=NONE guibg=#4c3c3c
]])
-- Disable mouse completly
vim.o.mouse = "";
@@ -17,10 +24,16 @@ vim.opt.termguicolors = true
--vim.g.loaded_netrw = 1
--vim.g.loaded_netrwPlugin = 1
vim.opt.signcolumn = "yes"
--vim.opt.signcolumn = "number"
vim.opt.signcolumn = "yes:1"
-- Enable Treesitter-based folding
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.smarttab = true -- Insert 'shiftwidth' spaces when pressing Tab

View File

@@ -7,74 +7,96 @@ local watch_buf_id = nil
local watch_tab_id = nil
function M.watch_and_open()
-- Parse the current file and check for typst
vim.notify("INIT", vim.log.levels.WARN)
local input = vim.fn.expand("%:p")
if not input:match("%.typ$") then
vim.notify("Not a Typst file", vim.log.levels.WARN)
return
end
local dir = vim.fn.fnamemodify(input, ":h") -- directory of the Typst file
local filename = vim.fn.expand("%:t:r") .. ".pdf" -- filename without extension + .pdf
-- Parse the current file and check for typst
vim.notify("INIT", vim.log.levels.WARN)
local input = vim.fn.expand("%:p")
if not input:match("%.typ$") then
vim.notify("Not a Typst file", vim.log.levels.WARN)
return
end
local dir = vim.fn.fnamemodify(input, ":h") -- directory of the Typst file
local filename = vim.fn.expand("%:t:r") .. ".pdf" -- filename without extension + .pdf
-- Check if a watcher is already running for this file
if watch_job_id then
vim.notify("Typst watcher already running - please close zathura", vim.log.levels.INFO)
return
end
-- Check if a watcher is already running for this file
if watch_job_id then
vim.notify("Typst watcher already running - please close zathura", vim.log.levels.INFO)
return
end
local output = dir .. "/" .. filename
local output = dir .. "/" .. filename
-- Start typst watch
local cwd = vim.fn.getcwd() -- set the starting directory
-- Start typst watch
local cwd = vim.fn.getcwd() -- set the starting directory
-- TODO: root setting does not work
local watch_cmd = { "typst", "watch", "--root", cwd, input, output }
watch_job_id = vim.fn.jobstart(watch_cmd, {
stdout_buffered = false,
stderr_buffered = false, -- Ensure stderr is unbuffered for real-time error output
on_stderr = function(_, data)
if data then
if not watch_tab_id then
local pre_tab = vim.api.nvim_get_current_tabpage() -- Get the current tab ID
vim.cmd('tabnew') -- Open a new tab
watch_tab_id = vim.api.nvim_get_current_tabpage() -- Get the current tab ID
watch_buf_id = vim.api.nvim_get_current_buf() -- Get the buffer ID of the new tab
vim.api.nvim_buf_set_option(watch_buf_id, "swapfile", false)
vim.api.nvim_buf_set_name(watch_buf_id, "/tmp/TypstLog")
vim.api.nvim_buf_set_lines(watch_buf_id, 0, 0, false, { "Watching: " .. input }) -- Insert at the top
vim.cmd('write!')
vim.api.nvim_set_current_tabpage(pre_tab)
end
-- Write stdout data to the same buffer
for _, line in ipairs(data) do
if line ~= "" then
vim.api.nvim_buf_set_lines(watch_buf_id, -1, -1, false, { "[LOG] " .. line })
end
end
end
end,
on_exit = function(_, exit_code)
if exit_code == 0 then
vim.notify("Typst watch stopped successfully", vim.log.levels.INFO)
else
vim.notify("Typst watch stopped with errors", vim.log.levels.ERROR)
end
watch_job_id = nil
end,
})
vim.notify("Started Typst watch", vim.log.levels.INFO)
-- TODO: root setting does not work
local watch_cmd = { "typst", "watch", "--root", cwd, input, output }
watch_job_id = vim.fn.jobstart(watch_cmd, {
stdout_buffered = false,
stderr_buffered = false, -- Ensure stderr is unbuffered for real-time error output
on_stderr = function(_, data)
if data then
if not watch_tab_id then
local pre_tab = vim.api.nvim_get_current_tabpage() -- Get the current tab ID
vim.cmd('tabnew') -- Open a new tab
watch_tab_id = vim.api.nvim_get_current_tabpage() -- Get the current tab ID
watch_buf_id = vim.api.nvim_get_current_buf() -- Get the buffer ID of the new tab
vim.api.nvim_buf_set_option(watch_buf_id, "swapfile", false)
vim.api.nvim_buf_set_name(watch_buf_id, "/tmp/TypstLog")
vim.api.nvim_buf_set_lines(watch_buf_id, 0, 0, false, { "Watching: " .. input }) -- Insert at the top
vim.cmd('write!')
vim.api.nvim_set_current_tabpage(pre_tab)
end
-- Write stdout data to the same buffer
for _, line in ipairs(data) do
if line ~= "" then
vim.api.nvim_buf_set_lines(watch_buf_id, -1, -1, false, { "[LOG] " .. line })
end
end
end
end,
on_exit = function(_, exit_code)
if exit_code == 0 then
vim.notify("Typst watch stopped successfully", vim.log.levels.INFO)
else
vim.notify("Typst watch stopped with errors", vim.log.levels.ERROR)
end
watch_job_id = nil
end,
})
vim.notify("Started Typst watch", vim.log.levels.INFO)
vim.fn.system("killall .zathura-wrapped")
functions.sleep(0.5)
vim.fn.jobstart({ "zathura", output }, {
on_exit = function()
if watch_job_id then
vim.fn.jobstop(watch_job_id)
end
watch_job_id = nil
end,
})
vim.fn.system("killall .zathura-wrapped")
functions.sleep(0.5)
vim.fn.jobstart({ "zathura", output }, {
on_exit = function()
if watch_job_id then
vim.fn.jobstop(watch_job_id)
end
watch_job_id = nil
end,
})
end
function M.just_open()
-- Parse the current file and check for typst
local input = vim.fn.expand("%:p")
if not input:match("%.typ$") then
vim.notify("Not a Typst file", vim.log.levels.WARN)
return
end
local dir = vim.fn.fnamemodify(input, ":h") -- directory of the Typst file
local filename = vim.fn.expand("%:t:r") .. ".pdf" -- filename without extension + .pdf
local output = dir .. "/" .. filename
-- Start typst watch
local cwd = vim.fn.getcwd() -- set the starting directory
-- TODO: root setting does not work
local watch_cmd = { "typst", "compile", "--root", cwd, input, output }
vim.fn.jobstart(watch_cmd)
functions.sleep(0.5)
vim.fn.jobstart({ "sioyek", output })
end
return M

View File

@@ -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

View File

@@ -8,6 +8,12 @@ return {
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
require("gruvbox").setup({
palette_overrides = {
bright_yellow = "#AD5944"; -- workaround
}
})
vim.cmd.colorscheme("gruvbox")
transparentBackground()

View File

@@ -25,6 +25,14 @@ return {
{ "<leader>tw", function() require("custom.typst").watch_and_open() end, desc = "Watch Typst" },
},
},
{
dir = get_custom_dir("typst"),
name = "typst",
dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
keys = {
{ "<leader>tu", function() require("custom.typst").just_open() end, desc = "Open Typst" },
},
},
{
dir = get_custom_dir("journal"),
name = "journal",

View File

@@ -58,22 +58,44 @@ return {
config = function()
require("mason").setup()
-- Workaround for local zls
-- Workaround for local lsp only
-- does not work so nice on non nixos systems
local servers_modified = servers
for i, v in ipairs(servers_modified) do
if v == "zls" then
table.remove(servers_modified, i)
break
end
if v == "clangd" then
table.remove(servers_modified, i)
break
end
if v == "hls" then
table.remove(servers_modified, i)
break
end
end
require("mason-lspconfig").setup({
ensure_installed = servers_modified,
automatic_installation = true,
automatic_enable = false,
})
end,
},
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
{
path = "${3rd}/love2d/library", },
},
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
@@ -84,15 +106,17 @@ return {
},
config = function()
local cmp = require("cmp")
local border = "single"
local max_entries = 7
cmp.setup({
window = {
completion = cmp.config.window.bordered({
border = "rounded",
border = border,
scrollbar = false,
}),
documentation = cmp.config.window.bordered({
border = "rounded",
border = border,
scrollbar = false,
}),
},
@@ -112,8 +136,15 @@ return {
{ name = "buffer" },
{ name = "path" },
}),
performance = { max_view_entries = 25 },
performance = {
debounce = 60,
throttle = 30,
fetching_timeout = 500,
filtering_context_budget = 3,
confirm_resolve_timeout = 80,
async_budget = 1,
max_view_entries = max_entries,
}
})
end
},
@@ -124,22 +155,10 @@ return {
"L3MON4D3/LuaSnip",
},
config = function()
local lspconfig = require("lspconfig")
-- Custom overwrites for servers
local server_settings = {
lua_ls = {
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
},
},
},
}
local server_settings = {}
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local on_attach = function(_, bufnr)
local opts = { buffer = bufnr, noremap = true, silent = true }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
@@ -153,10 +172,12 @@ return {
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
--vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
-- vim.keymap.set("n", "<leader>lq", vim.diagnostic.setloclist, opts)
vim.keymap.set("n", "]d", function()
vim.diagnostic.jump({ count = 1, float = true })
end, opts)
vim.keymap.set("n", "[d", function()
vim.diagnostic.jump({ count = -1, float = true })
end, opts)
vim.keymap.set("n", "<leader>lwa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<leader>lwr", vim.lsp.buf.remove_workspace_folder, opts)
@@ -169,7 +190,7 @@ return {
end, opts)
end
-- Setup servers manually
-- Setup and enable servers manually
for _, server in ipairs(servers) do
local config = {
capabilities = capabilities,
@@ -178,7 +199,8 @@ return {
if server_settings[server] then
config = vim.tbl_deep_extend("force", config, server_settings[server])
end
lspconfig[server].setup(config)
vim.lsp.config(server, config)
vim.lsp.enable(server)
end
-- Add text in diagnostics

View File

@@ -16,6 +16,14 @@ return {
end)
end
},
--{
-- 'Exafunction/windsurf.vim',
-- event = 'BufEnter'
--},
{
"Ascyii/vim-gnupg",
dev = true
},
{
"akinsho/toggleterm.nvim",
config = function()
@@ -41,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({

View File

@@ -34,14 +34,8 @@ return {
{
"<leader>g",
function()
require('telescope.builtin').live_grep({
disable_devicons = true,
cwd = vim.fn.getcwd(),
additional_args = function()
return { '--hidden', '--glob', '!.git/*' }
end,
})
end
require('utils.functions').fzf_wrapped("grep")
end
},
{
"<leader>fh",
@@ -52,22 +46,41 @@ return {
{
"<leader><leader>",
function()
require('telescope.builtin').find_files({
hidden = true,
no_ignore = true,
follow = true,
disable_devicons = false,
prompt_title = "Find Files",
find_command = {
"rg", "--files",
"--glob", "!**/.git/*",
"--glob", "!**/build/*",
"--glob", "!**/*.{jpg,png,gif,mp4,mkv,tar,zip,iso}"
}
})
end
require('utils.functions').fzf_wrapped("find")
end
}
},
config = true,
},
{
"debugloop/telescope-undo.nvim",
dependencies = {
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
},
keys = {
{
"<leader>u",
"<cmd>Telescope undo<cr>",
desc = "undo history",
},
},
opts = {
extensions = {
undo = {
side_by_side = true,
layout_strategy = "vertical",
layout_config = {
preview_height = 0.7,
},
},
},
},
config = function(_, opts)
require("telescope").setup(opts)
require("telescope").load_extension("undo")
end,
}
}

View File

@@ -7,10 +7,14 @@ return {
local configs = require("nvim-treesitter.configs")
configs.setup({
sync_install = true,
ensure_installed = { "typst", "go", "bash", "python", "nix", "lua" },
ensure_installed = { "css", "html", "rust", "php", "typst", "go", "bash", "python", "nix", "lua", "cpp", "c", "java" },
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
fold = { enable = true },
ignore_install = {},
modules = {},
})
end
},

View File

@@ -27,6 +27,10 @@ return {
"<leader>ti",
":TypstarInsertRnote<CR>",
},
{
"<leader>td",
":TypstarDeleteRnote<CR>",
},
{
"<leader>to",
":TypstarOpenDrawing<CR>",

21
lua/utils/after.lua Normal file
View File

@@ -0,0 +1,21 @@
local function rounded_border()
return { '', '', '', '', '', '', '', '' }
end
-- Buffer the original fuction
local nvim_open_win = vim.api.nvim_open_win
-- Set color to a slight gray
vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'None', fg = '#a0a0a0' })
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'None' })
-- Border overwrite
vim.api.nvim_open_win = function(buf, enter, opts)
opts = opts or {}
if opts.border == nil then
opts.border = rounded_border()
end
return nvim_open_win(buf, enter, opts)
end

View File

@@ -2,88 +2,137 @@
local M = {}
function M.sleep(n)
os.execute("sleep " .. tonumber(n))
os.execute("sleep " .. tonumber(n))
end
--- @return string
function M.get_cwd()
local cwd = vim.fn.getcwd()
local home = os.getenv("HOME")
local cwd = vim.fn.getcwd()
local home = os.getenv("HOME")
if cwd:sub(1, #home) == home then
return "~" .. cwd:sub(#home + 1)
else
return cwd
end
if cwd:sub(1, #home) == home then
return "~" .. cwd:sub(#home + 1)
else
return cwd
end
end
function M.fzf_wrapped(type)
local t = require("telescope.builtin")
if type == "grep" then
t.live_grep({
disable_devicons = true,
cwd = vim.fn.getcwd(),
additional_args = function()
return { '--hidden', '--glob', '!.git/*' }
end,
})
end
if type == "find" then
t.find_files({
hidden = true,
no_ignore = true,
follow = true,
disable_devicons = false,
prompt_title = "Find Files",
find_command = {
"rg", "--files",
"--glob", "!**/.git/*",
"--glob", "!**/build/*",
"--glob", "!**/*.{jpg,png,gif,mp4,mkv,tar,zip,iso}"
}
})
end
end
--- @return {}
function M.get_lsp_servers()
local servers = { "lua_ls" }
local servers = { "lua_ls" }
-- persistent state file
local state_file = vim.fn.stdpath("state") .. "/mason_skipped_jonas.json"
-- persistent state file
local state_file = vim.fn.stdpath("state") .. "/mason_skipped_jonas.json"
-- load previous warnings
local warned = {}
local ok, data = pcall(vim.fn.readfile, state_file)
if ok and #data > 0 then
local decoded = vim.fn.json_decode(data)
if decoded then warned = decoded end
end
-- load previous warnings
local warned = {}
local ok, data = pcall(vim.fn.readfile, state_file)
if ok and #data > 0 then
local decoded = vim.fn.json_decode(data)
if decoded then warned = decoded end
end
local function save_state()
vim.fn.writefile({ vim.fn.json_encode(warned) }, state_file)
end
local function save_state()
vim.fn.writefile({ vim.fn.json_encode(warned) }, state_file)
end
local function warn_once(key, msg)
if not warned[key] then
vim.notify(msg, vim.log.levels.WARN)
warned[key] = true
save_state()
end
end
local function warn_once(key, msg)
if not warned[key] then
vim.notify(msg, vim.log.levels.WARN)
warned[key] = true
save_state()
end
end
local function populate_servers()
if vim.fn.executable("go") == 1 then
table.insert(servers, "gopls")
else
warn_once("gopls", "[mason] Skipping gopls (go not found)")
end
local function populate_servers()
if vim.fn.executable("go") == 1 then
table.insert(servers, "gopls")
else
warn_once("gopls", "[mason] Skipping gopls (go not found)")
end
if vim.fn.executable("npm") == 1 then
table.insert(servers, "pyright")
table.insert(servers, "clangd")
table.insert(servers, "bashls")
else
warn_once("npm", "[mason] Skipping pyright/clangd/bashls (npm not found)")
end
if vim.fn.executable("php") == 1 then
table.insert(servers, "intelephense")
else
warn_once("php", "[mason] Skipping intelephense (php not found)")
end
if vim.fn.executable("cargo") == 1 then
if vim.fn.executable("nix") == 1 then
table.insert(servers, "nil_ls")
else
warn_once("nix", "[mason] Skipping nil_ls and nixfmt (nix not found)")
end
table.insert(servers, "rust_analyzer")
else
warn_once("cargo", "[mason] Skipping nil_ls/rust_analyzer (cargo not found)")
end
if vim.fn.executable("hls") == 1 then
table.insert(servers, "hls")
else
warn_once("haskell", "[mason] Skipping hls (hls not found)")
end
if vim.fn.executable("deno") == 1 then
table.insert(servers, "denols")
else
warn_once("deno", "[mason] Skipping denols (deno not found)")
end
if vim.fn.executable("npm") == 1 then
if vim.fn.executable("clangd") == 1 then
table.insert(servers, "clangd")
end
-- Only configure zig when in local environment
if vim.fn.executable("zls") == 1 then
table.insert(servers, "zls")
end
end
if vim.fn.executable("java") == 1 then
table.insert(servers, "jdtls")
end
table.insert(servers, "pyright")
table.insert(servers, "bashls")
table.insert(servers, "cssls")
table.insert(servers, "html")
table.insert(servers, "jsonls")
else
warn_once("npm", "[mason] Skipping npm related (npm not found)")
end
populate_servers()
return servers
if vim.fn.executable("cargo") == 1 then
if vim.fn.executable("nix") == 1 then
table.insert(servers, "nil_ls")
else
warn_once("nix", "[mason] Skipping nil_ls and nixfmt (nix not found)")
end
table.insert(servers, "rust_analyzer")
else
warn_once("cargo", "[mason] Skipping nil_ls/rust_analyzer (cargo not found)")
end
if vim.fn.executable("deno") == 1 then
table.insert(servers, "ts_ls")
else
warn_once("deno", "[mason] Skipping denols and tsserver (deno not found)")
end
if vim.fn.executable("zls") == 1 then
table.insert(servers, "zls")
end
end
populate_servers()
return servers
end
return M

View File

@@ -1,17 +0,0 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
return {
s("cfo", { -- check for error
t("if err != nil {"), t({ "", "\t" }),
i(1, "return err"),
t({ "", "}" })
}),
s("struct", {
t("type "), i(1, "MyStruct"), t(" struct {"),
t({ "", "\t" }), i(2, "Field type"),
t({ "", "}" })
}),
}