cvigilv / esqueleto.nvim

Reduce your boilerplate code the lazy-bones way
MIT License
100 stars 7 forks source link

Error on basic config #28

Closed nhatvan2231 closed 1 year ago

nhatvan2231 commented 1 year ago

I have this error after following the README at "Usage & Configuration" step. I'm using packer.

Error detected while processing /home/nhatvan1561/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...ack/packer/start/esqueleto.nvim/lua/esqueleto/config.lua:18: inv
alid type name: table: 0x4165f928
stack traceback:
        [C]: in function 'error'
        vim/shared.lua:608: in function 'validate'
        ...ack/packer/start/esqueleto.nvim/lua/esqueleto/config.lua:18: in function 'updateconfig'
        .../pack/packer/start/esqueleto.nvim/lua/esqueleto/init.lua:9: in function 'setup'
        /home/nhatvan1561/.config/nvim/init.lua:10: in main chunk
Press ENTER or type command to continue
cvigilv commented 1 year ago

This is an error in setup function, could you please send me your configuration?

nhatvan2231 commented 1 year ago

This is what I have with skeletons directory contains python and latex folder and a file README.md.

--vim.loader.enable()

--Basic
require('settings')
require('autocmd')
require('plugins')
require('keybinds')

--Extra
require("esqueleto").setup(                                                                          
     {
       -- Template directories
       directories = {"~/.config/nvim/skeleton/"},

       -- Patterns to match when creating new file
       -- Can be either (i) file names or (ii) file types.
       -- Exact file name match have priority
       patterns = {"latex", "README.md", "python" },

       -- whether to auto-use a template if it's the only one for a pattern
       autouse = true,

       advanced = {
         -- List of files glob patterns to ignore
         -- Or alternatively, a function that determines if a file should be ignored
         ignored = {},

         -- Ignore OS files like .DS_Store
         -- Exhaustive list: https://www.toptal.com/developers/gitignore/api/windows,macos,linux
         ignore_os_files = true,
       },
    })
cvigilv commented 1 year ago

I can't reproduce the error, could you add the version of nvim you are using and an example of how you are using the plugin (please add template, template directory structure and command-line args you are using)

cvigilv commented 1 year ago

Also, if you are using an older version of the plugin, it will not recognize the new tables and throw an error (in theory). Could you check that also and comment?

nhatvan2231 commented 1 year ago

Well I'm a newbie with neovim. So, this is my init.lua file and the plugins.lua and the whole config directory. Note python and README.md is empty.

.config/nvim
|      init.lua
|___lua
|     |      autocmd.lua
|     |      keybinds.lua
|     |      plugins.lua
|     |      settings.lua
|
|___plugin
|     |      packer_compiled.lua
|
|___skeletons
|     |      python
|     |      README.md
|     |___latex
|             |      default

init.lua

  0 --vim.loader.enable()                                                                                
  1 
  2 --Basic
  3 require('settings')
  4 require('autocmd')
  5 require('plugins')
  6 require('keybinds')
  7 
  8 --Extra
  9 require("esqueleto").setup(
 10     {
 11       -- Template directories
 12       directories = {"~/.config/nvim/skeletons/"},
 13 
 14       -- Patterns to match when creating new file
 15       -- Can be either (i) file names or (ii) file types.
 16       -- Exact file name match have priority
 17       patterns = {"latex"},
 18 
 19       -- whether to auto-use a template if it's the only one for a pattern
 20       autouse = true,
 21 
 22       advanced = {
 23         -- List of files glob patterns to ignore
 24         -- Or alternatively, a function that determines if a file should be ignored
 25         ignored = {},
 26 
 27         -- Ignore OS files like .DS_Store
 28         -- Exhaustive list: https://www.toptal.com/developers/gitignore/api/windows,macos,linux
 29         ignore_os_files = true,
 30       },
 31     }
 32 )

plugins.lua

  0 local ensure_packer = function()                                                                     
  1   local fn = vim.fn
  2   local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
  3   if fn.empty(fn.glob(install_path)) > 0 then
  4     fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_p    ath})
  5     vim.cmd [[packadd packer.nvim]]
  6     return true
  7   end
  8   return false
  9 end
 10  
 11 vim.cmd([[
 12   augroup packer_user_config
 13     autocmd!
 14     autocmd BufWritePost plugins.lua source <afile> | PackerCompile
 15   augroup end
 16 ]])
 17  
 18 local packer_bootstrap = ensure_packer()
 19  
 20 -- This file can be loaded by calling `lua require('plugins')` from your init.vim
 21  
 22 -- Only required if you have packer configured as `opt`
 23 vim.cmd [[packadd packer.nvim]]
 24  
 25 return require('packer').startup(function(use)
 26   -- Packer can manage itself
 27   use 'wbthomason/packer.nvim'
 28 ◃▹use 'cvigilv/esqueleto.nvim'
 29 ◃▹
 30 ◃▹-- Automatically set up your configuration after cloning packer.nvim
 31   -- Put this at the end after all plugins
 32   if packer_bootstrap then
 33     require('packer').sync()
 34   end
 35 end)
nhatvan2231 commented 1 year ago

Solve! I just need to update my neovim.