2021-09-16 20:32:29 +00:00
-- Install packer
2021-12-15 17:37:51 +00:00
local install_path = vim.fn . stdpath ( " data " ) .. " /site/pack/packer/opt/packer.nvim "
2021-12-10 20:04:13 +00:00
local packer_bootstrap = false
2021-08-24 17:38:14 +00:00
if vim.fn . empty ( vim.fn . glob ( install_path ) ) > 0 then
2021-12-15 17:37:51 +00:00
packer_bootstrap = vim.fn . system ( { " git " , " clone " , " https://github.com/wbthomason/packer.nvim " , install_path } )
2021-08-24 17:38:14 +00:00
end
2021-12-15 17:37:51 +00:00
vim.cmd ( " packadd packer.nvim " )
2021-08-24 17:38:14 +00:00
2021-08-25 23:21:50 +00:00
-- Configures dark-notify to use colors from my environment
2021-08-24 17:38:14 +00:00
local function config_dark_notify ( )
2021-12-15 17:37:51 +00:00
require ( " dark_notify " ) . run ( {
2021-09-16 20:32:29 +00:00
onchange = function ( _ )
-- Defined in _colors
_G.update_colors ( )
2021-08-24 17:38:14 +00:00
end ,
2021-12-15 17:37:51 +00:00
} )
2021-08-24 17:38:14 +00:00
end
2021-12-15 00:20:07 +00:00
-- Pin version dependent packages
2021-12-15 16:43:34 +00:00
local pinned_commits = { }
2021-12-15 17:37:51 +00:00
if vim.fn . has ( " nvim-0.6.0 " ) ~= 1 then
if vim.fn . has ( " nvim-0.5.1 " ) == 1 then
2021-12-15 16:43:34 +00:00
-- Last commit compatible with 0.5.1
2021-12-15 00:20:07 +00:00
pinned_commits [ " telescope " ] = " 80cdb00b221f69348afc4fb4b701f51eb8dd3120 "
2021-12-15 17:37:51 +00:00
elseif vim.fn . has ( " nvim-0.5.0 " ) == 1 then
2021-12-15 16:43:34 +00:00
-- Last commit compatible with 0.5.1
2021-12-15 00:20:07 +00:00
pinned_commits [ " telescope " ] = " 587a10d1494d8ffa1229246228f0655db2f0a48a "
end
end
2021-12-16 22:32:23 +00:00
return require ( " packer " ) . startup ( { function ( use )
2021-12-10 20:04:13 +00:00
-- Load things faster!
2021-12-15 17:37:51 +00:00
use ( { " lewis6991/impatient.nvim " , config = [[require('impatient')]] } )
2021-12-08 23:28:12 +00:00
2021-12-10 20:04:13 +00:00
-- Let Packer manage and lazyload itself
2021-12-15 17:37:51 +00:00
use ( {
2021-12-10 20:04:13 +00:00
" wbthomason/packer.nvim " ,
cmd = {
" PackerClean " ,
" PackerCompile " ,
" PackerInstall " ,
" PackerLoad " ,
" PackerProfile " ,
" PackerStatus " ,
" PackerSync " ,
" PackerUpdate " ,
} ,
config = [[require("plugins")]] ,
2021-12-15 17:37:51 +00:00
} )
2021-08-24 17:38:14 +00:00
2021-12-10 20:04:13 +00:00
-- Colorschemes
2021-12-15 17:37:51 +00:00
use ( {
2021-12-10 20:04:13 +00:00
" vim-scripts/wombat256.vim " ,
{ " ViViDboarder/wombat.nvim " , requires = " rktjmp/lush.nvim " } ,
{ " ViViDboarder/wombuddy.nvim " , requires = " tjdevries/colorbuddy.vim " } ,
" ishan9299/nvim-solarized-lua " ,
{
" folke/tokyonight.nvim " ,
2021-12-15 17:37:51 +00:00
run = ' fish -c \' echo "set --path --prepend fish_themes_path "(pwd)"/extras" > ~/.config/fish/conf.d/tokyonight.fish \' || true ' , -- luacheck: no max line length
2021-12-10 20:04:13 +00:00
} ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Auto and ends to some ifs and dos
2021-12-15 17:37:51 +00:00
use ( " tpope/vim-endwise " )
2021-12-10 20:04:13 +00:00
-- Unix commands from vim? Yup!
2021-12-15 17:37:51 +00:00
use ( " tpope/vim-eunuch " )
2021-12-10 20:04:13 +00:00
-- Adds repeats for custom motions
2021-12-15 17:37:51 +00:00
use ( " tpope/vim-repeat " )
2021-12-10 20:04:13 +00:00
-- Readline shortcuts
2021-12-15 17:37:51 +00:00
use ( " tpope/vim-rsi " )
2021-12-10 20:04:13 +00:00
-- Surround motions
2021-12-15 17:37:51 +00:00
use ( " tpope/vim-surround " )
2021-12-10 20:04:13 +00:00
-- Better netrw
2021-12-15 17:37:51 +00:00
use ( " tpope/vim-vinegar " )
2021-12-10 20:04:13 +00:00
-- Easier jumping to lines
2021-12-15 17:37:51 +00:00
use ( " vim-scripts/file-line " )
2021-12-10 20:04:13 +00:00
-- Auto ctags generation
2021-12-15 17:37:51 +00:00
use ( " ludovicchabant/vim-gutentags " )
2021-12-10 20:04:13 +00:00
2021-12-11 00:54:37 +00:00
-- Make it easier to discover some of my keymaps
2021-12-15 17:37:51 +00:00
use ( {
2021-12-11 00:54:37 +00:00
" folke/which-key.nvim " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " plugins.whichkey " ) . configure ( )
end ,
} )
2021-12-11 00:54:37 +00:00
2021-12-10 20:04:13 +00:00
-- Better commenting
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" tomtom/tcomment_vim " ,
config = function ( )
2021-12-15 17:37:51 +00:00
vim.api . nvim_set_keymap ( " n " , " // " , " :TComment<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " v " , " // " , " :TCommentBlock<CR> " , { silent = true , noremap = true } )
2021-08-24 17:38:14 +00:00
end ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Allow wrapping and joining of arguments across multiple lines
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" FooSoft/vim-argwrap " ,
config = function ( )
2021-12-15 17:37:51 +00:00
vim.api . nvim_set_keymap ( " n " , " <Leader>a " , " :ArgWrap<CR> " , { silent = true , noremap = true } )
2021-08-24 17:38:14 +00:00
end ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Adds git operations to vim
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" tpope/vim-fugitive " ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Quick toggling of Location and Quickfix lists
2021-12-15 17:37:51 +00:00
use ( {
2021-08-25 23:21:50 +00:00
" milkypostman/vim-togglelist " ,
config = function ( )
2021-12-15 17:37:51 +00:00
vim.api . nvim_set_keymap ( " n " , " <F6> " , " :call ToggleQuickfixList()<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <F7> " , " :call ToggleLocationList()<CR> " , { silent = true , noremap = true } )
2021-08-25 23:21:50 +00:00
end ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Find text everywhere!
2021-12-15 17:37:51 +00:00
use ( {
2021-09-30 17:59:26 +00:00
" mhinz/vim-grepper " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " plugins.grepper " )
end ,
} )
2021-08-24 17:38:14 +00:00
2021-12-10 20:04:13 +00:00
-- Highlight inline colors
2021-12-15 17:37:51 +00:00
use ( {
2021-09-01 17:03:05 +00:00
" norcalli/nvim-colorizer.lua " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " colorizer " ) . setup ( )
end ,
} )
2021-12-10 20:04:13 +00:00
-- Custom status line
2021-12-15 17:37:51 +00:00
use ( { " SmiteshP/nvim-gps " , requires = " nvim-treesitter/nvim-treesitter " } )
use ( {
2021-10-25 16:22:54 +00:00
" nvim-lualine/lualine.nvim " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " plugins.lualine " ) . config_lualine ( )
end ,
2021-12-09 06:13:53 +00:00
requires = {
2021-12-10 20:04:13 +00:00
-- Show my current location in my status bar
-- { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" },
} ,
after = {
2021-12-15 17:37:51 +00:00
" nvim-gps " ,
} ,
} )
2021-12-10 20:04:13 +00:00
-- On Mac, update colors when dark mode changes
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" cormacrelf/dark-notify " ,
2021-12-15 23:26:15 +00:00
disable = not vim.g . is_mac ,
2021-08-24 17:38:14 +00:00
-- Download latest release on install
2021-12-15 17:37:51 +00:00
run = " curl -s https://api.github.com/repos/cormacrelf/dark-notify/releases/latest | jq '.assets[].browser_download_url' | xargs curl -Ls | tar xz -C ~/.local/bin/ " , -- luacheck: no max line length
2021-08-24 17:38:14 +00:00
config = config_dark_notify ,
2021-10-25 16:22:54 +00:00
requires = " nvim-lualine/lualine.nvim " ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Custom start screen
2021-12-15 17:37:51 +00:00
use ( {
" mhinz/vim-startify " ,
config = function ( )
require ( " utils " ) . require_with_local ( " plugins.startify " )
end ,
} )
2021-08-24 17:38:14 +00:00
-- LSP
2021-12-10 20:04:13 +00:00
-- Configure language servers
2021-12-15 17:37:51 +00:00
use ( " neovim/nvim-lspconfig " )
2021-12-11 01:10:28 +00:00
-- Better display of diagnostics
2021-12-15 17:37:51 +00:00
use ( " folke/trouble.nvim " )
2021-12-10 20:04:13 +00:00
-- Generic linter/formatters in diagnostics API
2021-12-15 17:37:51 +00:00
use ( {
2021-12-10 20:04:13 +00:00
" jose-elias-alvarez/null-ls.nvim " ,
requires = { " nvim-lua/plenary.nvim " , " neovim/nvim-lspconfig " } ,
2021-12-15 17:37:51 +00:00
} )
2021-12-10 20:04:13 +00:00
-- Fancy LSP UIs
2021-12-15 17:37:51 +00:00
use ( {
2021-12-10 20:04:13 +00:00
" glepnir/lspsaga.nvim " ,
requires = " neovim/nvim-lspconfig " ,
-- NOTE: Disabled because it's got issues with Neovim 0.6.0
disable = true ,
2021-12-15 17:37:51 +00:00
} )
2021-09-01 17:03:05 +00:00
-- Writing
-- abolish/pencil
2021-12-15 17:37:51 +00:00
use ( {
2021-09-28 00:45:04 +00:00
" preservim/vim-pencil " ,
2021-12-15 17:37:51 +00:00
cmd = { " Pencil " } ,
} )
use ( {
2021-11-09 20:34:46 +00:00
" preservim/vim-textobj-sentence " ,
requires = " kana/vim-textobj-user " ,
2021-12-15 17:37:51 +00:00
} )
use ( {
2021-12-14 00:48:40 +00:00
" junegunn/goyo.vim " ,
cmd = { " Goyo " , " Zen " } ,
config = [[require("plugins.goyo-limelight")]] ,
requires = { " junegunn/limelight.vim " , cmd = " Limelight " } ,
2021-12-15 17:37:51 +00:00
} )
2021-09-28 00:45:04 +00:00
2021-08-24 17:38:14 +00:00
-- Treesitter
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" nvim-treesitter/nvim-treesitter " ,
run = " :TSUpdate " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " utils " ) . require_with_local ( " plugins.treesitter " )
end ,
} )
use ( {
2021-08-24 17:38:14 +00:00
" nvim-treesitter/nvim-treesitter-refactor " ,
requires = " nvim-treesitter/nvim-treesitter " ,
2021-12-15 17:37:51 +00:00
} )
use ( {
2021-08-24 17:38:14 +00:00
" nvim-treesitter/nvim-treesitter-textobjects " ,
requires = " nvim-treesitter/nvim-treesitter " ,
2021-12-15 17:37:51 +00:00
} )
2021-08-24 23:13:10 +00:00
--[[
2021-08-24 17:38:14 +00:00
use {
" nvim-treesitter/completion-treesitter " ,
requires = " nvim-treesitter/nvim-treesitter " ,
}
2021-08-24 23:13:10 +00:00
--]]
2021-08-24 17:38:14 +00:00
-- Completion
2021-12-15 17:37:51 +00:00
use ( {
2021-09-30 17:58:22 +00:00
" hrsh7th/nvim-cmp " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " plugins.completion " ) . config_cmp ( )
end ,
2021-09-30 17:58:22 +00:00
requires = {
2021-12-11 01:10:40 +00:00
{ " hrsh7th/cmp-nvim-lsp " , after = " nvim-cmp " } ,
{ " hrsh7th/cmp-buffer " , after = " nvim-cmp " } ,
{ " f3fora/cmp-spell " , after = " nvim-cmp " } ,
{ " saadparwaiz1/cmp_luasnip " , after = " nvim-cmp " } ,
2021-12-01 17:49:21 +00:00
" L3MON4D3/LuaSnip " ,
2021-12-10 20:04:13 +00:00
} ,
event = " InsertEnter * " ,
2021-12-15 17:37:51 +00:00
} )
2021-08-24 17:38:14 +00:00
-- Fuzzy Finder
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" nvim-telescope/telescope.nvim " ,
2021-12-10 20:04:13 +00:00
requires = {
" nvim-lua/plenary.nvim " ,
" nvim-lua/popup.nvim " ,
} ,
2021-12-15 00:20:07 +00:00
commit = pinned_commits [ " telescope " ] ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " plugins.telescope " )
end ,
} )
2021-08-25 23:28:03 +00:00
--[[
2021-08-25 23:21:50 +00:00
use {
' junegunn/fzf ' ,
run = " :call fzf#install() " ,
}
use {
' junegunn/fzf.vim ' ,
requires = " junegunn/fzf " ,
config = function ( )
vim.g . fzf_command_prefix = ' FZF '
-- Jump to existing window if possible
vim.g . fzf_buffers_jump = 1
-- Override key commands
-- vim.g.fzf_action = { ['ctrl-t'] = 'tab split', ['ctrl-s'] = 'split', ['ctrl-v'] = 'vsplit', }
-- Override git log to show authors
2021-09-16 20:32:29 +00:00
vim.g . fzf_commits_log_options = --graph --color=always \z
--format="%C(auto)%h %an: %s%d %C(black)%C(bold)%cr"
2021-08-25 23:21:50 +00:00
vim.g . fzf_preview_window = { " right:50% " , " ctrl-/ " }
vim.api . nvim_set_keymap ( " n " , " <C-t> " , " <cmd>FZF<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <Leader>b " , " <cmd>FZFBuffers<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <F2> " , " <cmd>FZFBuffers<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <Leader>fg " , " <cmd>FZFRg<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <Leader>r " , " <cmd>FZFTags<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <Leader>t " , " <cmd>FZFBTags<CR> " , { silent = true , noremap = true } )
vim.api . nvim_set_keymap ( " n " , " <Leader>g " , " <cmd>FZFBCommits<CR> " , { silent = true , noremap = true } )
end ,
}
use {
" ojroques/nvim-lspfuzzy " ,
requires = { " junegunn/fzf " , " junegunn/fzf " } ,
config = function ( )
require ( " lspfuzzy " ) . setup {
fzf_trim = false ,
}
end ,
2021-08-24 17:38:14 +00:00
}
2021-08-25 23:28:03 +00:00
--]]
2021-08-24 17:38:14 +00:00
-- Filetypes
2021-12-15 17:37:51 +00:00
use ( " ViViDboarder/vim-forcedotcom " )
use ( " rust-lang/rust.vim " )
use ( " hsanson/vim-android " )
use ( {
" sheerun/vim-polyglot " ,
2021-08-24 17:38:14 +00:00
config = function ( )
vim.cmd ( [ [
augroup ansible_playbook
au BufRead , BufNewFile */ playbooks /* . yml , */ playbooks /* . yaml set filetype = yaml.ansible
augroup end
] ] )
end ,
2021-12-15 17:37:51 +00:00
} )
2021-08-24 17:38:14 +00:00
2021-12-15 17:37:51 +00:00
use ( {
2021-09-01 17:03:05 +00:00
" dense-analysis/ale " ,
2021-12-15 17:37:51 +00:00
config = function ( )
require ( " plugins.ale " )
end ,
} )
2021-09-01 17:03:05 +00:00
2021-08-24 17:38:14 +00:00
-- Debuging nvim config
2021-12-15 17:37:51 +00:00
use ( {
2021-08-24 17:38:14 +00:00
" tweekmonster/startuptime.vim " ,
2021-12-15 17:37:51 +00:00
cmd = { " StartupTime " } ,
} )
2021-08-24 17:38:14 +00:00
2021-12-10 20:04:13 +00:00
-- Auto sync after bootstrapping on a fresh box
if packer_bootstrap then
require ( " packer " ) . sync ( )
end
2021-12-16 22:32:23 +00:00
end ,
config = {
display = {
open_fn = function ( )
return require ( " packer.util " ) . float ( { border = " single " } )
end ,
} ,
} } )