local opt = vim.opt
local var = vim.g
local key = vim.keymap
-- tabs
opt.tabstop = 4
opt.softtabstop = 4
opt.shiftwidth = 4
opt.expandtab = true
opt.smartindent = true
-- search
opt.showmatch = true
opt.ignorecase = true
opt.smartcase = true
opt.swapfile = false -- noswapfile
opt.clipboard = "unnamedplus"
opt.undofile = true -- persistent undo
vim.cmd("syntax on")
opt.termguicolors = true
opt.number = true
opt.relativenumber = true
opt.numberwidth = 2
opt.cursorline = true
opt.background = "dark"
var.gruvbox_improved_warnings = 1
vim.cmd("colorscheme gruvbox")
vim.cmd([[autocmd VimEnter * hi Normal ctermbg=NONE guibg=NONE]])
-- keybindings
var.mapleader = " "
var.localleader = " "
-- splits
key.set("n", "<leader>h", "<C-w>h")
key.set("n", "<leader>j", "<C-w>j")
key.set("n", "<leader>k", "<C-w>k")
key.set("n", "<leader>l", "<C-w>l")
key.set("n", "<leader>L", ":vs<CR>")
key.set("n", "<leader>J", ":sp<CR>")
opt.splitright = true
opt.splitbelow = true
key.set("n", "<Esc><Esc>", ":nohlsearch<CR>", { silent = true })
key.set("n", "<leader>w", ":w!<CR>")
key.set("n", "<leader>W", ":wq!<CR>")
key.set("t", [[<C-\]], [[<C-\><C-n>]])
vim.api.nvim_create_autocmd("FileType", { pattern=[[html,css]], command = "EmmetInstall" })
var.user_emmet_mode = "n"
var.user_emmet_install_global = 0
var.user_emmet_leader_key = ","