2022-10-17 20:40:36 +02:00
|
|
|
-- auto install packer if not installed
|
|
|
|
local ensure_packer = function()
|
2022-11-05 22:13:18 +01:00
|
|
|
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
|
2022-10-17 20:40:36 +02:00
|
|
|
end
|
|
|
|
local packer_bootstrap = ensure_packer() -- true if packer was just installed
|
|
|
|
|
|
|
|
-- autocommand that reloads neovim and installs/updates/removes plugins
|
|
|
|
-- when file is saved
|
|
|
|
vim.cmd([[
|
|
|
|
augroup packer_user_config
|
|
|
|
autocmd!
|
|
|
|
autocmd BufWritePost plugins-setup.lua source <afile> | PackerSync
|
|
|
|
augroup end
|
|
|
|
]])
|
|
|
|
|
|
|
|
-- import packer safely
|
|
|
|
local status, packer = pcall(require, "packer")
|
|
|
|
if not status then
|
2022-11-05 22:13:18 +01:00
|
|
|
return
|
2022-10-17 20:40:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- add list of plugins to install
|
|
|
|
return packer.startup(function(use)
|
2022-11-05 22:13:18 +01:00
|
|
|
-- packer can manage itself
|
|
|
|
use("wbthomason/packer.nvim")
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
use("nvim-lua/plenary.nvim") -- lua functions that many plugins use
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
use("bluz71/vim-nightfly-guicolors") -- preferred colorscheme
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
use("christoomey/vim-tmux-navigator") -- tmux & split window navigation
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
use("szw/vim-maximizer") -- maximizes and restores current window
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- essential plugins
|
|
|
|
use("tpope/vim-surround") -- add, delete, change surroundings (it's awesome)
|
|
|
|
use("vim-scripts/ReplaceWithRegister") -- replace with register contents using motion (gr + motion)
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- commenting with gc
|
|
|
|
use("numToStr/Comment.nvim")
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- file explorer
|
|
|
|
use("nvim-tree/nvim-tree.lua")
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- vs-code like icons
|
|
|
|
use("kyazdani42/nvim-web-devicons")
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- statusline
|
|
|
|
use("nvim-lualine/lualine.nvim")
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- fuzzy finding w/ telescope
|
|
|
|
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) -- dependency for better sorting performance
|
|
|
|
use({ "nvim-telescope/telescope.nvim", branch = "0.1.x" }) -- fuzzy finder
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- autocompletion
|
|
|
|
use("hrsh7th/nvim-cmp") -- completion plugin
|
|
|
|
use("hrsh7th/cmp-buffer") -- source for text in buffer
|
|
|
|
use("hrsh7th/cmp-path") -- source for file system paths
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- snippets
|
|
|
|
use("L3MON4D3/LuaSnip") -- snippet engine
|
|
|
|
use("saadparwaiz1/cmp_luasnip") -- for autocompletion
|
|
|
|
use("rafamadriz/friendly-snippets") -- useful snippets
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- managing & installing lsp servers, linters & formatters
|
|
|
|
use("williamboman/mason.nvim") -- in charge of managing lsp servers, linters & formatters
|
|
|
|
use("williamboman/mason-lspconfig.nvim") -- bridges gap b/w mason & lspconfig
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- configuring lsp servers
|
|
|
|
use("neovim/nvim-lspconfig") -- easily configure language servers
|
|
|
|
use("hrsh7th/cmp-nvim-lsp") -- for autocompletion
|
|
|
|
use({ "glepnir/lspsaga.nvim", branch = "main" }) -- enhanced lsp uis
|
|
|
|
use("jose-elias-alvarez/typescript.nvim") -- additional functionality for typescript server (e.g. rename file & update imports)
|
|
|
|
use("onsails/lspkind.nvim") -- vs-code like icons for autocompletion
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- formatting & linting
|
|
|
|
use("jose-elias-alvarez/null-ls.nvim") -- configure formatters & linters
|
|
|
|
use("jayp0521/mason-null-ls.nvim") -- bridges gap b/w mason & null-ls
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- treesitter configuration
|
|
|
|
use({
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
run = function()
|
2022-11-11 21:45:42 +01:00
|
|
|
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
|
|
|
|
ts_update()
|
2022-11-05 22:13:18 +01:00
|
|
|
end,
|
|
|
|
})
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- auto closing
|
|
|
|
use("windwp/nvim-autopairs") -- autoclose parens, brackets, quotes, etc...
|
|
|
|
use({ "windwp/nvim-ts-autotag", after = "nvim-treesitter" }) -- autoclose tags
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
-- git integration
|
|
|
|
use("lewis6991/gitsigns.nvim") -- show line modifications on left hand side
|
2022-10-17 20:40:36 +02:00
|
|
|
|
2022-11-05 22:13:18 +01:00
|
|
|
if packer_bootstrap then
|
|
|
|
require("packer").sync()
|
|
|
|
end
|
2022-10-17 20:40:36 +02:00
|
|
|
end)
|