syntax on
set background=dark
set nu
set ai
set si
set ts=4
set sts=4
set sw=4
set expandtab
set ww=[,],<,>
set bs=start,indent,eol
set hlsearch
set mouse=a
set display=uhex
set encoding=utf-8
set fileencoding=utf-8

map <F9> : ! open % <CR>
map <F8> : ! clear && gcc -pthread %<.c   -o %< -g -Wall -Wconversion -Wextra <CR>
map <F7> : ! clear && g++ -pthread %<.cpp -o %< -g -Wall -Wconversion -Wextra -Wno-deprecated-declarations<CR>
map <F6> : ! lldb ./%< <CR>
map <F2> : vs output.txt <CR>
map <F1> : vs input.txt <CR>

autocmd BufWritePre *.py :%s/\s\+$//e

nnoremap <F8> :call<SID>LongLineHLToggle()<cr>
hi OverLength ctermbg=none cterm=none
match OverLength /\%>80v/
fun! s:LongLineHLToggle()
    if !exists('w:longlinehl')
        let w:longlinehl = matchadd('ErrorMsg', '.\%>80v', 0)
        echo "Long lines highlighted"
    else
        call matchdelete(w:longlinehl)
        unl w:longlinehl
        echo "Long lines unhighlighted"
    endif
endfunction
