Closed shrimpram closed 3 years ago
Thanks for your report! To be clear, you're certain that your plugin specification file actually gets required (e.g. by the init.vim
line you mention)? Could you try printing something in your startup
function to make sure that this code actually runs? If the packer
commands are not being created and you don't have a custom configuration (i.e. turning commands off), then my first guess is that startup
is never actually running.
By startup function I assume you mean /home/shreeram/.local/share/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua
line 536 packer.startup = function(spec)
I just changed it to:
packer.startup = function(spec)
print('successfulstartup')
local user_func = nil
local user_config = nil
local user_plugins = nil
if type(spec) == 'function' then
user_func = spec
elseif type(spec) == 'table' then
if type(spec[1]) == 'function' then
user_func = spec[1]
elseif type(spec[1]) == 'table' then
user_plugins = spec[1]
else
log.error(
'You must provide a function or table of specifications as the first element of the argument to startup!')
return
end
Running nvim does not print anything, and running :Packer...
commands still throws the E492: Not an editor command
error; so I assume that the issue is that startup
is not running.
An additional note, nvim is throwing this error on startup itself, sorry I did not notice this while making the original issue:
Error detected while processing /home/shreeram/.config/nvim/init.vim:
line 1:
E5108: Error executing lua /home/shreeram/.config/nvim/lua/plugins.lua:6: attempt to call field '_update_package_paths' (a nil value)
I actually meant your call to the startup
function, but this tells us what we needed to know.
I believe that error - " attempt to call field '_update_package_paths' (a nil value)" is breaking evaluation of your plugin specification file before it reaches the call to the startup
function, which is what creates the commands for you. Per the comment above the _update_package_paths
line in the quickstart in the README, that function call is only for old versions of Neovim, and causes an error on newer versions. Removing that line should make your setup work.
That fixed it, I think I mistook that line as a similar "optional include" and didn't bother removing it. Thank you so much for your help and for creating packer! Closing this issue now.
I'm glad things are working! Feel free to open another issue if you run into more trouble.
nvim --version
: NVIM v0.5.0-dev+1342-gde96626ad (nightly)git --version
: 2.30.2Steps to reproduce
~/.config/nvim/init.vim
contains::set packpath?
outputs::PackerCompile
Actual behaviour
Nvim throws
E492: Not an editor command: PackerCompile
Expected behaviour
Packer should work
packer files
Plugin specification file(s)
Directly copied from the example given on the readme: ```lua -- This file can be loaded by calling `lua require('plugins')` from your init.vim -- Only required if you have packer configured as `opt` vim.cmd [[packadd packer.nvim]] -- Only if your version of Neovim doesn't have https://github.com/neovim/neovim/pull/12632 merged vim._update_package_paths() return require('packer').startup(function() -- Packer can manage itself use 'wbthomason/packer.nvim' -- Simple plugins can be specified as strings use '9mm/vim-closer' -- Lazy loading: -- Load on specific commands use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}} -- Load on an autocommand event use {'andymass/vim-matchup', event = 'VimEnter'} -- Load on a combination of conditions: specific filetypes or commands -- Also run code after load (see the "config" key) use { 'w0rp/ale', ft = {'sh', 'zsh', 'bash', 'c', 'cpp', 'cmake', 'html', 'markdown', 'racket', 'vim', 'tex'}, cmd = 'ALEEnable', config = 'vim.cmd[[ALEEnable]]' } -- Plugins can have dependencies on other plugins use { 'haorenW1025/completion-nvim', opt = true, requires = {{'hrsh7th/vim-vsnip', opt = true}, {'hrsh7th/vim-vsnip-integ', opt = true}} } -- Plugins can also depend on rocks from luarocks.org: use { 'my/supercoolplugin', rocks = {'lpeg', {'lua-cjson', version = '2.1.0'}} } -- You can specify rocks in isolation use_rocks 'penlight' use_rocks {'lua-resty-http', 'lpeg'} -- Local plugins can be included use '~/projects/personal/hover.nvim' -- Plugins can have post-install/update hooks use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview'} -- Post-install/update hook with neovim command use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } -- Post-install/update hook with call of vimscript function with argument use { 'glacambre/firenvim', run = function() vim.fn['firenvim#install'](0) end } -- Use specific branch, dependency and run lua file after load use { 'glepnir/galaxyline.nvim', branch = 'main', config = function() require'statusline' end, requires = {'kyazdani42/nvim-web-devicons'} } -- Use dependency and run lua function after load use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' }, config = function() require('gitsigns').setup() end } -- You can specify multiple plugins in a single call use {'tjdevries/colorbuddy.vim', {'nvim-treesitter/nvim-treesitter', opt = true}} -- You can alias plugin names use {'dracula/vim', as = 'dracula'} end) ```packer log file
Packer log file can't be found ![image](https://user-images.githubusercontent.com/67710369/119239944-82dfd280-bb01-11eb-89c7-f95051b58960.png)packer compiled file
Same as log file, packer_compiled.vim can't be foundApologies if this is a very basic issue