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
    packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end

return require('packer').startup(function(use)

    use 'wbthomason/packer.nvim'

    -- Appearance
    --use 'shaunsingh/solarized.nvim'
    --use 'ishan9299/nvim-solarized-lua'
    use 'altercation/vim-colors-solarized'
    use 'lukas-reineke/indent-blankline.nvim'
    use 'sidebar-nvim/sidebar.nvim'
    use {
        'nvim-lualine/lualine.nvim',
        requires = {
            'kyazdani42/nvim-web-devicons'
        },
    }
    use {
        "nvim-neo-tree/neo-tree.nvim",
        branch = "v1.x",
        requires = {
            "nvim-lua/plenary.nvim",
            "kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
            "MunifTanjim/nui.nvim",
        },
    }
    use {
        'kyazdani42/nvim-tree.lua',
        requires = {
            'kyazdani42/nvim-web-devicons', -- optional, for file icon
        },
    }
    use 'folke/twilight.nvim'

    -- LSP integration
    use 'neovim/nvim-lspconfig'
    use 'ray-x/lsp_signature.nvim'

    -- Auto-completion
    use 'hrsh7th/nvim-cmp'
    use 'hrsh7th/cmp-nvim-lsp'
    use 'hrsh7th/cmp-buffer'
    use 'hrsh7th/cmp-path'
    use 'hrsh7th/cmp-cmdline'

    -- Snippets
    use 'dcampos/nvim-snippy'
    use 'dcampos/cmp-snippy'
    --use 'hrsh7th/cmp-vsnip'
    --use 'hrsh7th/vim-vsnip'

    -- Git integration
    use {
        'lewis6991/gitsigns.nvim',
        requires = {
            'nvim-lua/plenary.nvim'
        },
        -- tag = 'release' -- To use the latest release
    }
    use {
        'TimUntersberger/neogit',
        requires = {
            'nvim-lua/plenary.nvim'
        },
    }

    -- Language support
    use {
        'crispgm/nvim-go',
        requires = {
            'nvim-lua/plenary.nvim',
            'nvim-lua/popup.nvim'
        },
    }
    use 'rafaelsq/nvim-goc.lua'
    use 'vimwiki/vimwiki'
    use 'pearofducks/ansible-vim'

    -- others
    use 'folke/zen-mode.nvim'
    use {
        'nvim-telescope/telescope.nvim',
        requires = {
            'nvim-lua/plenary.nvim'
        },
    }
    use {
        'nvim-treesitter/nvim-treesitter',
        run = ':TSUpdate'
    }
    use 'nvim-treesitter/nvim-treesitter-textobjects'
    use {
        'glacambre/firenvim',
        run = function() vim.fn['firenvim#install'](0) end
    }

    -- Automatically set up your configuration after cloning packer.nvim
    -- Put this at the end after all plugins
    if packer_bootstrap then
        require('packer').sync()
    end
end)
