mirror of
https://github.com/Ascyii/nvim.git
synced 2026-01-01 04:04:24 -05:00
auto up 17:06:41 up 0:01, 2 users, load average: 0.30, 0.13, 0.05
This commit is contained in:
@@ -1,36 +1,45 @@
|
|||||||
-- Save the last file on exit
|
-- Save the last file on exit
|
||||||
vim.api.nvim_create_autocmd("VimLeave", {
|
vim.api.nvim_create_autocmd("VimLeave", {
|
||||||
callback = function()
|
callback = function()
|
||||||
local last_file = vim.fn.expand('%:p') -- Get the absolute path of the current file
|
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
|
if last_file ~= "" then -- The operator means not equal in lua
|
||||||
local file = io.open(vim.fn.stdpath('data') .. "/lastfile.txt", "w")
|
local file = io.open(vim.fn.stdpath('data') .. "/lastfile.txt", "w")
|
||||||
if file then
|
if file then
|
||||||
file:write(last_file)
|
file:write(last_file)
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "nix",
|
pattern = "nix",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.bo.tabstop = 2
|
vim.bo.tabstop = 2
|
||||||
vim.bo.shiftwidth = 2
|
vim.bo.shiftwidth = 2
|
||||||
vim.bo.expandtab = true
|
vim.bo.expandtab = true
|
||||||
end,
|
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", {
|
vim.api.nvim_create_augroup("RememberFolds", {
|
||||||
clear = true
|
clear = true
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
|
vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
|
||||||
group = "RememberFolds",
|
group = "RememberFolds",
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "silent! mkview",
|
command = "silent! mkview",
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||||
group = "RememberFolds",
|
group = "RememberFolds",
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "silent! loadview",
|
command = "silent! loadview",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,8 +30,4 @@ vim.opt.fillchars = "fold:╌"
|
|||||||
vim.g.GPGDefaultRecipients = {"C6772451703DE183A4983CBA063DC054484835A6"}
|
vim.g.GPGDefaultRecipients = {"C6772451703DE183A4983CBA063DC054484835A6"}
|
||||||
|
|
||||||
vim.o.expandtab = true -- Use spaces instead of tabs
|
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.smarttab = true -- Insert 'shiftwidth' spaces when pressing Tab
|
||||||
vim.o.autoindent = true -- Maintain indent of current line
|
|
||||||
vim.o.smartindent = true -- Smart auto-indenting
|
|
||||||
|
|||||||
Reference in New Issue
Block a user