Mercurial > dotfiles
changeset 409:f0300cd1584c
Defer loading of packer config
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sat, 17 Jul 2021 11:32:01 +0200 |
parents | 4406fc85ba0a |
children | 7c7feeaa3058 |
files | dot_config/nvim/config.lua |
diffstat | 1 files changed, 325 insertions(+), 323 deletions(-) [+] |
line wrap: on
line diff
--- a/dot_config/nvim/config.lua Sat Jul 17 11:25:54 2021 +0200 +++ b/dot_config/nvim/config.lua Sat Jul 17 11:32:01 2021 +0200 @@ -12,357 +12,359 @@ execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) end --- Packer configuration is compiled and only needs to be loaded on changes -vim.cmd 'packadd packer.nvim' +vim.defer_fn(function() + -- Packer configuration is compiled and only needs to be loaded on changes + vim.cmd 'packadd packer.nvim' + + require('packer').startup(function() + use { 'wbthomason/packer.nvim', opt = true } -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 = { + 'Delete', + 'Unlink', + 'Move', + 'Rename', + 'Mkdir', + 'Chmod', + 'Cfind', + 'Clocate', + 'Lfind', + 'Llocate', + 'SudoEdit', + 'SudoWrite', + 'Wall', + }, + } + + use { 'psliwka/vim-smoothie' } - use { 'tpope/vim-obsession' } - use { - 'tpope/vim-eunuch', - cmd = { - 'Delete', - 'Unlink', - 'Move', - 'Rename', - 'Mkdir', - 'Chmod', - 'Cfind', - 'Clocate', - 'Lfind', - 'Llocate', - 'SudoEdit', - 'SudoWrite', - 'Wall', - }, - } + use { 'nvim-lua/plenary.nvim' } + + -- Spelling/autocorrection + use { 'tpope/vim-abolish' } + + -- Git/VCS + use { 'vim-scripts/gitignore' } + use { 'sjl/splice.vim', opt = true, cmd = { 'SpliceInit' } } + use { 'tpope/vim-git' } + + -- Comments + use { 'b3nj5m1n/kommentary' } + + -- Undoing + use { 'sjl/gundo.vim', cmd = { 'GundoToggle' } } - use { 'psliwka/vim-smoothie' } + -- Parentheses etc + use { 'tpope/vim-surround' } + use { 'raimondi/delimitMate' } + + -- Moving around within lines + use { 'wellle/targets.vim', event = 'InsertEnter *' } + + -- Searching + use { 'mhinz/vim-grepper', cmd = { 'Grepper' } } - use { 'nvim-lua/plenary.nvim' } + -- Keymaps TODO: to be removed when #13823 is merged + use { + 'tjdevries/astronauta.nvim', + config = function() + require 'astronauta.keymap' + end, + } - -- Spelling/autocorrection - use { 'tpope/vim-abolish' } + -- Opening files + use { 'wsdjeg/vim-fetch' } - -- Git/VCS - use { 'vim-scripts/gitignore' } - use { 'sjl/splice.vim', opt = true, cmd = { 'SpliceInit' } } - use { 'tpope/vim-git' } + -- Indent lines + use { + 'lukas-reineke/indent-blankline.nvim', + config = function() + vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } + vim.g.indent_blankline_show_first_indent_level = false + end, + } - -- Comments - use { 'b3nj5m1n/kommentary' } + -- Increment/decrement + use { + 'zegervdv/nrpattern.nvim', + requires = 'tpope/vim-repeat', + config = function() + local nrpattern = require 'nrpattern' + local defaults = require 'nrpattern.default' + + defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } } + defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } - -- Undoing - use { 'sjl/gundo.vim', cmd = { 'GundoToggle' } } + nrpattern.setup(defaults) + end, + } + + -- Tmux + use { + 'numtostr/navigator.nvim', + config = function() + require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } - -- Parentheses etc - use { 'tpope/vim-surround' } - use { 'raimondi/delimitMate' } - - -- Moving around within lines - use { 'wellle/targets.vim', event = 'InsertEnter *' } - - -- Searching - use { 'mhinz/vim-grepper', cmd = { 'Grepper' } } + local nnoremap = vim.keymap.nnoremap + nnoremap { '<c-h>', require('Navigator').left, silent = true } + nnoremap { '<c-j>', require('Navigator').down, silent = true } + nnoremap { '<c-k>', require('Navigator').up, silent = true } + nnoremap { '<c-l>', require('Navigator').right, silent = true } + end, + requires = 'tjdevries/astronauta.nvim', + after = 'astronauta.nvim', + } - -- Keymaps TODO: to be removed when #13823 is merged - use { - 'tjdevries/astronauta.nvim', - config = function() - require 'astronauta.keymap' - end, - } - - -- Opening files - use { 'wsdjeg/vim-fetch' } + -- Completion/snippets/LSP + use { 'neovim/nvim-lspconfig' } + use { + 'hrsh7th/nvim-compe', + config = function() + require('compe').setup { + enabled = true, + autocomplete = true, + debug = false, + min_length = 1, + preselect = 'enable', + throttle_time = 80, + source_timeout = 1000, + incomplete_delay = 400, + max_abbr_width = 100, + max_kind_width = 100, + max_menu_width = 100, + documentation = true, - -- Indent lines - use { - 'lukas-reineke/indent-blankline.nvim', - config = function() - vim.g.indent_blankline_buftype_exclude = { 'terminal', 'help', 'nofile' } - vim.g.indent_blankline_show_first_indent_level = false - end, - } + source = { + path = true, + buffer = true, + nvim_lsp = true, + nvim_lua = true, + spell = false, + vsnip = true, + }, + } - -- Increment/decrement - use { - 'zegervdv/nrpattern.nvim', - requires = 'tpope/vim-repeat', - config = function() - local nrpattern = require 'nrpattern' - local defaults = require 'nrpattern.default' + vim.cmd [[ inoremap <silent><expr> <C-y> compe#complete() ]] + vim.cmd [[ inoremap <silent><expr> <CR> compe#confirm({ 'keys': "\<Plug>delimitMateCR", 'mode': '' }) ]] + vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] + end, + } + use { + { + 'nvim-treesitter/nvim-treesitter', + config = function() + require 'nvim-treesitter.highlight' - defaults[{ 'input', 'output' }] = { priority = 12, filetypes = { 'verilog', 'systemverilog' } } - defaults[{ "'1", "'0" }] = { priority = 9, filetypes = { 'verilog', 'systemverilog' } } - - nrpattern.setup(defaults) - end, - } - - -- Tmux - use { - 'numtostr/navigator.nvim', - config = function() - require('Navigator').setup { auto_save = 'current', disable_on_zoom = true } + require('nvim-treesitter.configs').setup { + highlight = { enable = false }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = 'gnn', + node_incremental = 'grn', + scope_incremental = 'grc', + node_decremental = 'grm', + }, + }, + refactor = { + highlight_definitions = { enable = true }, + smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, + navigation = { + enable = true, + keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, + }, + }, + textobjects = { + move = { + enable = true, + goto_next_start = { [']]'] = '@block.outer' }, + goto_previous_start = { ['[['] = '@block.outer' }, + goto_next_end = { [']['] = '@block.outer' }, + goto_previous_end = { ['[]'] = '@block.outer' }, + }, + }, + playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, + } + end, + }, + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + { 'nvim-treesitter/playground', opt = true }, + } + use { 'hrsh7th/vim-vsnip', requires = 'hrsh7th/vim-vsnip-integ' } + use { + 'glepnir/lspsaga.nvim', + config = function() + require('lspsaga').init_lsp_saga {} + end, + } + use { + 'rmagatti/goto-preview', + config = function() + require('goto-preview').setup {} + end, + } + use { + 'jose-elias-alvarez/null-ls.nvim', + requires = 'nvim-lua/plenary.nvim', + } + use { + 'folke/lua-dev.nvim', + } - local nnoremap = vim.keymap.nnoremap - nnoremap { '<c-h>', require('Navigator').left, silent = true } - nnoremap { '<c-j>', require('Navigator').down, silent = true } - nnoremap { '<c-k>', require('Navigator').up, silent = true } - nnoremap { '<c-l>', require('Navigator').right, silent = true } - end, - requires = 'tjdevries/astronauta.nvim', - after = 'astronauta.nvim', - } + -- Vanity + use { + 'yamatsum/nvim-web-nonicons', + requires = 'kyazdani42/nvim-web-devicons', + config = function() + require 'nvim-nonicons' + end, + } - -- Completion/snippets/LSP - use { 'neovim/nvim-lspconfig' } - use { - 'hrsh7th/nvim-compe', - config = function() - require('compe').setup { - enabled = true, - autocomplete = true, - debug = false, - min_length = 1, - preselect = 'enable', - throttle_time = 80, - source_timeout = 1000, - incomplete_delay = 400, - max_abbr_width = 100, - max_kind_width = 100, - max_menu_width = 100, - documentation = true, + use { + 'glepnir/galaxyline.nvim', + branch = 'main', + -- your statusline + config = function() + local gl = require 'galaxyline' + local colors = require('galaxyline.theme').default + local condition = require 'galaxyline.condition' + local gls = gl.section + + colors.bg = '#2C323C' - source = { - path = true, - buffer = true, - nvim_lsp = true, - nvim_lua = true, - spell = false, - vsnip = true, - }, - } + gls.left[1] = { + RainbowRed = { + provider = function() + return '▊ ' + end, + highlight = { colors.blue, colors.bg }, + }, + } + + gls.left[2] = { + FileIcon = { + provider = 'FileIcon', + condition = condition.buffer_not_empty, + highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, + }, + } - vim.cmd [[ inoremap <silent><expr> <C-y> compe#complete() ]] - vim.cmd [[ inoremap <silent><expr> <CR> compe#confirm({ 'keys': "\<Plug>delimitMateCR", 'mode': '' }) ]] - vim.cmd [[ inoremap <silent><expr> <C-e> compe#close('<C-e>') ]] - end, - } - use { - { - 'nvim-treesitter/nvim-treesitter', - config = function() - require 'nvim-treesitter.highlight' + gls.left[3] = { + FileName = { + provider = 'FileName', + condition = condition.buffer_not_empty, + highlight = { colors.magenta, colors.bg, 'bold' }, + }, + } + + gls.right[1] = { + ShowLspClient = { + provider = 'GetLspClient', + condition = function() + local tbl = { ['dashboard'] = true, [''] = true } + if tbl[vim.bo.filetype] then + return false + end + return true + end, + icon = require('nvim-nonicons').get 'server' .. ' LSP:', + highlight = { colors.green, colors.bg, 'bold' }, + }, + } - require('nvim-treesitter.configs').setup { - highlight = { enable = false }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = 'gnn', - node_incremental = 'grn', - scope_incremental = 'grc', - node_decremental = 'grm', - }, + gls.right[2] = { + LineInfo = { + provider = 'LineColumn', + separator = ' ', + separator_highlight = { 'NONE', colors.bg }, + highlight = { colors.fg, colors.bg }, + }, + } + + gls.right[3] = { + PerCent = { + provider = 'LinePercent', + separator = ' ', + separator_highlight = { 'NONE', colors.bg }, + highlight = { colors.fg, colors.bg, 'bold' }, }, - refactor = { - highlight_definitions = { enable = true }, - smart_rename = { enable = true, keymaps = { smart_rename = 'gsr' } }, - navigation = { - enable = true, - keymaps = { goto_definition = 'gnd', list_definitions = 'gnD' }, - }, + } + gls.right[8] = { + RainbowBlue = { + provider = function() + return ' ▊' + end, + highlight = { colors.blue, colors.bg }, }, - textobjects = { - move = { - enable = true, - goto_next_start = { [']]'] = '@block.outer' }, - goto_previous_start = { ['[['] = '@block.outer' }, - goto_next_end = { [']['] = '@block.outer' }, - goto_previous_end = { ['[]'] = '@block.outer' }, - }, + } + + gls.short_line_left[1] = { + BufferType = { + provider = 'FileTypeName', + separator = ' ', + separator_highlight = { 'NONE', colors.bg }, + highlight = { colors.blue, colors.bg, 'bold' }, }, - playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, + } + + gls.short_line_left[2] = { + SFileName = { + provider = 'SFileName', + condition = condition.buffer_not_empty, + highlight = { colors.fg, colors.bg, 'bold' }, + }, + } + + gls.short_line_right[1] = { + BufferIcon = { provider = 'BufferIcon', highlight = { colors.fg, colors.bg } }, } end, - }, - 'nvim-treesitter/nvim-treesitter-refactor', - 'nvim-treesitter/nvim-treesitter-textobjects', - { 'nvim-treesitter/playground', opt = true }, - } - use { 'hrsh7th/vim-vsnip', requires = 'hrsh7th/vim-vsnip-integ' } - use { - 'glepnir/lspsaga.nvim', - config = function() - require('lspsaga').init_lsp_saga {} - end, - } - use { - 'rmagatti/goto-preview', - config = function() - require('goto-preview').setup {} - end, - } - use { - 'jose-elias-alvarez/null-ls.nvim', - requires = 'nvim-lua/plenary.nvim', - } - use { - 'folke/lua-dev.nvim', - } + } - -- Vanity - use { - 'yamatsum/nvim-web-nonicons', - requires = 'kyazdani42/nvim-web-devicons', - config = function() - require 'nvim-nonicons' - end, - } + -- File navigation + use { 'justinmk/vim-dirvish' } - use { - 'glepnir/galaxyline.nvim', - branch = 'main', - -- your statusline - config = function() - local gl = require 'galaxyline' - local colors = require('galaxyline.theme').default - local condition = require 'galaxyline.condition' - local gls = gl.section - - colors.bg = '#2C323C' - - gls.left[1] = { - RainbowRed = { - provider = function() - return '▊ ' - end, - highlight = { colors.blue, colors.bg }, - }, - } - - gls.left[2] = { - FileIcon = { - provider = 'FileIcon', - condition = condition.buffer_not_empty, - highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.bg }, - }, - } - - gls.left[3] = { - FileName = { - provider = 'FileName', - condition = condition.buffer_not_empty, - highlight = { colors.magenta, colors.bg, 'bold' }, - }, - } + -- Colorscheme + use { + 'zegervdv/one-lush', + requires = 'rktjmp/lush.nvim', + config = function() + require 'lush_theme.one-lush' + vim.cmd [[ colorscheme one-lush ]] + end, + } - gls.right[1] = { - ShowLspClient = { - provider = 'GetLspClient', - condition = function() - local tbl = { ['dashboard'] = true, [''] = true } - if tbl[vim.bo.filetype] then - return false - end - return true - end, - icon = require('nvim-nonicons').get 'server' .. ' LSP:', - highlight = { colors.green, colors.bg, 'bold' }, - }, - } - - gls.right[2] = { - LineInfo = { - provider = 'LineColumn', - separator = ' ', - separator_highlight = { 'NONE', colors.bg }, - highlight = { colors.fg, colors.bg }, - }, - } - - gls.right[3] = { - PerCent = { - provider = 'LinePercent', - separator = ' ', - separator_highlight = { 'NONE', colors.bg }, - highlight = { colors.fg, colors.bg, 'bold' }, - }, - } - gls.right[8] = { - RainbowBlue = { - provider = function() - return ' ▊' - end, - highlight = { colors.blue, colors.bg }, - }, - } + -- Terminal + use { + 'akinsho/nvim-toggleterm.lua', + config = function() + require('toggleterm').setup { + size = 15, + open_mapping = [[<F12>]], + shade_filetypes = { 'none' }, + shade_terminals = true, + persist_size = true, + direction = 'horizontal', + } + end, + } - gls.short_line_left[1] = { - BufferType = { - provider = 'FileTypeName', - separator = ' ', - separator_highlight = { 'NONE', colors.bg }, - highlight = { colors.blue, colors.bg, 'bold' }, - }, - } - - gls.short_line_left[2] = { - SFileName = { - provider = 'SFileName', - condition = condition.buffer_not_empty, - highlight = { colors.fg, colors.bg, 'bold' }, - }, - } - - gls.short_line_right[1] = { - BufferIcon = { provider = 'BufferIcon', highlight = { colors.fg, colors.bg } }, - } - end, - } - - -- File navigation - use { 'justinmk/vim-dirvish' } - - -- Colorscheme - use { - 'zegervdv/one-lush', - requires = 'rktjmp/lush.nvim', - config = function() - require 'lush_theme.one-lush' - vim.cmd [[ colorscheme one-lush ]] - end, - } - - -- Terminal - use { - 'akinsho/nvim-toggleterm.lua', - config = function() - require('toggleterm').setup { - size = 15, - open_mapping = [[<F12>]], - shade_filetypes = { 'none' }, - shade_terminals = true, - persist_size = true, - direction = 'horizontal', - } - end, - } - - -- Filetypes - use { 'Glench/Vim-Jinja2-Syntax' } -end) + -- Filetypes + use { 'Glench/Vim-Jinja2-Syntax' } + end) +end, 0) -- LSP config local lsp = require 'lspconfig'