Closed bryant-the-coder closed 2 years ago
local install_path = fn.stdpath('data')..'C:/Users/User/AppData/Local/nvim-data/site/pack/packer/start/packer.nvim'
This is wrong. stdpath('data') will return C:/Users/User/AppData/Local/nvim-data
, so proper concatenation should be:
local install_path = fn.stdpath('data') .. "\\site\\pack\\packer\\start\\packer.nvim"
You can checkout my configs to better understand packer configuration: init.lua, packerinit.lua, pluginlist.lua
Hi again. I don't really understand the lazy load. I know that it will load on a specific command. But how should i load it? cmd = {'Dispatch', 'Make', 'Focus', 'Start'}
. Take this command as an example. How should I load it in neovim?
Consider nvim-tree, which implements commands such as :NvimTreeToggle
, :NvimTreeRefresh
, and so on. If nvim-tree is lazy loaded, only upon calling :NvimTreeToggle
or :NvimTreeRefresh
packer loads Nvimtree.
In this case, nvim-tree can be lazy loaded as such:
use({
"kyazdani42/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeRefresh" },
})
Oh thanks. Please don't close this issue. Cause I have many question to ask. 😅😅😅
This is what i got after lazy loading plugins
My config:
local fn = vim.fn
local install_path = fn.stdpath('data')..'$HOME/AppData/Local/nvim-data/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end
return require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Theme
use 'folke/tokyonight.nvim'
use 'morhetz/gruvbox'
use 'arcticicestudio/nord-vim'
use 'dracula/vim'
use 'drewtempelmeyer/palenight.vim'
use 'projekt0n/github-nvim-theme'
-- Explorer menu
use ({
'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons',
cmd = {"NvimTreeToggle",
"NvimTreeRefresh",
"NvimTreeClose"}
})
-- Autopairs
use 'jiangmiao/auto-pairs'
-- Telescope
use ({
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} },
cmd = {
"Telescope find_files",
"Telescope live_grep",
"Telescope buffers",
"Telescope help_tags",
"Telescope file_browser",
"Telescope colorscheme",
"Telescope oldfiles",
"Telescope keymaps"},
})
-- Start screen
use 'glepnir/dashboard-nvim'
-- Statusline
use {
'nvim-lualine/lualine.nvim',
requires = {'kyazdani42/nvim-web-devicons', opt = true}
}
-- Bufferline
use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'}
-- Indentation
use 'lukas-reineke/indent-blankline.nvim'
-- Colorizer
use 'norcalli/nvim-colorizer.lua'
use 'junegunn/rainbow_parentheses.vim'
-- nvim-comment
use 'terrortylor/nvim-comment'
-- COC
use {
'neoclide/coc.nvim',
branch = 'release'
}
use 'honza/vim-snippets'
-- Git
use 'mhinz/vim-signify'
-- Terminal Intergration
use ({
"akinsho/toggleterm.nvim",
cmd = {
"ToggleTerm",
"ToggleTermOpenAll"}
})
end)
Did I do something wrong?
Firstly, packer will move lazy loaded plugins to opt
folder from start
folder, hence the Removing the following directories
dialogue.
Secondly,
-- Telescope
use ({
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} },
cmd = {
"Telescope find_files",
"Telescope live_grep",
"Telescope buffers",
"Telescope help_tags",
"Telescope file_browser",
"Telescope colorscheme",
"Telescope oldfiles",
"Telescope keymaps"},
})
This won't work, as cmd table only accepts single-word commands.
Also,
local install_path = fn.stdpath('data')..'$HOME/AppData/Local/nvim-data/site/pack/packer/start/packer.nvim'
-- should be:
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
So I gotta write like this?
use ({
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} },
cmd = { "Telescope find_files", "Telescope live_grep", "Telescope buffers", "Telescope buffers", "Telescope help_tags", "Telescope file_browser", "Telescope colorscheme", "Telescope oldfiles", "Telescope keymaps"}
})
No, they still consist of 2 words, Telescope
find_files
, cmd only works with a single word like NvimTreeToggle
. Use just Telescope
instead.
Noted sir
Config:
When I start neovim, it says this ╔══════════════════════════════════════════════════════════════════════════════╗ ~ ║ Removing the following directories. OK? (y/N) ║ ~ ║ ║ ~ ║ - C:\Users\User\AppData\Local\nvim-data\site\pack\packer\start\packer.nvim ║ ~ ║ ║ ~ ╚══════════════════════════════════════════════════════════════════════════════╝
When I say N. This error shows up
[packer.nvim] [ERROR 09:11:04] async.lua:20: Error i...7: attempt to index local 'display_win' (a nil value)
I have already clone the link for PowerShell. But still gets this error. Please help.