mirror of
https://github.com/Ascyii/nvim.git
synced 2026-01-01 04:04:24 -05:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -28,7 +28,7 @@ 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 })
|
||||
@@ -51,10 +51,11 @@ vim.keymap.set("n", "<leader>fs", toggle_fold, opts) -- close all folds
|
||||
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')
|
||||
vim.keymap.set('n', '<leader>oczl', ':e ~/.config/nvim/lua/plugins/lsp.lua<CR>`.zz')
|
||||
vim.keymap.set('n', '<leader>oczl', ':e ~/.config/nvim/lua/config/lsp.lua<CR>`.zz')
|
||||
vim.keymap.set('n', '<leader>ocp', ':e ~/.config/nvim/lua/plugins/misc.lua<CR>`.zz')
|
||||
vim.keymap.set('n', '<leader>ocf', ':e ~/.config/nvim/lua/utils/functions.lua<CR>`.zz')
|
||||
vim.keymap.set('n', '<leader>oca', ':e ~/.config/nvim/lua/utils/after.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,12 +114,6 @@ 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('v', '<leader>y', function()
|
||||
vim.cmd('normal! "+y')
|
||||
vim.cmd('normal! gv')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -27,6 +27,10 @@ return {
|
||||
"<leader>ti",
|
||||
":TypstarInsertRnote<CR>",
|
||||
},
|
||||
{
|
||||
"<leader>td",
|
||||
":TypstarDeleteRnote<CR>",
|
||||
},
|
||||
{
|
||||
"<leader>to",
|
||||
":TypstarOpenDrawing<CR>",
|
||||
|
||||
Reference in New Issue
Block a user