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

How to disable find file picker after chosing a project? #157

Open
reactVishnu opened this issue Jun 1, 2024 · 2 comments
Open

How to disable find file picker after chosing a project? #157

reactVishnu opened this issue Jun 1, 2024 · 2 comments

Comments

@reactVishnu
Copy link

Hi,

I want to disable the automatc file picker after chosing a project. It's annoying for the people who just want to change their directory.
Everytime I need to press esc to skip find file option.
Please help.

@ldfwbebp
Copy link

Hello,
I've tried this plugin. If you just want to change your project directory instead of file picker, you can try in insert mode after the :Telescope projects command.

@weofiw
Copy link

weofiw commented Jul 12, 2024

I use this wrapper function that resets the default select function back to the telescope default:

function()
  local actions = require("telescope.actions")
  local action_set = require("telescope.actions.set")
  local state = require("telescope.actions.state")
  require("telescope").extensions.projects.projects({
    attach_mappings = function(prompt_bufnr)
      actions.select_default:replace(function()
        local selected_entry = state.get_selected_entry()
        vim.api.nvim_set_current_dir(selected_entry.value)
        return action_set.select(prompt_bufnr, "default")
      end)
      return true
    end,
  })
end,

You can pass in whatever function you want to the replace call, but personally I wanted to open the directory as a buffer.

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

3 participants