local g = vim.g
local opt = vim.opt

g.mapleader = ' '
g.tex_flavor = 'latex'
g.c_syntax_for_h = true
vim.cmd [[
let g:VM_default_mappings 	    = 0
let g:VM_mouse_mappings             = 1
let g:VM_leader                     = {'default': ',', 'visual': ',', 'buffer': ','}
let g:VM_maps                       = {}
let g:VM_maps['i']                  = 'l'
let g:VM_maps['I']                  = 'L'
let g:VM_maps['Find Under']         = '<c-h>'
let g:VM_maps["Add Cursor At Pos"]  = ',,'
let g:VM_maps['Find Subword Under'] = '<c-h>'
let g:VM_maps["Add Cursor Down"]    = '<C-n>'
let g:VM_maps["Add Cursor Up"]      = '<C-e>'
let g:VM_maps['Find Next']          = 'k'
let g:VM_maps['Find Prev']          = 'K'
let g:VM_custom_motions             = {'n': 'j', 'j': 'n', 'l': 'i', 'e': 'k', 'i': 'l'}
function! NvimGdbNoTKeymaps()
  tnoremap <silent> <buffer> <esc> <c-\><c-n>
endfunction

let g:nvimgdb_config_override = {
  \ 'key_next': 'k',
  \ 'key_step': 's',
  \ 'key_finish': 'f',
  \ 'key_continue': 'c',
  \ 'key_until': 'u',
  \ 'key_breakpoint': 'b',
  \ 'set_tkeymaps': "NvimGdbNoTKeymaps",
  \ }
]]

opt.termguicolors = true
opt.mouse = 'nv'
-- opt.fileencoding = 'utf-8'
opt.splitbelow = true
opt.splitright = true
opt.showmode = false
opt.undofile = true
opt.updatetime = 300
opt.backup = false
-- vim.api.nvim_set_option("clipboard","unnamed")
opt.clipboard:prepend { 'unnamedplus', 'unnamed' }
opt.ignorecase = true
opt.smartcase = true
opt.sessionoptions = 'folds'
opt.foldlevelstart = 1
opt.number = true
opt.shortmess:append('I', 'W', 's')
opt.iskeyword:prepend { '-' }
opt.timeoutlen = 300
opt.fillchars = 'eob: '
opt.cmdheight = 1
opt.grepprg = 'rg --vimgrep --no-heading --smart-case --hidden'
opt.grepformat = '%f:%l:%c:%m'
opt.completeopt= 'menu,preview,menuone,noselect'
opt.cursorline = true
opt.signcolumn = "yes:1"
-- opt.cursorlineopt = 'number'
vim.opt.formatoptions:remove("c")

vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 })
vim.api.nvim_create_user_command('Grep', 'silent grep! <args> | TroubleToggle quickfix', { nargs = '+' })
vim.cmd([[
hi NotifyBackground guibg = #000000
]])
