local opt = vim.opt

-- Use system clipboard
vim.opt.clipboard = "unnamedplus"

-- [[ Context ]]
opt.colorcolumn = '100'   -- str:  Show col for max line length
opt.number = true         -- bool: Show line numbers
opt.relativenumber = true -- bool: Show relative line numbers
opt.scrolloff = 10        -- int:  Min num lines of context
opt.signcolumn = "yes"    -- str:  Show the sign column

-- [[ Filetypes ]]
opt.encoding = 'utf8' -- str:  String encoding to use
-- opt.fileencoding = 'utf8'        -- str:  File encoding to use
vim.filetype.add({ extension = { wgsl = "wgsl" } })

-- [[ Theme ]]
opt.syntax = "ON"        -- str:  Allow syntax highlighting
opt.termguicolors = true -- bool: If term supports ui color then enable

-- [[ Search ]]
opt.ignorecase = true -- bool: Ignore case in search patterns
opt.smartcase = true  -- bool: Override ignorecase if search contains capitals
opt.incsearch = true  -- bool: Use incremental search
opt.hlsearch = false  -- bool: Highlight search matches

-- [[ Whitespace ]]
-- opt.expandtab = true             -- bool: Use spaces instead of tabs
opt.shiftwidth = 4  -- num:  Size of an indent
opt.softtabstop = 4 -- num:  Number of spaces tabs count for in insert mode
opt.tabstop = 4     -- num:  Number of spaces tabs count for
opt.list = true     -- show some whitespace

-- [[ Splits ]]
opt.splitright = true -- bool: Place new window to right of current one
opt.splitbelow = true -- bool: Place new window below the current one

--Set completeopt to have a better completion experience
-- :help completeopt
-- menuone: popup even when there's only one match
-- noinsert: Do not insert text until a selection is made
-- noselect: Do not select, force to select one from the menu
-- shortness: avoid showing extra messages when using completion
-- updatetime: set updatetime for CursorHold
vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert' }
vim.opt.shortmess = vim.opt.shortmess + { c = true }
vim.api.nvim_set_option('updatetime', 300)

-- Uncomment to enable treesitter folding by default
--vim.wo.foldmethod = 'expr'
--vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
