local vim = vim

vim.o.number = true
vim.o.relativenumber = true
vim.o.tabstop = 2
vim.o.shiftwidth = 2
vim.o.wrap = false
vim.o.scrolloff = 5
vim.o.colorcolumn = "80"
vim.o.wildmenu = true
vim.o.wildmode = "longest:full,full"
vim.o.wildoptions = "pum"
vim.g.mapleader = " "
vim.o.termguicolors = true
vim.o.winborder = "double"
vim.o.clipboard = "unnamedplus"
vim.o.completeopt = "menuone"
-- vim.o.completeopt = "menuone,noinsert,noselect"
vim.o.cursorline = true
vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
vim.g.netrw_keepdir = 1
vim.g.netrw_winsize = 15
vim.g.netrw_banner = 0
vim.g.netrw_localcopydircmd = 'cp -avr'
vim.g.netrw_liststyle = 3
vim.g.netrw_browse_split = 4

vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldlevel = 1
vim.o.foldenable = true

vim.o.undofile = true
vim.o.undodir = vim.fn.stdpath("data") .. "/undo"

vim.api.nvim_create_autocmd("FileType", {
	pattern = "help",
	callback = function()
		vim.opt_local.wrap = true
	end,
})

vim.api.nvim_create_autocmd("FileType", {
	pattern = "markdown",
	callback = function()
		vim.opt_local.wrap = true
	end,
})

vim.api.nvim_create_autocmd("BufWritePost", {
	pattern = ".wiki",
	callback = function()
		vim.cmd("VimwikiGenerateLinks")
	end,
})
