local o          = vim.opt

-- set options
o.clipboard      = "unnamedplus"                           -- keep the clipboard in sync with the one provided by the OS
o.cursorline     = true                                    -- highlight the current line
o.ignorecase     = true                                    -- whether case should be ignored whilst searching
o.list           = true                                    -- shows invisible characters
o.listchars      = {                                       -- whitespace characters
	eol = nil,
	trail = '~',
	extends = nil,
	precedes = '<',
	tab = '•-',
	space = '·',
	nbsp = '␣',
}
o.number         = true                               -- show line numbers
o.relativenumber = true                               -- whether line numbers are relative to the cursor
o.sessionoptions = 'buffers,curdir,folds,help,localoptions,tabpages,terminal'
o.shiftwidth     = 8                                  -- spaces for auto-indent
o.showmode       = false                              -- don't show mode as this is already in the status line
o.signcolumn     = 'yes'                              -- always show the signcolumn, otherwise it shifts text all the time
o.smartcase      = true                               -- overrides the above option if contains capital letters
o.smartindent    = true                               -- behave a bit more nuanced with when to indent
o.spell          = true                               -- whether spell checking is enabled
o.spellfile      = vim.fn.stdpath('config') .. '/spell/user.utf-8.add'
o.spelllang      = 'en_gb,nl'                         -- set the spell languages
o.termguicolors  = true                               -- allows for colour in the terminal
o.timeoutlen     = 300                                -- number of MS to wait for a mapped sequence to complete
o.ttimeoutlen    = 0                                  -- number of MS to wait for a key sequence to complete
o.undodir        = vim.fn.stdpath('cache') .. '/undo' -- directory for undo files
o.undofile       = true                               -- for saving the undo history
o.undolevels     = 1024                               -- the amount of changes that can be undone
o.updatetime     = 250                                -- number of MS of nothing typed to write a swap file to disk.
o.wrap           = false                              -- whether to wrap text to a new line when it goes off-screen

vim.diagnostic.config({
	underline        = true, -- use underline for diagnostics
	virtual_text     = true, -- shows diagnostics at the end of the line
	virtual_lines    = false, -- shows one diagnostic per line
	severity_sort    = true, -- sort diagnostics by severity
	update_in_insert = true, -- update diagnostics whilst in insert mode
	float            = true, -- options for floating windows
	signs            = true,
})
