auto up 17:06:41 up 0:01, 2 users, load average: 0.30, 0.13, 0.05

This commit is contained in:
2025-11-07 17:06:43 +01:00
parent 98bcb5f285
commit 067c267e26
2 changed files with 32 additions and 27 deletions

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",
})