mirror of
https://github.com/Ascyii/nvim.git
synced 2026-01-01 04:04:24 -05:00
Implemented folding and some improvements. Moved functions to the utils module
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
-- Save the last file on exit
|
||||
vim.api.nvim_create_autocmd("VimLeave", {
|
||||
callback = function()
|
||||
-- Save the last file path to a file
|
||||
local last_file = vim.fn.expand('%:p') -- Get the absolute path of the current file
|
||||
if last_file ~= "" then
|
||||
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)
|
||||
@@ -12,3 +11,18 @@ vim.api.nvim_create_autocmd("VimLeave", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_augroup("RememberFolds", {
|
||||
clear = true
|
||||
})
|
||||
vim.api.nvim_create_autocmd({"BufWinLeave"}, {
|
||||
group = "RememberFolds",
|
||||
pattern = "*",
|
||||
command = "silent! mkview",
|
||||
})
|
||||
vim.api.nvim_create_autocmd({"BufWinEnter"}, {
|
||||
group = "RememberFolds",
|
||||
pattern = "*",
|
||||
command = "silent! loadview",
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user