Files
dotfiles/nvim/lua/tracer/plugins.lua

249 lines
6.7 KiB
Lua

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
local ensure_packer = function()
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", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd([[packadd packer.nvim]])
return true
end
return false
end
local packer_bootstrap = ensure_packer()
require("packer").reset()
vim.g.polyglot_disabled = { "autoindent" }
require("packer").init({
compile_path = vim.fn.stdpath("data") .. "/site/plugin/packer_compiled.lua",
display = {
open_fn = function()
return require("packer.util").float({ border = "solid" })
end,
},
})
require("packer").startup(function(use)
use("wbthomason/packer.nvim")
-- My plugins here
-- Commenting support.
use("tpope/vim-commentary")
-- Add, change, and delete surrounding text.
use("tpope/vim-surround")
-- Useful commands like :Rename and :SudoWrite.
use("tpope/vim-eunuch")
-- Pairs of handy bracket mappings, like [b and ]b.
use("tpope/vim-unimpaired")
-- Indent autodetection with editorconfig support.
use("tpope/vim-sleuth")
-- Allow plugins to enable repeating of commands.
use("tpope/vim-repeat")
-- One Dark theme.
use({
"jessarcher/onedark.nvim",
config = function()
vim.cmd.colorscheme("onedark")
local normalfloat_hl = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = false })
if normalfloat_hl.bg then
vim.api.nvim_set_hl(0, "FloatBorder", {
fg = normalfloat_hl.bg,
bg = normalfloat_hl.bg,
})
end
local cursorline_hl = vim.api.nvim_get_hl(0, { name = "CursorLine", link = false })
if cursorline_hl.bg then
vim.api.nvim_set_hl(0, "CursorLineBg", {
fg = cursorline_hl.bg,
bg = cursorline_hl.bg,
})
end
vim.api.nvim_set_hl(0, "NvimTreeIndentMarker", { fg = "#30323E" })
local statusline_hl = vim.api.nvim_get_hl(0, { name = "StatusLine", link = false })
vim.api.nvim_set_hl(0, "StatusLineNonText", {
fg = "#5C6370",
bg = statusline_hl.bg,
})
vim.api.nvim_set_hl(0, "IndentBlanklineChar", { fg = "#2F313C" })
end,
})
-- Add more languages.
use("sheerun/vim-polyglot")
-- Navigate seamlessly between Vim windows and Tmux panes.
use("christoomey/vim-tmux-navigator")
-- Jump to the last location when opening a file.
use("farmergreg/vim-lastplace")
-- Enable * searching with visually selected text.
use("nelstrom/vim-visual-star-search")
-- Automatically create parent dirs when saving.
use("jessarcher/vim-heritage")
-- Text objects for HTML attributes.
use({
"whatyouhide/vim-textobj-xmlattr",
requires = "kana/vim-textobj-user",
})
-- Automatically set the working directory to the project root.
use({
"airblade/vim-rooter",
setup = function()
-- Instead of this running every time we open a file, we'll just run it once when Vim starts.
vim.g.rooter_manual_only = 1
end,
config = function()
vim.cmd("Rooter")
end,
})
-- Automatically add closing brackets, quotes, etc.
use({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end,
})
-- Add smooth scrolling to avoid jarring jumps
use({
"karb94/neoscroll.nvim",
config = function()
require("neoscroll").setup()
end,
})
-- All closing buffers without closing the split window.
use({
"famiu/bufdelete.nvim",
config = function()
vim.keymap.set("n", "<Leader>q", ":Bdelete<CR>")
end,
})
-- Split arrays and methods onto multiple lines, or join them back up.
use({
"AndrewRadev/splitjoin.vim",
config = function()
vim.g.splitjoin_html_attributes_bracket_on_new_line = 1
vim.g.splitjoin_trailing_comma = 1
vim.g.splitjoin_php_method_chain_full = 1
end,
})
-- Automatically fix indentation when pasting code.
use({
"sickill/vim-pasta",
config = function()
vim.g.pasta_disabled_filetypes = { "fugitive" }
end,
})
-- Git integration.
use({
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({ current_line_blame = true })
vim.keymap.set("n", "]h", ":Gitsigns next_hunk<CR>")
vim.keymap.set("n", "[h", ":Gitsigns prev_hunk<CR>")
vim.keymap.set("n", "gs", ":Gitsigns stage_hunk<CR>")
vim.keymap.set("n", "gS", ":Gitsigns undo_stage_hunk<CR>")
vim.keymap.set("n", "gp", ":Gitsigns preview_hunk<CR>")
vim.keymap.set("n", "gb", ":Gitsigns blame_line<CR>")
end,
})
-- Git commands.
use({
"tpope/vim-fugitive",
requires = "tpope/vim-rhubarb",
config = function()
require("tracer.plugins.fugitive").setup()
end,
})
-- Improved syntax highlighting.
use({
"nvim-treesitter/nvim-treesitter",
run = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
requires = {
"JoosepAlviste/nvim-ts-context-commentstring",
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
pcall(require, "tracer.plugins.treesitter")
end,
})
-- Language Server Protocol.
use({
"neovim/nvim-lspconfig",
requires = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
},
config = function()
pcall(require, "tracer.plugins.lspconfig")
end,
})
-- Fuzzy finder
use({
"nvim-telescope/telescope.nvim",
tag = "0.2.2",
requires = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"nvim-telescope/telescope-live-grep-args.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
},
config = function()
require("tracer.plugins.telescope")
end,
})
-- A status line.
use({
"nvim-lualine/lualine.nvim",
requires = "nvim-tree/nvim-web-devicons",
config = function()
require("tracer.plugins.lualine")
end,
})
-- Display buffers as tabs.
use({
"akinsho/bufferline.nvim",
requires = "nvim-tree/nvim-web-devicons",
after = "onedark.nvim",
config = function()
require("bufferline").setup()
end,
})
-- File tree sidebar for project-style navigation.
use({
"nvim-tree/nvim-tree.lua",
requires = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("tracer.plugins.nvim-tree")
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)
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]])