First version of the packer plugin setup calls

This commit is contained in:
Oliver Hartmann 2022-03-16 17:22:06 +01:00
parent d1b14f05c1
commit 7e1182a11b
3 changed files with 95 additions and 73 deletions

View File

@ -5,20 +5,6 @@ local opt = vim.opt -- to set options
local utils = require('utils') local utils = require('utils')
local packerUtil = require'packer.util' local packerUtil = require'packer.util'
-------------------- PACKER --------------------------------
-- Auto install packer.nvim if not exists
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'
end
vim.cmd [[packadd packer.nvim]]
require('packer').init({
snapshot_path = packerUtil.join_paths(vim.fn.stdpath('config'), 'snapshots'),
display = {
open_fn = require('packer.util').float,
}
})
-------------------- EXTERNAL ------------------------------ -------------------- EXTERNAL ------------------------------
require('my_plugins') require('my_plugins')
require('my_keymappings') require('my_keymappings')
@ -26,7 +12,6 @@ require('my_options')
require("my_autocommands") require("my_autocommands")
-- plugins -- plugins
require('my_telescope')
require('my_lspinstall') require('my_lspinstall')
require('my_cmp') require('my_cmp')
require('my_neogen') require('my_neogen')

View File

@ -1,3 +1,28 @@
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
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
packer_bootstrap = fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
end
vim.api.nvim_command("packadd packer.nvim")
function get_setup(name)
return string.format('require("setup/%s")', name)
end
return require('packer').startup(function() return require('packer').startup(function()
-- Packer can manage itself as an optional plugin -- Packer can manage itself as an optional plugin
@ -7,10 +32,15 @@ return require('packer').startup(function()
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate' run = ':TSUpdate'
} }
use { use({
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}, {'kyazdani42/nvim-web-devicons'}} requires = {
} {'nvim-lua/popup.nvim'},
{'nvim-lua/plenary.nvim'},
{'kyazdani42/nvim-web-devicons'}
},
config = get_setup("telescope"),
})
use {'sainnhe/gruvbox-material'} use {'sainnhe/gruvbox-material'}
use {'ellisonleao/gruvbox.nvim'} use {'ellisonleao/gruvbox.nvim'}
use {'lukas-reineke/indent-blankline.nvim'} use {'lukas-reineke/indent-blankline.nvim'}
@ -24,10 +54,17 @@ return require('packer').startup(function()
use { use {
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
requires = { requires = {
'hrsh7th/cmp-buffer', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer',
'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-nvim-lsp',
'octaltree/cmp-look', 'hrsh7th/cmp-path', 'hrsh7th/cmp-calc', 'L3MON4D3/LuaSnip',
'f3fora/cmp-spell', 'hrsh7th/cmp-emoji', 'hrsh7th/cmp-cmdline' 'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lua',
'octaltree/cmp-look',
'hrsh7th/cmp-path',
'hrsh7th/cmp-calc',
'f3fora/cmp-spell',
'hrsh7th/cmp-emoji',
'hrsh7th/cmp-cmdline'
} }
} }
use {'rafamadriz/friendly-snippets'} use {'rafamadriz/friendly-snippets'}

View File

@ -1,50 +1,50 @@
local actions = require('telescope.actions') local actions = require('telescope.actions')
local mappingTab = { local mappingTab = {
i = { i = {
['<cr>'] = actions.select_tab, ['<cr>'] = actions.select_tab,
['<C-b>'] = actions.select_default, ['<C-b>'] = actions.select_default,
} }
} }
require('telescope').setup { require('telescope').setup {
defaults = { defaults = {
mappings = { mappings = {
i = { i = {
['<esc>'] = actions.close, ['<esc>'] = actions.close,
['<cr>'] = actions.select_default + actions.center, ['<cr>'] = actions.select_default + actions.center,
['<C-l>'] = actions.send_selected_to_loclist, ['<C-l>'] = actions.send_selected_to_loclist,
['<C-q>'] = actions.smart_send_to_qflist ['<C-q>'] = actions.smart_send_to_qflist
} }
} }
}, },
pickers = { pickers = {
-- Your special builtin config goes in here -- Your special builtin config goes in here
buffers = { buffers = {
sort_lastused = true, sort_lastused = true,
theme = 'ivy', theme = 'ivy',
mappings = { mappings = {
i = { i = {
['<c-w>'] = actions.delete_buffer, ['<c-w>'] = actions.delete_buffer,
['<cr>'] = actions.select_default, ['<cr>'] = actions.select_default,
}, },
n = { n = {
['<c-w>'] = actions.delete_buffer, ['<c-w>'] = actions.delete_buffer,
} }
} }
}, },
find_files = { find_files = {
theme = 'ivy', theme = 'ivy',
previewer = false, previewer = false,
}, },
oldfiles = { oldfiles = {
theme = 'ivy', theme = 'ivy',
}, },
git_files = { git_files = {
theme = 'ivy', theme = 'ivy',
previewer = false, previewer = false,
}, },
lsp_dynamic_workspace_symbols = { lsp_dynamic_workspace_symbols = {
}, },
} }
} }