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

Get mark list in lua table #97

Open
rodrigoEsquel opened this issue Sep 18, 2023 · 0 comments
Open

Get mark list in lua table #97

rodrigoEsquel opened this issue Sep 18, 2023 · 0 comments

Comments

@rodrigoEsquel
Copy link

rodrigoEsquel commented Sep 18, 2023

Similar to a previous issue I would like to be able to get the added marks as a table in lua to interact with my configuration (for example)

This will require adding a new option in the choose_list

function M.choose_list(list_type)
  local list_fn
  if list_type == "loclist" then
    list_fn = function(items, flags) vim.fn.setloclist(0, items, flags) end
  elseif list_type == "quickfixlist" then
    list_fn = vim.fn.setqflist
    ---------
  elseif list_type == "table" then
    list_fn = function(items) return items end
    ---------
  end
  return list_fn
end

And for this to work properly it is needed to add a return in the Mark functions

function Mark:buffer_to_list(list_type, bufnr)
  list_type = list_type or "loclist"

  local list_fn = utils.choose_list(list_type)
  ........................
  >return< list_fn(items, "r")
end
function Mark:all_to_list(list_type)
  list_type = list_type or "loclist"

  local list_fn = utils.choose_list(list_type)
  ............
  >return< list_fn(items, "r")
end
function Mark:global_to_list(list_type)
  list_type = list_type or "loclist"

  local list_fn = utils.choose_list(list_type)
  ............
  >return< list_fn(items, "r")
end

I will happily make the PR if you think this approach is correct

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

1 participant