-- vim: ft=lua

local execute = vim.api.nvim_command
local fn = vim.fn

local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'

if fn.empty(fn.glob(install_path)) > 0 then
  fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
  execute 'packadd packer.nvim'
end

vim.cmd 'filetype on'
vim.cmd 'filetype plugin on'
vim.cmd 'filetype indent on'
vim.cmd 'syntax enable'

local packer = require('packer')

packer.startup(function()

  -- fzf-like file navigator
  use 'nvim-telescope/telescope.nvim'
  use 'nvim-lua/popup.nvim'
  use 'nvim-lua/plenary.nvim'
  use 'kyazdani42/nvim-web-devicons'

  -- Better syntax highlighting
  use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }

  -- LSP config
  use 'neovim/nvim-lspconfig'
  use 'simrat39/rust-tools.nvim'

  -- Elixir
  use {'elixir-editors/vim-elixir', ft = { 'eelixir', 'elixir' }}

  -- Completion
  use 'hrsh7th/nvim-compe'

  -- Monokai theme
  use 'tanvirtin/monokai.nvim'

  -- Airline
  use 'vim-airline/vim-airline'
  use 'vim-airline/vim-airline-themes'

  -- Snippets
  use 'hrsh7th/vim-vsnip'

  -- Colemak keymap - This needs to be last
  use 'jooize/vim-colemak'
end)

require('settings')
require('keys')
require('highlight')
require('lsp')
require('completion')