vim-settings/neovim/lua/plugins.lua

420 lines
10 KiB
Lua
Raw Normal View History

-- Install packer
local utils = require("utils")
2021-12-15 17:37:51 +00:00
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"
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
-- 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({
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
2022-02-25 19:03:05 +00:00
local packer = require("packer")
local packer_util = require("packer.util")
local use = packer.use
packer.init({
-- Always load default
snapshot = "latest",
snapshot_path = packer_util.join_paths(vim.fn.stdpath("config"), "packer_snapshots"),
display = {
open_fn = function()
return packer_util.float({ border = "single" })
end,
},
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Load things faster!
2022-08-31 18:45:26 +00:00
use({
"lewis6991/impatient.nvim",
config = [[require('impatient')]],
commit = utils.map_version_rule({
[">0.6.0"] = utils.nil_val,
[">=0.5.0"] = "969f2c5",
}),
})
2022-02-25 19:03:05 +00:00
-- Let Packer manage and lazyload itself
use({
"wbthomason/packer.nvim",
2022-02-25 19:03:05 +00:00
cmd = {
"PackerClean",
"PackerCompile",
"PackerInstall",
"PackerLoad",
"PackerProfile",
"PackerSnapshot",
"PackerSnapshotDelete",
"PackerSnapshotRollback",
2022-02-25 19:03:05 +00:00
"PackerStatus",
"PackerSync",
"PackerUpdate",
},
config = [[require("plugins")]],
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Colorschemes
use({
"vim-scripts/wombat256.vim",
2022-06-07 16:52:10 +00:00
{
"ViViDboarder/wombat.nvim",
requires = {
{
"rktjmp/lush.nvim",
tag = utils.map_version_rule({
[">=0.7.0"] = utils.nil_val,
[">=0.5.0"] = "v1.0.1",
}),
},
},
},
2022-02-25 19:03:05 +00:00
{ "ViViDboarder/wombuddy.nvim", requires = "tjdevries/colorbuddy.vim" },
"ishan9299/nvim-solarized-lua",
{
"folke/tokyonight.nvim",
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-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Auto and ends to some ifs and dos
use("tpope/vim-endwise")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Unix commands from vim? Yup!
use("tpope/vim-eunuch")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Adds repeats for custom motions
use("tpope/vim-repeat")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Readline shortcuts
use("tpope/vim-rsi")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Surround motions
use("tpope/vim-surround")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Better netrw
use("tpope/vim-vinegar")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Easier jumping to lines
use("vim-scripts/file-line")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Auto ctags generation
use("ludovicchabant/vim-gutentags")
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Make it easier to discover some of my keymaps
use({
"folke/which-key.nvim",
config = function()
require("plugins.whichkey").configure()
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Better commenting
use({
"tomtom/tcomment_vim",
config = function()
vim.api.nvim_set_keymap("n", "//", ":TComment<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("v", "//", ":TCommentBlock<CR>", { silent = true, noremap = true })
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Allow wrapping and joining of arguments across multiple lines
use({
"FooSoft/vim-argwrap",
config = function()
vim.api.nvim_set_keymap("n", "<Leader>a", "<cmd>ArgWrap<CR>", { silent = true, noremap = true })
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Adds git operations to vim
use({
"tpope/vim-fugitive",
config = function()
local opts = { silent = true, noremap = true }
2022-05-10 19:06:07 +00:00
vim.api.nvim_set_keymap("n", "gb", "<cmd>Git blame<CR>", opts)
vim.api.nvim_set_keymap("n", "gc", "<cmd>Git commit<CR>", opts)
vim.api.nvim_set_keymap("n", "gd", "<cmd>Git diff<CR>", opts)
2022-02-25 19:03:05 +00:00
vim.api.nvim_set_keymap("n", "gs", "<cmd>Git<CR>", opts)
2022-05-10 19:06:07 +00:00
vim.api.nvim_set_keymap("n", "gw", "<cmd>Git write<CR>", opts)
2022-02-25 19:03:05 +00:00
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Quick toggling of Location and Quickfix lists
use({
"milkypostman/vim-togglelist",
config = function()
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 })
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Find text everywhere!
use({
"mhinz/vim-grepper",
config = function()
require("plugins.grepper")
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Highlight inline colors
use({
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Custom status line
2022-08-31 18:45:26 +00:00
-- nvim-gps is deprecated in favor of https://github.com/SmiteshP/nvim-navic using LSP rather than TS
2022-02-25 19:03:05 +00:00
use({ "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" })
use({
"nvim-lualine/lualine.nvim",
config = function()
require("plugins.lualine").config_lualine()
end,
requires = {
-- Show my current location in my status bar
-- { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" },
},
after = {
"nvim-gps",
},
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- On Mac, update colors when dark mode changes
use({
"cormacrelf/dark-notify",
disable = not vim.g.is_mac,
-- Download latest release on install
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
config = config_dark_notify,
requires = "nvim-lualine/lualine.nvim",
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Custom start screen
use({
"mhinz/vim-startify",
config = function()
require("utils").require_with_local("plugins.startify")
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- LSP
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Configure language servers
2022-08-31 18:45:26 +00:00
use({
"neovim/nvim-lspconfig",
tag = utils.map_version_rule({
[">=0.7.0"] = "v0.1.3",
[">=0.6.1"] = "v0.1.2",
[">=0.6.0"] = "v0.1.0",
}),
})
2022-02-25 19:03:05 +00:00
-- Install language servers
use({
"williamboman/mason.nvim",
requires = {
"neovim/nvim-lspconfig",
"williamboman/mason-lspconfig.nvim",
},
2022-02-25 19:03:05 +00:00
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Lua dev for vim
use({
"folke/lua-dev.nvim",
requires = "neovim/lsp-config",
})
2022-02-25 19:03:05 +00:00
-- Better display of lsp diagnostics
use("folke/trouble.nvim")
2022-06-07 16:52:22 +00:00
-- Incremental lsp rename view
use({
"smjonas/inc-rename.nvim",
config = function()
require("inc_rename").setup()
end,
disable = vim.fn.has("nvim-0.8.0") ~= 1,
2022-06-07 16:52:22 +00:00
})
2022-02-25 19:03:05 +00:00
-- Generic linter/formatters in diagnostics API
use({
"jose-elias-alvarez/null-ls.nvim",
commit = utils.map_version_rule({
[">=0.6.0"] = utils.nil_val,
2022-02-25 19:03:05 +00:00
[">=0.5.1"] = "739a98c12bedaa2430c4a3c08d1d22ad6c16513e",
[">=0.5.0"] = "3e7390735501d0507bf2c2b5c2e7a16f58deeb81",
}),
requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Writing
-- abolish/pencil
use({
"preservim/vim-pencil",
cmd = { "Pencil" },
})
use({
"preservim/vim-textobj-sentence",
requires = "kana/vim-textobj-user",
})
use({
"junegunn/goyo.vim",
cmd = { "Goyo", "Zen" },
config = [[require("plugins.goyo-limelight")]],
requires = { "junegunn/limelight.vim", cmd = "Limelight" },
})
2021-08-24 17:38:14 +00:00
2022-02-25 19:03:05 +00:00
-- Treesitter
use({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
2022-06-07 16:52:10 +00:00
commit = utils.map_version_rule({
[">=0.7.0"] = utils.nil_value,
[">=0.5.0"] = "a189323454d1215c682c7ad7db3e6739d26339c4",
}),
2022-02-25 19:03:05 +00:00
config = function()
require("plugins.treesitter").setup()
end,
})
use({
"nvim-treesitter/nvim-treesitter-refactor",
requires = "nvim-treesitter/nvim-treesitter",
})
use({
"nvim-treesitter/nvim-treesitter-textobjects",
requires = "nvim-treesitter/nvim-treesitter",
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Completion
use({
"hrsh7th/nvim-cmp",
config = function()
require("plugins.completion").config_cmp()
end,
2022-06-07 16:52:10 +00:00
commit = utils.map_version_rule({
[">=0.7.0"] = utils.nil_val,
[">=0.5.0"] = "bba6fb67fdafc0af7c5454058dfbabc2182741f4",
}),
2022-02-25 19:03:05 +00:00
requires = {
{ "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" },
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" },
{ "f3fora/cmp-spell", after = "nvim-cmp" },
2022-06-07 16:52:10 +00:00
{
"saadparwaiz1/cmp_luasnip",
after = "nvim-cmp",
commit = utils.map_version_rule({
[">0.7.0"] = utils.nil_val,
[">=0.5.0"] = "b10829736542e7cc9291e60bab134df1273165c9",
}),
},
2022-02-25 19:03:05 +00:00
"L3MON4D3/LuaSnip",
},
event = "InsertEnter *",
})
2022-02-25 17:09:51 +00:00
2022-02-25 19:03:05 +00:00
-- Add snippets
use({
"rafamadriz/friendly-snippets",
requires = "L3MON4D3/LuaSnip",
after = "LuaSnip",
config = function()
require("luasnip.loaders.from_vscode").load()
end,
})
2022-03-01 20:27:15 +00:00
use({
"ray-x/lsp_signature.nvim",
config = function()
require("lsp_signature").setup({
extra_trigger_chars = { "(", "," },
auto_close_after = nil,
-- Toggle these to use hint only
floating_window = true,
hint_enable = false,
})
end,
})
2022-02-25 19:03:05 +00:00
-- Fuzzy Finder
use({
"nvim-telescope/telescope.nvim",
requires = {
"nvim-lua/plenary.nvim",
"nvim-lua/popup.nvim",
"nvim-telescope/telescope-file-browser.nvim",
},
tag = utils.map_version_rule({
2022-08-31 18:45:26 +00:00
-- Follow stable release tag
[">=0.7.0"] = "0.1.0",
2022-04-29 19:31:45 +00:00
[">=0.6.0"] = "nvim-0.6",
2022-02-25 19:03:05 +00:00
["<0.6.0"] = "nvim-0.5.1",
["==0.5.0"] = "nvim-0.5.0",
}),
config = function()
require("plugins.telescope")
end,
})
2021-08-24 17:38:14 +00:00
2022-02-25 19:03:05 +00:00
-- Filetypes
use("ViViDboarder/vim-forcedotcom")
use("rust-lang/rust.vim")
use("hsanson/vim-android")
use({
"sheerun/vim-polyglot",
config = function()
vim.cmd([[
2022-02-25 19:10:28 +00:00
augroup polyglot_fts
au BufRead,BufNewFile */playbooks/*.yml,*/playbooks/*.yaml set filetype=yaml.ansible
au BufRead,BufNewFile go.mod,go.sum set filetype=gomod
augroup end
]])
2022-02-25 19:03:05 +00:00
end,
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Debuging nvim config
use({
"tweekmonster/startuptime.vim",
cmd = { "StartupTime" },
})
2021-12-16 22:43:02 +00:00
2022-02-25 19:03:05 +00:00
-- Fancy todo highlighting
use({
"folke/todo-comments.nvim",
requires = {
"nvim-lua/plenary.nvim",
},
config = function()
require("plugins.todo")
end,
})
2022-01-02 15:41:55 +00:00
2022-02-25 19:03:05 +00:00
-- Fancy notifications
use({
"rcarriga/nvim-notify",
config = function()
require("notify").setup({
icons = {
2022-08-31 19:09:15 +00:00
ERROR = utils.diagnostic_signs.Error,
WARN = utils.diagnostic_signs.Warn,
DEBUG = utils.diagnostic_signs.Hint,
INFO = utils.diagnostic_signs.Info,
2022-02-25 19:03:05 +00:00
},
2022-01-10 22:53:26 +00:00
})
2022-02-25 19:03:05 +00:00
vim.notify = require("notify")
2021-12-16 22:43:02 +00:00
end,
})
2022-02-25 19:03:05 +00:00
-- Auto sync after bootstrapping on a fresh box
if packer_bootstrap then
packer.sync()
end