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

feat: show assigned function in actions.which_key #1871

Merged

Conversation

fdschmidt93
Copy link
Member

@fdschmidt93 fdschmidt93 commented Apr 22, 2022

Out of laziness, I now left action_mt docs out, because their main purpose otherwise (apart from originally for which_key) I suppose is sufficiently described in :h telescope.actions

Works as intended in my tests. If you don't like it @Conni2461 , it's totally fine 😅 felt like a challenge and my experiments are running on GPUs now anyways.

Closes #1869

My test code

local builtin = require("telescope.builtin")
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")

local M = {}

M.print_prompt = function(prompt_bufnr)
  local current_picker = action_state.get_current_picker(prompt_bufnr)
  current_picker:_get_prompt(value)
  print(prompt)
end

function print_value(prompt_bufnr)
  local value = action_state.get_current_history().value
  print(value)
end

local say_hi = function(prompt_bufnr)
  print("hi")
end

builtin.find_files({
  attach_mappings = function(prompt_buf, map)
    map("i", "X", function()
      print("test")
    end)
    map("i", "p", M.set_prompt)
    map("i", "P", print_value)
    map("i", "H", say_hi)
    map("i", "O", require "fds.utils".resize)
    return true
  end,
})

image

@Conni2461
Copy link
Member

Lets make this the last commit part of the 0.6 tag

Thanks :) LGTM

@Conni2461 Conni2461 merged commit d88094f into nvim-telescope:master Apr 22, 2022
@fdschmidt93 fdschmidt93 deleted the chore/improve-which-key branch April 22, 2022 13:58
@Conni2461
Copy link
Member

Conni2461 commented Apr 22, 2022

Oh yeah. I write docs/spec for actions.mt.

Me mentioning it that we should do it, was not like me asking you to do it. If that makes sense 😆

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

Successfully merging this pull request may close these issues.

Mappings do not appear on which key
2 participants