Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional neovim dependency? #1

Open
CapsAdmin opened this issue Sep 11, 2024 · 1 comment
Open

Optional neovim dependency? #1

CapsAdmin opened this issue Sep 11, 2024 · 1 comment

Comments

@CapsAdmin
Copy link

I understand this was made for neovim, but the dependency on neovim seems rather small.

As far as I can see, most vim.* functions could be implemented in pure Lua with the exception of vim.wait, vim.schedule, vim.defer_fn and some others.

I'd like to have the ability to have the latter core functions supplied in a library setup function and the rest be implemented in normal lua.

For example

function Object.keys(object)
  local result = {}
  for key in vim.spairs(object) do
    table.insert(result, key)
  end

  return result
end

could be rewritten as

function Object.keys(object)
  local result = {}
  for key in pairs(object) do
    table.insert(result, key)
  end
  
  table.sort(result)

  return result
end

You could roll your own vim.isarray function and put it in your List util module.

vim.schedule and others could be put in a wrapper module that allows to be configured with user supplied equivalent functions at runtime.

and so on

@izelnakri
Copy link
Owner

Hi @CapsAdmin,

Yes I've specifically developed this package for neovim.

If you could come up with a setup & working changes to make these packages run on any lua environment(while it doesnt error out in neovim environment like other alternative promise libraries in lua), I'd be happy to review & merge your pull request!

Ideally I'd like it to be tried in a single PR first, because personally it is out of the scope of my goals when I built these packages. However I'm willing to maintain it given we have a good initial setup that is fully tested and working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants