50 lines
1.1 KiB
Lua
50 lines
1.1 KiB
Lua
require("config.options")
|
|
require("config.keymaps")
|
|
require("config.lazy")
|
|
require("custom.functions")
|
|
local viewgroup = vim.api.nvim_create_augroup("RememberFolds", { clear = true })
|
|
|
|
local allowed_rem_filetypes = {
|
|
lua = true,
|
|
python = true,
|
|
r = true,
|
|
bash = true,
|
|
c = true,
|
|
sql = true,
|
|
["c++"] = true, -- in case filetype is "c++"
|
|
cpp = true, -- sometimes C++ is "cpp"
|
|
java = true,
|
|
rust = true,
|
|
go = true,
|
|
wiki = true,
|
|
vimwiki = true,
|
|
}
|
|
|
|
vim.api.nvim_create_autocmd("BufWinLeave", {
|
|
group = viewgroup,
|
|
pattern = "*",
|
|
callback = function()
|
|
-- Exclude terminal and Telescope buffers from mkview
|
|
local ft = vim.bo.filetype:lower()
|
|
if not allowed_rem_filetypes[ft] then
|
|
return
|
|
end
|
|
vim.cmd("mkview")
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("BufWinEnter", {
|
|
group = viewgroup,
|
|
pattern = "*",
|
|
callback = function()
|
|
-- Exclude terminal and Telescope buffers from loadview
|
|
local ft = vim.bo.filetype:lower()
|
|
if not allowed_rem_filetypes[ft] then
|
|
return
|
|
end
|
|
vim.cmd("silent! loadview")
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|