call plug#begin('~/.config/nvim/plugged')
" Language Tools
Plug 'hrsh7th/nvim-compe'
Plug 'neovim/nvim-lspconfig'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'SirVer/ultisnips'
Plug 'luochen1990/rainbow'
" Plug 'enomsg/vim-haskellConcealPlus' " This one isn't always good.

" Languages
Plug 'evanleck/vim-svelte'
Plug 'LnL7/vim-nix'
Plug 'whonore/Coqtail'
Plug 'wlangstroth/vim-racket'
Plug 'lervag/vimtex'
Plug 'idris-hackers/idris-vim'
Plug 'rhysd/vim-crystal'
Plug 'elmcast/elm-vim'
Plug 'ap/vim-css-color'
Plug 'vim-scripts/avrasm.vim'
Plug 'idris-hackers/idris-vim'
Plug 'elixir-editors/vim-elixir'
Plug 'guersam/vim-j'
Plug 'wlangstroth/vim-racket'
Plug 'derekelkins/agda-vim'
Plug 'ftorres16/spice.vim'
Plug 'vmware/differential-datalog', {'rtp': 'tools/vim'}
Plug 'FStarLang/VimFStar', {'for': 'fstar'}

" Themes
Plug 'arcticicestudio/nord-vim'

" Editing Tools
Plug 'junegunn/goyo.vim'
Plug 'iamcco/markdown-preview.vim'
Plug 'junegunn/limelight.vim'
Plug 'luochen1990/rainbow'
Plug 'simrat39/symbols-outline.nvim'
Plug 'folke/todo-comments.nvim'

" Misc
Plug 'nvim-lua/plenary.nvim'
Plug 'airblade/vim-gitgutter'
call plug#end()

set exrc " Execute local vimscripts
set shiftwidth=4 " Make indents 4 chars wide
set expandtab " Expand tabs into spaces
set number " Set line numbers
set mouse=a " Allow mouse
set signcolumn=yes " Always show extra column
set guifont=Iosevka:h35 " Use Ioeska in frontends.
set hidden

autocmd BufRead,BufNewFile *.v set filetype=coq " Coq is not Verilog
autocmd BufNewFile,BufRead *.cir set filetype=spice " LTSpice is Spice
autocmd BufRead,BufNewFile *.dl set filetype=dl " Datalog is Datalog
autocmd FileType crystal setlocal shiftwidth=2 " Crystal likes 2-wide indent

" Settings for Rainbow
let g:rainbow_active = 1

" Settings for Limelight
let g:limelight_conceal_ctermfg = 8

" Settings for Vim's LaTeX plugin
let g:tex_flavor = 'latex'
let g:vimtex_quickfix_open_on_warning = 0
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'

" Settings for UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-k>"
let g:UltiSnipsJumpBackwardTrigger="<c-j>"

" Settings for FZF
let g:fzf_action = { 'enter': 'tab drop' }

" Settings for Neovide
let g:neovide_cursor_vfx_mode="ripple"

colorscheme nord

lua require('lspconfig').hls.setup{}
lua require('lspconfig').rls.setup{}
lua require('lspconfig').clangd.setup{}
lua require('lspconfig').tsserver.setup{}
lua require('lspconfig').elmls.setup{}
lua require('lspconfig').pylsp.setup{}

" nmap <silent>K <Plug>(lcn-menu)
nmap <silent>M <cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>
nmap <silent>? <cmd>lua vim.lsp.buf.hover()<CR>
nmap <silent>K <cmd>lua vim.lsp.buf.rename()<CR>

" Ctrl-e to open file in new tab (or jump to it)
nmap <c-e> :Files<CR>

" Autocompletion
set completeopt=menuone,noselect
let g:compe = {}
let g:compe.enabled = v:true
let g:compe.source = {
  \ 'path': v:true,
  \ 'buffer': v:true,
  \ 'nvim_lsp': v:true,
  \ }

" Racket settings
au BufReadPost *.rkt,*.rktl set filetype=racket
au filetype racket set lisp
au filetype racket set autoindent

" Coq Settings
function! g:CoqtailHighlight()
    hi default link CoqtailChecked Visual
    hi default link CoqtailSent PmenuSel
endfunction

lua << EOF
  require("todo-comments").setup {
    search = { command = "ag", },
  }
EOF
