telescope.nvim
telescope.nvim copied to clipboard
The select_default action can't be binded to <CR>
Description
If I leave the default binding of select_default to <CR> or try to set it manually it won't work and will be missing from the defined mappings for my builtin picker. It will only work if I set the mapping to another key combination like <C-O>.
Default <CR> mapping

Chaged mapping to <C-o>

Neovim version
VIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az164-457
Operating system and version
Ubuntu 20.04.4 LTS
Telescope version / branch / rev
telescope 0.1.0
checkhealth telescope
==================================================================
4 ## Checking for required plugins
5 - OK: plenary installed.
6 - OK: nvim-treesitter installed.
7
8 ## Checking external dependencies
9 - OK: rg: found ripgrep 11.0.2
10 - OK: fd: found fd 7.4.0
11
12 ## ===== Installed extensions =====
13
~
~
Steps to reproduce
- Do a fresh installation of telescope.
- Bind find_files to
ff - Try to do a file search
- Press enter on the desired file
Expected behavior
The selected file opens in the current buffer
Actual behavior
Nothing happens, telescope stays open in the selected file.
Minimal config
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{
'nvim-telescope/telescope.nvim',
requires = {
'nvim-lua/plenary.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
},
},
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
display = { non_interactive = true },
},
}
end
_G.load_config = function()
require('telescope').setup()
require('telescope').load_extension('fzf')
-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing Telescope and dependencies.")
vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
hmm weird, Can't reproduce. Works for me on nvim 0.7.2 and on nvim nightly

I've to try in an ubuntu vm later today. What terminal emulator do you use? Is this actually happening with the minimal rc that we provide? nvim -nu minimal.lua?
I'm using the default gnome terminal that comes with ubuntu(bash).
It's another plugin that's taking over the key mapping for <CR>. I disabled all of them and the key binding now shows up on the list. Later today I'm gonna figure out specifically which plugin is creating the issue and let you know.
EDIT: Escaped lt and gt signs.
Same behavior on my end. <CR> works in normal mode to open a file but it doesn't work in insert mode.
Gitsigns was the cause as well, although it's very inconsistent. Works with telescope file browser most of the time but with find_files it breaks a large amount of the time.
Okay, wait nevermind. This bug is still present even with only telescope loaded.
Neovim Version: 0.8.0. OS: EndeavourOS Terminal: Kitty Telescope Config:
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
local actions = require "telescope.actions"
telescope.setup {
defaults = {
prompt_prefix = " ",
selection_caret = " ",
path_display = { "smart" },
file_ignore_patterns = { ".git/", "node_modules" },
mappings = {
i = {
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<Right>"] = actions.cycle_history_next,
["<Left>"] = actions.cycle_history_prev,
["<Tab>"] = actions.move_selection_next,
["<S-Tab>"] = actions.move_selection_previous,
["<C-n>"] = actions.move_selection_next,
["<C-e>"] = actions.move_selection_previous,
["<C-m>"] = actions.cycle_history_next,
["<C-i>"] = actions.cycle_history_prev,
["<PageDown>"] = actions.preview_scrolling_up,
["<PageUp>"] = actions.preview_scrolling_down,
["<C-PageDown>"] = actions.results_scrolling_up,
["<C-PageUp>"] = actions.results_scrolling_down,
["<C-u>"] = actions.close,
["<esc>"] = actions.close,
},
n = {
["<CR>"] = actions.select_default,
["o"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<Tab>"] = actions.move_selection_next,
["<S-Tab>"] = actions.move_selection_previous,
["n"] = actions.move_selection_next,
["e"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["G"] = actions.move_to_bottom,
["<PageDown>"] = actions.preview_scrolling_up,
["<PageUp>"] = actions.preview_scrolling_down,
["<C-PageDown>"] = actions.results_scrolling_up,
["<C-PageUp>"] = actions.results_scrolling_down,
["<esc>"] = actions.close,
["?"] = actions.which_key,
},
},
},
extensions = {
file_browser = {
-- theme = "ivy",
hijack_netrw = true,
mappings = {
i = {
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<Right>"] = actions.cycle_history_next,
["<Left>"] = actions.cycle_history_prev,
["<Tab>"] = actions.move_selection_next,
["<S-Tab>"] = actions.move_selection_previous,
["<C-n>"] = actions.move_selection_next,
["<C-e>"] = actions.move_selection_previous,
["<C-m>"] = actions.cycle_history_next,
["<C-i>"] = actions.cycle_history_prev,
["<PageDown>"] = actions.preview_scrolling_up,
["<PageUp>"] = actions.preview_scrolling_down,
["<C-PageDown>"] = actions.results_scrolling_up,
["<C-PageUp>"] = actions.results_scrolling_down,
["<C-u>"] = actions.close,
["<esc>"] = actions.close,
},
n = {
["<CR>"] = actions.select_default,
["o"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<Tab>"] = actions.move_selection_next,
["<S-Tab>"] = actions.move_selection_previous,
["n"] = actions.move_selection_next,
["e"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["G"] = actions.move_to_bottom,
["<PageDown>"] = actions.preview_scrolling_up,
["<PageUp>"] = actions.preview_scrolling_down,
["<C-PageDown>"] = actions.results_scrolling_up,
["<C-PageUp>"] = actions.results_scrolling_down,
["<esc>"] = actions.close,
["?"] = actions.which_key,
},
},
},
},
}
telescope.load_extension "file_browser"
It seems to appear almost randomly because sometimes it works sometimes it doesn't and I can't find someway to make it happen consistently or not happen consistently.
I've tested with the above config and then the minimal config and it wasn't working. Tested with my full config again and it started working. Went back to retest with the minimal config again and it was also working. It legitimately just feels random. Really strange.
EDIT: The issue still persists with all my other plugins disabled and only telescope loaded with my above config. I tried the minimal config again after clearing nvim completely and that works now 100% of the time.
EDIT 2: Okay it's working now? I have no idea why. This is the current config I'm using. Not touching this again lol.
I experince the same issue with a config that is working fine on nvim 0.7, when i press enter instead of doing a select it goes one position up in the list in telescope, if i press enter again nothing happens, telescope pane stays open. This seems to interfere with nvim cmp, nvim autopairs and gitsigns possibly. No idea what is happening. Sometimes when you do LuaCacheClear it goes away if you restart nvim it sometimes works fine and sometimes breaks. Works okay in 0.7