set nocompatible
filetype plugin indent on
syntax enable
set encoding=utf-8
set number relativenumber
set numberwidth=4
set tabstop=4 shiftwidth=4 expandtab smartindent
set incsearch hlsearch ignorecase smartcase
set wrap
set mouse=a
set scrolloff=5
set cursorline
set noshowmode
set shortmess+=I
set autoindent

set statusline=%#StatusLineMode#
set statusline+=\ %{ModeName()}
set statusline+=%#StatusLine#
set statusline+=\ %f\ %m\ %r\ %y
set statusline+=%=
set statusline+=\ Ln:%l/%L\ Col:%c\ \[%p%%]

hi Normal       guibg=NONE ctermbg=NONE guifg=#eeeeee ctermfg=254
hi NormalNC     guibg=NONE ctermbg=NONE guifg=#888888 ctermfg=240
hi LineNr       guibg=NONE ctermbg=NONE guifg=#555555 ctermfg=242
hi CursorLine   guibg=NONE ctermbg=NONE guifg=NONE    ctermfg=NONE
hi VertSplit    guibg=NONE ctermbg=NONE guifg=#444444 ctermfg=240
hi StatusLine   guibg=NONE guifg=#cccccc ctermbg=NONE ctermfg=250
hi StatusLineMode guibg=NONE guifg=#bbbbbb ctermbg=NONE ctermfg=247 gui=bold
hi Visual     guibg=#222222 guifg=NONE ctermbg=234 ctermfg=NONE
hi VisualNOS  guibg=#222222 guifg=NONE ctermbg=234 ctermfg=NONE
hi VisualSB     guibg=NONE guifg=NONE    ctermbg=NONE ctermfg=NONE
hi Search       guibg=NONE guifg=#bbbbbb ctermbg=NONE ctermfg=247
hi IncSearch    guibg=NONE guifg=#ffffff ctermbg=NONE ctermfg=255
hi Pmenu        guibg=NONE guifg=#dddddd ctermbg=NONE ctermfg=254
hi PmenuSel     guibg=NONE guifg=#000000 ctermbg=NONE ctermfg=16
hi WildMenu     guibg=NONE guifg=#bbbbbb ctermbg=NONE ctermfg=247
hi Folded       guibg=NONE guifg=#666666 ctermbg=NONE ctermfg=242
hi SignColumn   guibg=NONE guifg=#888888 ctermbg=NONE ctermfg=240

function! ModeName()
let modeval = mode()
return modeval ==# 'n'   ? 'NML '  :
\ modeval ==# 'i'   ? 'INT '  :
\ modeval ==# 'v'   ? 'VSL '  :
\ modeval ==# 'V'   ? 'VLI '  :
\ modeval ==# "\<C-v>" ? 'VBL ' :
\ modeval ==# 'R'   ? 'RPL ' :
\ modeval ==# 'c'   ? 'CMD ' :
\ 'UNKNOWN'
endfunction

let mapleader = "\<Space>"
nnoremap <leader>w \:w<CR>
nnoremap <leader>q \:q<CR>
nnoremap <silent> <leader>h \:nohlsearch<CR>
nnoremap <leader>n \:set relativenumber!<CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <leader>cd :Ex<CR>

"disable arrow keys
nnoremap <Up> <NOP>
nnoremap <Down> <NOP>
nnoremap <Left> <NOP>
nnoremap <Right> <NOP>

map j gj
map k gk

set termguicolors
set list
set listchars=

set backupdir=~/.cache/nvim/backup
set directory=~/.cache/nvim/swap
set undodir=~/.cache/nvim/undo
set undofile
set wrapscan
set shortmess+=c
set autoread
set cmdheight=1
set belloff=all
set laststatus=2
set smoothscroll
set scrolljump=3
set hidden
set splitbelow
set splitright
set nobackup
set nowritebackup
set lazyredraw
set guicursor=n:hor100A,i:ver100,r:block

call plug#begin('~/.local/share/nvim/plugged')
Plug 'tpope/vim-sensible'
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-repeat'
Plug 'mattn/emmet-vim'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'andweeb/presence.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()


lua << EOF
require'nvim-treesitter.configs'.setup {
  ensure_installed = { "c", "cpp", "python", "lua", "javascript", "typescript", "bash" },
  highlight = {
    enable = true,
    additional_vim_regex_highlighting = false,
  },
}
EOF
