Mercurial > dotfiles
changeset 325:ce396166d009
Move packer setup in a function, load on demand
author | zegervdv <zegervdv@me.com> |
---|---|
date | Wed, 23 Dec 2020 11:10:42 +0100 |
parents | 64a0c6cec54c |
children | 9db87baf536e |
files | dot_config/nvim/config.lua dot_config/nvim/init.vim |
diffstat | 2 files changed, 88 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/dot_config/nvim/config.lua Tue Dec 22 15:42:45 2020 +0100 +++ b/dot_config/nvim/config.lua Wed Dec 23 11:10:42 2020 +0100 @@ -7,100 +7,111 @@ local fn = vim.fn -- Bootstrap package manager -local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path) end -require('packer').startup(function() - use {'wbthomason/packer.nvim'} +-- Packer configuration is compiled and only needs to be loaded on changes +function packer_enable() + vim.cmd "packadd packer.nvim" + + require('packer').startup(function() + use {'wbthomason/packer.nvim', opt = true} - -- General plugins - use {'tpope/vim-sensible'} - use {'tpope/vim-repeat'} - use {'tpope/vim-rsi'} - use {'sgur/vim-editorconfig'} - use {'ShikChen/osc52.vim'} - use {'einfachtoll/didyoumean'} + -- General plugins + use {'tpope/vim-sensible'} + use {'tpope/vim-repeat'} + use {'tpope/vim-rsi'} + use {'sgur/vim-editorconfig'} + use {'ShikChen/osc52.vim'} + use {'einfachtoll/didyoumean'} - use {'tpope/vim-obsession'} - use { - 'tpope/vim-eunuch', - cmd = { - 'Remove', - 'Unlink', - 'Move', - 'Rename', - 'Mkdir', - 'Chmod', - 'Find', - 'Locate', - 'SudoEdit', - 'SudoWrite' + use {'tpope/vim-obsession'} + use { + 'tpope/vim-eunuch', + cmd = { + 'Remove', + 'Unlink', + 'Move', + 'Rename', + 'Mkdir', + 'Chmod', + 'Find', + 'Locate', + 'SudoEdit', + 'SudoWrite' + } } - } + + use {'psliwka/vim-smoothie'} - -- Spelling/autocorrection - use {'tpope/vim-abolish'} + -- Spelling/autocorrection + use {'tpope/vim-abolish'} - -- Git/VCS - use {'vim-scripts/gitignore'} - use {'sjl/splice.vim', opt = true, cmd = {'SpliceInit'}} - use {'tpope/vim-git'} + -- Git/VCS + use {'vim-scripts/gitignore'} + use {'sjl/splice.vim', opt = true, cmd = {'SpliceInit'}} + use {'tpope/vim-git'} - -- Comments - use {'tpope/vim-commentary'} + -- Comments + use {'tpope/vim-commentary'} - -- Undoing - use {'sjl/gundo.vim', cmd = {'GundoToggle'}} + -- Undoing + use {'sjl/gundo.vim', cmd = {'GundoToggle'}} - -- Parentheses etc - use {'tpope/vim-surround'} - use {'raimondi/delimitMate'} - use {'zegervdv/vim-endwise'} + -- Parentheses etc + use {'tpope/vim-surround'} + use {'raimondi/delimitMate'} + use {'zegervdv/vim-endwise'} - -- Moving around within lines - use {'wellle/targets.vim', event = 'InsertEnter *'} + -- Moving around within lines + use {'wellle/targets.vim', event = 'InsertEnter *'} + + -- Searching + use {'mhinz/vim-grepper', cmd = {'Grepper'}} - -- Searching - use {'mhinz/vim-grepper', cmd = {'Grepper'}} + -- Indent lines + use {'Yggdroot/indentline'} + use {'lukas-reineke/indent-blankline.nvim', branch = 'lua'} - -- Indent lines - use {'Yggdroot/indentline'} - use {'lukas-reineke/indent-blankline.nvim', branch = 'lua'} - - -- Tmux - use {'christoomey/vim-tmux-navigator', cond = os.getenv('TMUX')} - use {'tmux-plugins/vim-tmux-focus-events', cond = os.getenv('TMUX')} + -- Tmux + function test_tmux() + return os.getenv('TMUX') ~= nil + end + use {'christoomey/vim-tmux-navigator'} + use {'tmux-plugins/vim-tmux-focus-events', cond = test_tmux} - -- Completion/snippets/LSP - use {'neovim/nvim-lspconfig'} - use { - 'nvim-lua/completion-nvim', - 'steelsojka/completion-buffers' - } - use { - 'nvim-treesitter/nvim-treesitter', - 'nvim-treesitter/nvim-treesitter-refactor', - 'nvim-treesitter/nvim-treesitter-textobjects', - {'nvim-treesitter/playground', opt = true} - } - use { - 'nvim-telescope/telescope.nvim', - requires = { - 'nvim-lua/popup.nvim', - 'nvim-lua/plenary.nvim' + -- Completion/snippets/LSP + use {'neovim/nvim-lspconfig'} + use { + 'nvim-lua/completion-nvim', + 'steelsojka/completion-buffers' + } + use { + 'nvim-treesitter/nvim-treesitter', + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + {'nvim-treesitter/playground', opt = true} } - } - - -- File navigation - use {'justinmk/vim-dirvish'} + use {'SirVer/ultisnips'} + use { + 'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/popup.nvim', + 'nvim-lua/plenary.nvim' + } + } - -- Colorscheme - use {'zegervdv/nvcode-color-schemes.vim'} + -- File navigation + use {'justinmk/vim-dirvish'} -end) + -- Colorscheme + use {'zegervdv/nvcode-color-schemes.vim'} + + end) +end local lsp = require'lspconfig'
--- a/dot_config/nvim/init.vim Tue Dec 22 15:42:45 2020 +0100 +++ b/dot_config/nvim/init.vim Wed Dec 23 11:10:42 2020 +0100 @@ -3,6 +3,9 @@ let s:darwin = has('mac') let s:windows = has('win32') +luafile ~/.config/nvim/config.lua +command! PackerLoad lua packer_enable() + " Activate built in plugins {{{ if !has('nvim') if has('packages') @@ -1075,9 +1078,6 @@ \ }, \ 'cache_enabled': 1, \ } - -luafile ~/.config/nvim/config.lua - " Load local vimrc if filereadable($HOME . '/.vimrc.local') source ~/.vimrc.local