2022-04-15 12:52:46 -05:00
|
|
|
local packer_install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
|
2022-03-09 11:50:01 -06:00
|
|
|
if #vim.fn.glob(packer_install_path) == 0 then
|
2022-04-15 12:52:46 -05:00
|
|
|
vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', packer_install_path }
|
|
|
|
vim.api.nvim_command 'packadd packer.nvim'
|
2022-03-09 11:50:01 -06:00
|
|
|
end
|
2021-06-13 11:02:27 -05:00
|
|
|
|
2022-03-16 00:53:49 -05:00
|
|
|
local has_words_before = function()
|
2022-04-05 09:59:39 -05:00
|
|
|
local line, col = vim.api.nvim_win_get_cursor(0)
|
|
|
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
2022-03-16 00:53:49 -05:00
|
|
|
end
|
|
|
|
|
2022-04-15 12:52:46 -05:00
|
|
|
local packer = require 'packer'
|
2022-03-16 01:07:27 -05:00
|
|
|
|
2022-03-09 11:50:01 -06:00
|
|
|
packer.startup(function()
|
|
|
|
local plugins = {
|
|
|
|
'wbthomason/packer.nvim', -- neovim plugin manager
|
2021-11-09 10:26:05 -06:00
|
|
|
|
2022-03-09 11:50:01 -06:00
|
|
|
'vim-scripts/LargeFile', -- degrade gracefully with large files
|
|
|
|
'tpope/vim-repeat', -- enable repeat for plugin maps
|
|
|
|
'tpope/vim-sleuth', -- use whatever whitespace is in the file
|
|
|
|
'editorconfig/editorconfig-vim', -- handle .editorconfig files
|
|
|
|
'christoomey/vim-tmux-navigator', -- navigate vim splits and tmux panes fluidly
|
|
|
|
'machakann/vim-sandwich', -- edit surrounding characters
|
|
|
|
'michaeljsmith/vim-indent-object', -- adds indent-level text objects
|
2022-04-15 12:52:46 -05:00
|
|
|
-- 'wellle/targets.vim', -- add many other text objects
|
2022-03-09 11:50:01 -06:00
|
|
|
'bkad/CamelCaseMotion', -- invaluable motions for properly operating on various casings
|
|
|
|
|
|
|
|
{
|
|
|
|
-- session management
|
|
|
|
'olimorris/persisted.nvim',
|
|
|
|
config = function()
|
2022-03-09 13:37:25 -06:00
|
|
|
local should_autoload = #vim.v.argv == 1
|
2022-04-15 12:52:46 -05:00
|
|
|
require 'persisted'.setup {
|
2022-03-09 13:37:25 -06:00
|
|
|
autoload = should_autoload,
|
|
|
|
autosave = should_autoload,
|
2022-03-09 11:50:01 -06:00
|
|
|
}
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- toggle comments
|
|
|
|
'terrortylor/nvim-comment',
|
|
|
|
config = function()
|
2022-04-15 12:52:46 -05:00
|
|
|
require 'nvim_comment'.setup()
|
2022-03-09 11:50:01 -06:00
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- fuzzy finder
|
|
|
|
'nvim-telescope/telescope.nvim',
|
|
|
|
requires = {
|
|
|
|
'nvim-lua/popup.nvim',
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
}
|
|
|
|
},
|
2022-03-16 00:53:49 -05:00
|
|
|
{
|
|
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
|
|
|
run = 'make',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'tzachar/cmp-fuzzy-path',
|
2022-04-15 12:52:46 -05:00
|
|
|
requires = { 'hrsh7th/nvim-cmp', 'tzachar/fuzzy.nvim' },
|
2022-03-16 00:53:49 -05:00
|
|
|
},
|
2022-03-09 11:50:01 -06:00
|
|
|
-- TODO: add keymap <leader>ig for toggling these
|
|
|
|
'lukas-reineke/indent-blankline.nvim', -- indentation guide lines
|
2022-03-16 00:53:49 -05:00
|
|
|
'L3MON4D3/LuaSnip',
|
|
|
|
|
2022-03-09 12:04:12 -06:00
|
|
|
'neovim/nvim-lspconfig', -- language server configuration helper
|
2022-04-05 09:59:39 -05:00
|
|
|
'williamboman/nvim-lsp-installer', -- plugin containing installation commands for many language servers
|
2022-03-16 01:07:27 -05:00
|
|
|
'hrsh7th/cmp-nvim-lsp-signature-help',
|
2022-03-09 12:04:12 -06:00
|
|
|
'hrsh7th/cmp-nvim-lsp', -- add lsp to completion engine
|
|
|
|
'hrsh7th/cmp-buffer', -- add buffer information to completion engine
|
|
|
|
'hrsh7th/cmp-path', -- add filesystem information to complete enging
|
|
|
|
'hrsh7th/cmp-cmdline', -- add completion for vim commands
|
2022-04-15 12:52:46 -05:00
|
|
|
'onsails/lspkind-nvim',
|
2022-03-16 00:53:49 -05:00
|
|
|
'saadparwaiz1/cmp_luasnip',
|
2022-03-09 11:50:01 -06:00
|
|
|
{
|
2022-03-09 12:04:12 -06:00
|
|
|
-- completion engine
|
2022-03-09 11:50:01 -06:00
|
|
|
'hrsh7th/nvim-cmp',
|
|
|
|
config = function()
|
2022-04-15 12:52:46 -05:00
|
|
|
local cmp = require 'cmp'
|
|
|
|
local luasnip = require 'luasnip'
|
2022-03-09 11:50:01 -06:00
|
|
|
|
2022-04-15 12:52:46 -05:00
|
|
|
local prev_item = function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_prev_item()
|
|
|
|
elseif luasnip.jumpable(-1) then
|
|
|
|
luasnip.jump(-1)
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local next_item = function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_next_item()
|
|
|
|
elseif luasnip.expand_or_jumpable() then
|
|
|
|
luasnip.expand_or_jump()
|
|
|
|
elseif has_words_before() then
|
|
|
|
cmp.complete()
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
cmp.setup {
|
2022-03-16 00:53:49 -05:00
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
luasnip.lsp_expand(args.body)
|
|
|
|
end,
|
|
|
|
},
|
2022-03-09 11:50:01 -06:00
|
|
|
mapping = {
|
|
|
|
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
|
|
|
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
|
|
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
2022-04-15 12:52:46 -05:00
|
|
|
['<C-y>'] = cmp.config.disable,
|
|
|
|
['<C-e>'] = cmp.mapping {
|
2022-03-09 11:50:01 -06:00
|
|
|
i = cmp.mapping.abort(),
|
|
|
|
c = cmp.mapping.close(),
|
|
|
|
},
|
2022-04-15 12:52:46 -05:00
|
|
|
['<CR>'] = cmp.mapping.confirm { select = false },
|
|
|
|
["<Tab>"] = cmp.mapping(next_item, { "i", "s" }),
|
|
|
|
["<S-Tab>"] = cmp.mapping(prev_item, { "i", "s" }),
|
|
|
|
['<C-n>'] = cmp.mapping(next_item, { "i", "s" }),
|
|
|
|
['<C-p>'] = cmp.mapping(prev_item, { "i", "s" }),
|
2022-03-09 11:50:01 -06:00
|
|
|
},
|
2022-03-16 00:53:49 -05:00
|
|
|
sources = cmp.config.sources({
|
2022-03-09 11:50:01 -06:00
|
|
|
{ name = 'nvim_lsp' },
|
2022-03-16 01:07:27 -05:00
|
|
|
{ name = 'nvim_lsp_signature_help' },
|
2022-03-16 00:53:49 -05:00
|
|
|
{ name = 'luasnip' },
|
|
|
|
}, {
|
2022-03-09 11:50:01 -06:00
|
|
|
{ name = 'buffer' },
|
2022-03-16 00:53:49 -05:00
|
|
|
{ name = 'path' },
|
|
|
|
{ name = 'fuzzy_path' },
|
|
|
|
}),
|
2022-04-15 12:52:46 -05:00
|
|
|
formatting = {
|
|
|
|
format = require("lspkind").cmp_format {
|
|
|
|
with_text = true,
|
|
|
|
menu = {
|
|
|
|
nvim_lsp = "[LSP]",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2022-03-09 11:50:01 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
cmp.setup.cmdline('/', {
|
2022-04-15 12:52:46 -05:00
|
|
|
-- mapping = cmp.mapping.preset.cmdline(),
|
2022-03-09 11:50:01 -06:00
|
|
|
sources = {
|
2022-04-15 12:52:46 -05:00
|
|
|
{ name = 'buffer' },
|
|
|
|
{ name = 'fuzzy_path' },
|
2022-03-09 11:50:01 -06:00
|
|
|
}
|
|
|
|
})
|
2021-06-13 11:02:27 -05:00
|
|
|
|
2022-03-09 11:50:01 -06:00
|
|
|
cmp.setup.cmdline(':', {
|
2022-04-15 12:52:46 -05:00
|
|
|
-- mapping = cmp.mapping.preset.cmdline(),
|
2022-03-09 11:50:01 -06:00
|
|
|
sources = cmp.config.sources({
|
2022-04-15 12:52:46 -05:00
|
|
|
{ name = 'path' }
|
2022-03-09 11:50:01 -06:00
|
|
|
}, {
|
2022-04-15 12:52:46 -05:00
|
|
|
{ name = 'cmdline' }
|
2022-03-09 11:50:01 -06:00
|
|
|
})
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
-- TODO: automate this installation process of :COQdeps<cr>:COQnow<cr>
|
|
|
|
-- {'ms-jpq/coq_nvim', branch = 'coq'},
|
|
|
|
-- {'ms-jpq/coq.thirdparty', branch = '3p'},
|
|
|
|
{
|
2022-03-09 12:04:12 -06:00
|
|
|
-- syntax highlighting and indentation
|
2022-03-09 11:50:01 -06:00
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
run = ':TSUpdate',
|
|
|
|
config = function()
|
2022-04-15 12:52:46 -05:00
|
|
|
require 'nvim-treesitter.configs'.setup {
|
|
|
|
ensure_installed = "all",
|
2022-03-09 11:50:01 -06:00
|
|
|
sync_install = false,
|
|
|
|
ignore_install = {},
|
|
|
|
indent = {
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
disable = {},
|
|
|
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
|
|
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
|
|
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
|
|
-- Instead of true it can also be a list of languages
|
|
|
|
-- additional_vim_regex_highlighting = false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
},
|
2022-03-28 09:57:47 -05:00
|
|
|
'lukas-reineke/lsp-format.nvim',
|
2022-03-09 11:50:01 -06:00
|
|
|
}
|
2022-04-15 12:52:46 -05:00
|
|
|
for _, plugin in pairs(plugins) do packer.use(plugin) end
|
2022-03-09 11:50:01 -06:00
|
|
|
end)
|