From 7a1b29f62cb8cb9e3acc86335b33fc4e1392594e Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 9 Jul 2023 22:40:11 +0200 Subject: [PATCH] vim: make proper use of `dependencies` in `lazy.nvim` --- config/nvim/lua/user/plugins/completion.lua | 16 +++++++----- config/nvim/lua/user/plugins/lsp.lua | 9 ++++--- config/nvim/lua/user/plugins/telescope.lua | 27 +++++++-------------- config/nvim/lua/user/plugins/treesitter.lua | 14 +++++------ 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/config/nvim/lua/user/plugins/completion.lua b/config/nvim/lua/user/plugins/completion.lua index e8f8337..a7bda24 100644 --- a/config/nvim/lua/user/plugins/completion.lua +++ b/config/nvim/lua/user/plugins/completion.lua @@ -75,11 +75,15 @@ local config = function() end return { - { 'hrsh7th/nvim-cmp', config = config }, - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-nvim-lua', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-buffer', - 'onsails/lspkind-nvim', + 'hrsh7th/nvim-cmp', + + config = config, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lua', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-buffer', + 'onsails/lspkind-nvim', + }, } diff --git a/config/nvim/lua/user/plugins/lsp.lua b/config/nvim/lua/user/plugins/lsp.lua index 52d29f0..3a546d7 100644 --- a/config/nvim/lua/user/plugins/lsp.lua +++ b/config/nvim/lua/user/plugins/lsp.lua @@ -67,9 +67,12 @@ local config = function() end return { - { 'neovim/nvim-lspconfig', config = config }, + 'neovim/nvim-lspconfig', - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', + config = config, + dependencies = { + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + }, } diff --git a/config/nvim/lua/user/plugins/telescope.lua b/config/nvim/lua/user/plugins/telescope.lua index 5d78bed..418d659 100644 --- a/config/nvim/lua/user/plugins/telescope.lua +++ b/config/nvim/lua/user/plugins/telescope.lua @@ -80,6 +80,8 @@ local config = function() }, } + telescope.load_extension 'file_browser' + local selected_range = function() local _, s_row, s_col, _ = unpack(vim.fn.getpos('v')) local _, e_row, e_col, _ = unpack(vim.fn.getpos('.')) @@ -160,26 +162,15 @@ local config = function() map('n', 'fo', builtin.vim_options, { desc = ' [F]ind vim [O]ptions' }) map('n', 'fs', builtin.grep_string, { desc = ' [F]ind [S]tring' }) map('v', 'fs', custom.grep_visual, { desc = ' [F]ind visual [S]election' }) + map('n', 'br', 'Telescope file_browser', { desc = ' file [BR]owser' }) end -local telescope = { - 'nvim-telescope/telescope.nvim', - config = config, -} - -local file_browser = { - 'nvim-telescope/telescope-file-browser.nvim', - - dependencies = { 'nvim-telescope/telescope.nvim' }, - - config = function() - require('telescope').load_extension 'file_browser' - vim.keymap.set('n', 'br', 'Telescope file_browser', { desc = ' file [BR]owser' }) - end, -} - return { - telescope, - file_browser, + 'nvim-telescope/telescope.nvim', + + config = config, + dependencies = { + 'nvim-telescope/telescope-file-browser.nvim', + }, } diff --git a/config/nvim/lua/user/plugins/treesitter.lua b/config/nvim/lua/user/plugins/treesitter.lua index 2f8d405..01fbf4a 100644 --- a/config/nvim/lua/user/plugins/treesitter.lua +++ b/config/nvim/lua/user/plugins/treesitter.lua @@ -89,13 +89,13 @@ local config = function() end return { - { - 'nvim-treesitter/nvim-treesitter', - config = config, - }, + 'nvim-treesitter/nvim-treesitter', - 'nvim-treesitter/nvim-treesitter-refactor', - 'nvim-treesitter/nvim-treesitter-textobjects', - 'nvim-treesitter/playground', + config = config, + dependencies = { + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/playground', + }, }