Refactor nvim packer configuration

This commit is contained in:
Marko Korhonen 2022-08-22 14:57:24 +03:00
parent 9ef1115fa2
commit 8643dd3b6b
No known key found for this signature in database
GPG Key ID: 911B85FBC6003FE5
11 changed files with 31 additions and 24 deletions

View File

@ -1,16 +1,5 @@
require 'pluginmanager' require 'plugins/init'
require 'autocmd' require 'autocmd'
require 'keybinds' require 'keybinds'
require 'settings' require 'settings'
require 'common' require 'common'
-- Plugin configurations
require 'pluginconf.lualine'
require 'pluginconf.bufferline'
require 'pluginconf.lsp'
require 'pluginconf.completion'
require 'pluginconf.treesitter'
require 'pluginconf.indent-blankline'
require 'pluginconf.nvim-tree'
require 'pluginconf.colorscheme'
require 'pluginconf.telescope'

View File

@ -1,23 +1,25 @@
local fn = vim.fn local fn = vim.fn
local cmd = vim.cmd
-- Install packer if it's not yet installed -- Install packer if it's not yet installed
local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
local packer_not_installed = fn.empty(fn.glob(install_path)) if fn.empty(fn.glob(install_path)) > 0 then
print('installing packer')
if packer_not_installed > 0 then Packer_bootstrap = fn.system({
print('Packer is not installed, cloning it now...') 'git', 'clone', '--depth', '1',
cmd('silent !git clone https://github.com/wbthomason/packer.nvim ' .. 'https://github.com/wbthomason/packer.nvim', install_path
install_path) })
vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' ..
vim.o.runtimepath
print('installed packer')
end end
-- Configure packer -- Configure packer
cmd 'packadd packer.nvim' vim.cmd [[packadd packer.nvim]]
local use = require('packer').use
require('packer').startup(function() require('packer').startup(function()
local use = require('packer').use
-- The plugin manager itself -- The plugin manager itself
use {'wbthomason/packer.nvim', opt = true} use {'wbthomason/packer.nvim', opt=true}
-- Colorscheme -- Colorscheme
use({'catppuccin/nvim', as = 'catppuccin'}) use({'catppuccin/nvim', as = 'catppuccin'})
@ -120,7 +122,22 @@ require('packer').startup(function()
-- Vim <3 Asciidoctor -- Vim <3 Asciidoctor
use 'habamax/vim-asciidoctor' use 'habamax/vim-asciidoctor'
-- Sync plugins if Packer was just
-- installed
if Packer_bootstrap then
print('syncing')
require('packer').sync()
print('synced')
end
end) end)
-- Install plugins if packer was not installed -- Source configurations
if packer_not_installed > 0 then cmd 'PackerInstall' end require 'plugins/lualine'
require 'plugins/bufferline'
require 'plugins/lsp'
require 'plugins/completion'
require 'plugins/treesitter'
require 'plugins/indent-blankline'
require 'plugins/nvim-tree'
require 'plugins/colorscheme'
require 'plugins/telescope'

View File

@ -1,5 +1,6 @@
local M = {} local M = {}
local lspconfig = require('lspconfig'); local lspconfig = require('lspconfig');
--
M.lsp_map_keys = function(server, bufnr) M.lsp_map_keys = function(server, bufnr)
local function map_key(...) local function map_key(...)