set nocompatible
filetype off

" Install all plugins:
" $ vim +PlugInstall

call plug#begin('~/.local/vim/plugged')
Plug 'bling/vim-airline'             " Lean & mean status/tabline for vim that's light as air.
Plug 'sjl/badwolf'                   " A Vim color scheme.
Plug 'rust-lang/rust.vim'            " Vim configuration for Rust.
Plug 'cespare/vim-toml'              " Vim syntax for TOML.
Plug 'leafOfTree/vim-vue-plugin'     " Vim syntax and indent plugin for .vue files.
Plug 'leafOfTree/vim-svelte-plugin'  " Vim syntax and indent plugin for .svelte files.
call plug#end()


syntax on           " Enable syntax highlighting.
colorscheme badwolf " Select the theme.


filetype plugin indent on " Load the plugin and indent file depending on the file type.
set expandtab             " Use spaces instead of tabs.
set tabstop=4             " Number of spaces that a <Tab> in the file counts for.
set softtabstop=4         " Number of spaces that a <Tab> counts for while performing editing operations.
set shiftwidth=4          " Number of spaces to use for each step of (auto)indent.


set laststatus=2 " Always display the status line.
set number       " Show line numbers.
set cursorline   " Highlight current line
set wildmenu     " Visual autocomplete for command menu
set lazyredraw   " Redraw only when we need to.
set showmatch    " Highlight matching [{()}]
set mouse=       " Disable mouse support


set incsearch  " Search as characters are entered.
set hlsearch   " Highlight matches.
" Turn off search highlight with <leader><space>.
nnoremap <leader><space> :nohlsearch<CR>


" Move vertically by visual line.
nnoremap j gj
nnoremap k gk


" Fix a rendering issue with terminals without the bce capability
" https://sw.kovidgoyal.net/kitty/faq.html#using-a-color-theme-with-a-background-color-does-not-work-well-in-vim
let &t_ut=''


" Line number modes
:set number relativenumber
:augroup numbertoggle
:  autocmd!
:  autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
:  autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
:augroup END


" indentLine
let g:indentLine_char = '⦙'
let g:indentLine_setConceal = 0


" Tera templates
autocmd BufNewFile,BufRead *.tera set syntax=htmldjango

" Svelte
let g:vim_svelte_plugin_use_typescript = 1