comparison dot_config/nvim/config.lua @ 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
comparison
equal deleted inserted replaced
324:64a0c6cec54c 325:ce396166d009
5 5
6 local execute = vim.api.nvim_command 6 local execute = vim.api.nvim_command
7 local fn = vim.fn 7 local fn = vim.fn
8 8
9 -- Bootstrap package manager 9 -- Bootstrap package manager
10 local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' 10 local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'
11 11
12 if fn.empty(fn.glob(install_path)) > 0 then 12 if fn.empty(fn.glob(install_path)) > 0 then
13 execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path) 13 execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
14 end 14 end
15 15
16 require('packer').startup(function() 16 -- Packer configuration is compiled and only needs to be loaded on changes
17 use {'wbthomason/packer.nvim'} 17 function packer_enable()
18 18 vim.cmd "packadd packer.nvim"
19 -- General plugins 19
20 use {'tpope/vim-sensible'} 20 require('packer').startup(function()
21 use {'tpope/vim-repeat'} 21 use {'wbthomason/packer.nvim', opt = true}
22 use {'tpope/vim-rsi'} 22
23 use {'sgur/vim-editorconfig'} 23 -- General plugins
24 use {'ShikChen/osc52.vim'} 24 use {'tpope/vim-sensible'}
25 use {'einfachtoll/didyoumean'} 25 use {'tpope/vim-repeat'}
26 26 use {'tpope/vim-rsi'}
27 use {'tpope/vim-obsession'} 27 use {'sgur/vim-editorconfig'}
28 use { 28 use {'ShikChen/osc52.vim'}
29 'tpope/vim-eunuch', 29 use {'einfachtoll/didyoumean'}
30 cmd = { 30
31 'Remove', 31 use {'tpope/vim-obsession'}
32 'Unlink', 32 use {
33 'Move', 33 'tpope/vim-eunuch',
34 'Rename', 34 cmd = {
35 'Mkdir', 35 'Remove',
36 'Chmod', 36 'Unlink',
37 'Find', 37 'Move',
38 'Locate', 38 'Rename',
39 'SudoEdit', 39 'Mkdir',
40 'SudoWrite' 40 'Chmod',
41 } 41 'Find',
42 } 42 'Locate',
43 43 'SudoEdit',
44 -- Spelling/autocorrection 44 'SudoWrite'
45 use {'tpope/vim-abolish'} 45 }
46 46 }
47 -- Git/VCS 47
48 use {'vim-scripts/gitignore'} 48 use {'psliwka/vim-smoothie'}
49 use {'sjl/splice.vim', opt = true, cmd = {'SpliceInit'}} 49
50 use {'tpope/vim-git'} 50 -- Spelling/autocorrection
51 51 use {'tpope/vim-abolish'}
52 -- Comments 52
53 use {'tpope/vim-commentary'} 53 -- Git/VCS
54 54 use {'vim-scripts/gitignore'}
55 -- Undoing 55 use {'sjl/splice.vim', opt = true, cmd = {'SpliceInit'}}
56 use {'sjl/gundo.vim', cmd = {'GundoToggle'}} 56 use {'tpope/vim-git'}
57 57
58 -- Parentheses etc 58 -- Comments
59 use {'tpope/vim-surround'} 59 use {'tpope/vim-commentary'}
60 use {'raimondi/delimitMate'} 60
61 use {'zegervdv/vim-endwise'} 61 -- Undoing
62 62 use {'sjl/gundo.vim', cmd = {'GundoToggle'}}
63 -- Moving around within lines 63
64 use {'wellle/targets.vim', event = 'InsertEnter *'} 64 -- Parentheses etc
65 65 use {'tpope/vim-surround'}
66 -- Searching 66 use {'raimondi/delimitMate'}
67 use {'mhinz/vim-grepper', cmd = {'Grepper'}} 67 use {'zegervdv/vim-endwise'}
68 68
69 -- Indent lines 69 -- Moving around within lines
70 use {'Yggdroot/indentline'} 70 use {'wellle/targets.vim', event = 'InsertEnter *'}
71 use {'lukas-reineke/indent-blankline.nvim', branch = 'lua'} 71
72 72 -- Searching
73 -- Tmux 73 use {'mhinz/vim-grepper', cmd = {'Grepper'}}
74 use {'christoomey/vim-tmux-navigator', cond = os.getenv('TMUX')} 74
75 use {'tmux-plugins/vim-tmux-focus-events', cond = os.getenv('TMUX')} 75 -- Indent lines
76 76 use {'Yggdroot/indentline'}
77 -- Completion/snippets/LSP 77 use {'lukas-reineke/indent-blankline.nvim', branch = 'lua'}
78 use {'neovim/nvim-lspconfig'} 78
79 use { 79 -- Tmux
80 'nvim-lua/completion-nvim', 80 function test_tmux()
81 'steelsojka/completion-buffers' 81 return os.getenv('TMUX') ~= nil
82 } 82 end
83 use { 83 use {'christoomey/vim-tmux-navigator'}
84 'nvim-treesitter/nvim-treesitter', 84 use {'tmux-plugins/vim-tmux-focus-events', cond = test_tmux}
85 'nvim-treesitter/nvim-treesitter-refactor', 85
86 'nvim-treesitter/nvim-treesitter-textobjects', 86 -- Completion/snippets/LSP
87 {'nvim-treesitter/playground', opt = true} 87 use {'neovim/nvim-lspconfig'}
88 } 88 use {
89 use { 89 'nvim-lua/completion-nvim',
90 'nvim-telescope/telescope.nvim', 90 'steelsojka/completion-buffers'
91 requires = { 91 }
92 'nvim-lua/popup.nvim', 92 use {
93 'nvim-lua/plenary.nvim' 93 'nvim-treesitter/nvim-treesitter',
94 } 94 'nvim-treesitter/nvim-treesitter-refactor',
95 } 95 'nvim-treesitter/nvim-treesitter-textobjects',
96 96 {'nvim-treesitter/playground', opt = true}
97 -- File navigation 97 }
98 use {'justinmk/vim-dirvish'} 98 use {'SirVer/ultisnips'}
99 99 use {
100 -- Colorscheme 100 'nvim-telescope/telescope.nvim',
101 use {'zegervdv/nvcode-color-schemes.vim'} 101 requires = {
102 102 'nvim-lua/popup.nvim',
103 end) 103 'nvim-lua/plenary.nvim'
104 }
105 }
106
107 -- File navigation
108 use {'justinmk/vim-dirvish'}
109
110 -- Colorscheme
111 use {'zegervdv/nvcode-color-schemes.vim'}
112
113 end)
114 end
104 115
105 116
106 local lsp = require'lspconfig' 117 local lsp = require'lspconfig'
107 local lsputil = require'lspconfig.util' 118 local lsputil = require'lspconfig.util'
108 119