Giter Site home page Giter Site logo

Comments (16)

Ultra-Code avatar Ultra-Code commented on July 17, 2024 3

@savq I suggest having this example snippets in the readme. I have been try to make this work for a long time till now with the exact same plugin. It will be good to see an example of using run in the readme and this plugin is also widely used so I bet a lot of users have hit the readme just like did but didn't find any useful example on run. The docs is good though , and I read it but it didn't mention anything on nvim/vim commands . Good job done at creating this simple yet powerful plugin package manager .

from paq-nvim.

Gavinok avatar Gavinok commented on July 17, 2024

Why not use vim.cmd?

from paq-nvim.

kovasap avatar kovasap commented on July 17, 2024

from paq-nvim.

Gavinok avatar Gavinok commented on July 17, 2024

@kovasap

 paq{ 'nvim-treesitter/nvim-treesitter', run=vim.cmd('TSUpdate') }

is all it should take. Or am I missing something

from paq-nvim.

kovasap avatar kovasap commented on July 17, 2024

from paq-nvim.

Gavinok avatar Gavinok commented on July 17, 2024

Ohhh, I didn't realize that's what you meant! That should work perfectly.

On Mon, May 31, 2021, 10:20 PM Gavinok @.***> wrote:

@kovasap https://github.com/kovasap

paq{ '', run=vim.cmd('TSUpdate') }

is all it should take. Or am I missing something


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#35 (comment), or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ACC3NAQKNM7KKXLQHBN5P4LTQRUVVANCNFSM45YPSUMA
.

May want to close the issue if it is solved

from paq-nvim.

kovasap avatar kovasap commented on July 17, 2024

Sorry was replying on phone via email.

from paq-nvim.

Mrfiregem avatar Mrfiregem commented on July 17, 2024

@kovasap

 paq{ 'nvim-treesitter/nvim-treesitter', run=vim.cmd('TSUpdate') }

This doesn't work because the function in run is called as soon as nvim is opened. I got around this by wrapping vim.cmd("TSUpdate") in another function so I can write it like ... run = wrapper, without parenthesis.

Otherwise you'd get an error:

Vim:E492: Not an editor command: TSUpdate

from paq-nvim.

kovasap avatar kovasap commented on July 17, 2024

Oh yes that makes sense! Thanks for the clarification.

from paq-nvim.

savq avatar savq commented on July 17, 2024

@Mrfiregem is correct. run can take a function so to wrap :TSUpdate one would write:

 paq {'nvim-treesitter/nvim-treesitter', run=function() vim.cmd 'TSUpdate' end}

With the latest changes, the run command will only run when there have actually been changes in the plugin repo,
so you might see the hook message a lot less often.

from paq-nvim.

David-Else avatar David-Else commented on July 17, 2024

I am trying to use the run command but get errors! (Neovim 0.7)

failed to run hook for fzf, failed to install fzf
failed to run hook for nvim-treesitter, failed to install fzf

Can anyone help?

require 'paq' {
  'savq/paq-nvim',
  'junegunn/fzf.vim',

  {
    'junegunn/fzf',
    run = function()
      vim.cmd './install --all'
    end,
  },

  {
    'nvim-treesitter/nvim-treesitter',
    run = function()
      vim.cmd 'TSUpdate'
    end,
  },
}

from paq-nvim.

Ultra-Code avatar Ultra-Code commented on July 17, 2024

@David-Else you should rather be doing something like this {"junegunn/fzf", run = vim.fn['fzf#install']()} because from what https://github.com/junegunn/fzf#as-vim-plugin say you have to run fzf#install() which is an autoload fn and vim.fn is how to call autoload fn's in lua

from paq-nvim.

David-Else avatar David-Else commented on July 17, 2024

@Ultra-Code Thanks! Unfortunately I get this error:

E5113: Error while calling lua chunk: Vim:E117: Unknown function: fzf#install
stack traceback:
        [C]: in function 'fzf#install'

Can you help? Cheers!

from paq-nvim.

Ultra-Code avatar Ultra-Code commented on July 17, 2024

@David-Else
It should be this instead

 {
        "junegunn/fzf",
        run = function()
            vim.fn["fzf#install"]()
        end,
    },

but this also gives the error below which shouldn't be so

detected an error while processing fzf#install:                                                                             
línea   10                                                                                                                             
E605: the excepcion /usr/share/vim/vimfiles/install not found ,didn't get caught

I get this same error when I execute :call fzf#install()
but :call fzf#run(fzf#wrap({'source': 'ls'})) works. I'm using NVIM v0.7.0 . I suggest you report this to fzf upstream. It looks like this isn't a lua or paq-nvim issue
The error is triggered by the line below in fzf#install. You can check the function with :verbose function fzf#install

if !executable(script)                                                                                                          
     throw script.' not found'                                                                                                     
endif  

from paq-nvim.

David-Else avatar David-Else commented on July 17, 2024

@Ultra-Code Cheers! I have just removed the plugin instead and will install it manually.

from paq-nvim.

Ultra-Code avatar Ultra-Code commented on July 17, 2024

@David-Else 😄 that works too

from paq-nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.