" Disable compatibility with vi which can cause unexpected issues.
set nocompatible

" Enable type file detection. Vim will be able to try to detect the type of file in use.
filetype on

" Enable plugins and load plugin for the detected file type.
filetype plugin on

" Load an indent file for the detected file type.
filetype indent on

" Turn syntax highlighting on.
syntax on

" Add numbers to each line on the left-hand side.
set number

" Jump to line by relative number
set relativenumber
{% if (vimrc.cursor.blocky | default(True)) %}

" Highlight cursor line underneath the cursor horizontally.
set cursorline

" Highlight cursor line underneath the cursor vertically.
set cursorcolumn
{% endif %}
{% if (vim.tabs.spatialize | default(True)) %}

" Use space characters instead of tabs.
set expandtab

" Set tab width to 4 columns.
set tabstop={{ vimrc.tabs.gap | default(2) }}
{% endif %}

" While searching though a file incrementally highlight matching characters as you type.
set incsearch

" Show the mode you are on the last line.
set showmode

" Show matching words during a search.
set showmatch

" Use highlighting when doing a search.
set hlsearch

" Set the commands to save in history default number is 20.
set history={{ vimrc.history_span | default(20) }}
{% if (vimrc.typed_paths.autocomplete | default(True)) %}

" Enable auto completion menu after pressing TAB.
set wildmenu

" Make wildmenu behave like similar to Bash completion.
set wildmode=list:longest
{% if vimrc.typed_paths.ignore is defined and vimrc.typed_paths.ignore != None %}

" There are certain files that we would never want to edit with Vim.
" Wildmenu will ignore files with these extensions.
set wildignore={{ vimrc.typed_paths.ignore | join(',') }}
{% endif %}
{% endif %}

" PLUGINS ----------------------------------------------------------------

" Plugin code goes here.

call plug#begin('~/.vim/plugged')

  Plug 'flazz/vim-colorschemes'
{% if (vimrc.autodelimit | default(True)) %}
  Plug 'tpope/vim-surround'
{% endif %}
{% if (vimrc.git_spice | default(True)) %}
  Plug 'airblade/vim-gitgutter'
  Plug 'tpope/vim-fugitive'
{% endif %}
{% if (vimrc.status_line | default(True)) %}
  Plug 'vim-airline/vim-airline'
{% endif %}
{% if (vimrc.fancy_commenting | default(True)) %}
  Plug 'scrooloose/nerdcommenter'
{% endif %}
{% if (vimrc.ide | default(True)) %}
  Plug 'dense-analysis/ale'
{% endif %}

call plug#end()

" MAPPINGS ---------------------------------------------------------------

" Mappings code goes here.

" VIMSCRIPT --------------------------------------------------------------
{% if (vimrc.origami | default(True)) %}

" This will enable code folding.
" Use the marker method of folding.
augroup filetype_vim
    autocmd!
    autocmd FileType vim setlocal foldmethod=marker
augroup END
{% endif %}

" More Vimscripts code goes here.

" STATUS LINE ------------------------------------------------------------

" Status bar code goes here.
