vim.cmd([[
try
    if exists('+termguicolors')
        set termguicolors
    endif
    colorscheme yah
catch
    colorscheme desert
endtry
]])

vim.g.mapleader = " "
vim.opt.incsearch = true
vim.opt.ignorecase = true
vim.opt.smartcase = true

vim.cmd(":filetype plugin indent on")
vim.cmd(":syntax enable")

vim.opt.backspace = "indent,eol,start"
vim.opt.smarttab = true

vim.opt.ruler = true
vim.opt.wildmenu = true

vim.opt.gdefault = true vim.opt.autoread = true vim.opt.history = 1000
vim.opt.encoding = "utf-8"
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.laststatus = 2
vim.opt.showcmd = true
vim.opt.showmatch = true
vim.opt.cmdheight = 3
vim.opt.list = true
vim.opt.listchars = "tab:>>,trail:_,eol:$,multispace:ยทยท,extends:>,precedes:<,nbsp:%"
vim.opt.encoding = "utf-8"
vim.opt.fenc = "utf-8"

{{- if eq .chezmoi.username "root" }}
vim.opt.expandtab = false
{{- else }}
vim.opt.expandtab = true
{{- end }}
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4

-- abbreviations
vim.cmd(":ca cd. lcd %:p:h")
vim.cmd(':ca mkdir. call mkdir(expand("%:p:h"), "p")')
{{- if ne .chezmoi.username "root" }}
vim.cmd(':ca W! w !sudo -A tee %')
{{- end }}

{{- if (and (eq .hosttype "desktop" "laptop") (eq .chezmoi.os "linux")) }}
vim.cmd([[ autocmd InsertLeave * call system("fcitx5-remote -c") ]])
{{- end }}


vim.cmd("set clipboard+=unnamedplus")