Skip to content

Add "quiet" config option to suppress action confirmation print statements #91

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

Closed
steve-lorimer opened this issue Jan 28, 2022 · 6 comments · Fixed by #118
Closed

Add "quiet" config option to suppress action confirmation print statements #91

steve-lorimer opened this issue Jan 28, 2022 · 6 comments · Fixed by #118
Labels
enhancement New feature or request

Comments

@steve-lorimer
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Whenever I execute a file action (eg: delete a file), I find the additional confirmation at the end of the action, which then requires an additional enter to dismiss, breaks my workflow

eg:

These files are going to be deleted:
/tmp/foo
Remove selected files [y/N]: y
/tmp/foo has been removed!                             \ these 2 lines
Press ENTER or type command to continue                / 

ie: the following print statements in actions.lua

print(string.format("%s has been moved!", filename))
print(string.format("\n%s has been removed!", p:absolute()))

Describe the solution you'd like

I would like a "quiet" config option which prevents the action confirmation print statement being output

@steve-lorimer steve-lorimer added the enhancement New feature or request label Jan 28, 2022
@fdschmidt93
Copy link
Member

Yeah, we should probably do this as part of #72

@fdschmidt93
Copy link
Member

fdschmidt93 commented Feb 8, 2022

Ok, I've looked a bit more into this and it's surprisingly tricky; it's essentially a mechanism such that (n)vim supposedly is able to give you more info and to be able to be redrawn after confirmation (which hardly is relevant in the usage here).

To reduce the number of hit-enter prompts:

  • Set 'cmdheight' to 2 or higher.
  • Add flags to 'shortmess'.
  • Reset 'showcmd' and/or 'ruler'.
  • Make sure :echo text is within |v:echospace| screen cells.

See :h hit-enter prompts.

So as an intermediate solution, one thing to do would be something akin to

local silent_action = function(action)
  return function(prompt_bufnr)
    local cmd = string.format([[lua require "telescope".extensions.file_browser.%s(%d)]], action, prompt_bufnr)
    vim.cmd(cmd)
  end
end

require("telescope").setup {
  extensions = {
    file_browser = {
      mappings = {
        ["i"] = {
          ["<A-y>"] = silent_action "copy",
        },
      },
    },
  },
}

I'll try to see how hit-enter can be cleanly avoided, though a super clean solution is not immediately apparent (cf. suggestions to reduce no. of prompts..).

@jamestrew
Copy link
Collaborator

Yeah I was struggling with this very thing in the i/o refactoring in #72 trying to deal with this issue and #87.

@fdschmidt93
Copy link
Member

As an update: see #87 (comment)

@steve-lorimer
Copy link
Contributor Author

Thank you!

@fdschmidt93
Copy link
Member

fdschmidt93 commented May 12, 2022

You're welcome :)

I know a quiet option may still be desirable, but just to note any notifications now should be much less intrusive as hit-enter should now be properly avoided everywhere it could pop up (at the very least any practical situation).

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

Successfully merging a pull request may close this issue.

3 participants