many changes
This commit is contained in:
@@ -42,7 +42,7 @@ vim.opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will
|
||||
vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo"
|
||||
vim.opt.undofile = true -- enable persistent undo
|
||||
vim.opt.updatetime = 300 -- faster completion
|
||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program) it is not allowed to be edited
|
||||
vim.opt.writebackup = false -- if a file is being edited by another program it is not allowed to be edited
|
||||
vim.opt.expandtab = true -- convert tabs to spaces
|
||||
vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation
|
||||
vim.opt.tabstop = 2 -- insert 2 spaces for a tab
|
||||
@@ -50,9 +50,38 @@ vim.opt.cursorline = true -- highlight the current line
|
||||
vim.opt.number = true -- set numbered lines
|
||||
vim.opt.relativenumber = false -- set relative numbered lines
|
||||
vim.opt.numberwidth = 4 -- set number column width to 2 {default 4}
|
||||
vim.opt.signcolumn = "yes" -- always show the sign column otherwise it would shift the text each time
|
||||
vim.opt.signcolumn = "yes" -- always show the sign column otherwise text shifts each time
|
||||
vim.opt.wrap = false -- display lines as one long line
|
||||
vim.opt.spell = false
|
||||
vim.opt.spelllang = "en"
|
||||
vim.opt.scrolloff = 8 -- is one of my fav
|
||||
vim.opt.scrolloff = 8 -- keep 8 lines above/below the cursor
|
||||
vim.opt.sidescrolloff = 8
|
||||
|
||||
-- Automatically disable heavy features for very large files
|
||||
local largefile_group = vim.api.nvim_create_augroup("LargeFile", { clear = true })
|
||||
vim.api.nvim_create_autocmd("BufReadPre", {
|
||||
group = largefile_group,
|
||||
pattern = "*",
|
||||
callback = function(args)
|
||||
local max_filesize = 1 * 1024 * 1024 -- 1 MB in bytes
|
||||
local file = vim.fn.expand("<afile>")
|
||||
if vim.fn.getfsize(file) > max_filesize then
|
||||
-- Turn off syntax highlighting
|
||||
vim.cmd("syntax off")
|
||||
-- Disable Treesitter's highlight for this buffer
|
||||
pcall(vim.cmd, "TSBufDisable highlight")
|
||||
|
||||
-- Optionally disable LSP for this buffer
|
||||
for _, client in pairs(vim.lsp.get_active_clients()) do
|
||||
if client ~= nil and client.attached_buffers[args.buf] then
|
||||
client.detach(args.buf)
|
||||
end
|
||||
end
|
||||
|
||||
-- You can also disable or reduce other settings if needed, e.g.:
|
||||
vim.opt.foldmethod = "manual"
|
||||
vim.opt.wrap = false
|
||||
vim.opt.hlsearch = false
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user