-
-
Notifications
You must be signed in to change notification settings - Fork 799
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
Any buffer opened through the pickers open in Insert mode ... #2995
Comments
I can't reproduce this. |
@jamestrew, so after a few updates, there's no magic mode, but sometimes it still opens any |
Hi @jamestrew! I was facing this issue for a long time and didn't really know if it's a telescope bug or not. I'm not sure if I'm talking about the issue that originally was described by @daUnknownCoder here, but you can look at it:
vim.api.nvim_create_autocmd('ModeChanged', {
pattern = '*:*',
callback = function() vim.print(vim.v.event.new_mode) end,
})
I'm the author of I don't really know why I was playing with telescope sources and noticed this:
My thoughts are that there can be something happening in the neovim event loop, that forgets to fire Please, let me know if I need to open a separate issue for this. I'm also ready to provide more information if that's needed! |
I'm not experiencing this on either neovim 0.9.5 or master, telescope 0.1.6 or master. telescope-insert.mp4Here's the minimal config I used for this demolocal root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
{
"nvim-telescope/telescope.nvim",
tag = "0.1.6",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
},
config = function()
require("telescope").setup({})
vim.keymap.set("n", "<C-p>", ":Telescope find_files<CR>")
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.opt.cmdheight = 3
vim.api.nvim_create_autocmd("ModeChanged", {
pattern = "*:*",
callback = function()
print(vim.v.event.new_mode, vim.bo.filetype, vim.api.nvim_buf_get_name(0))
end,
}) Although semi-recently, there was a neovim issue that caused entering files from telescope to stay in insert mode. #2766 |
This happened to me too, but disabling codeium.vim stopped it from happening. |
you sure its due to |
I don't know how to fix it, but I commented this line and it never happen again. function! codeium#RedrawStatusLine() abort
if s:using_codeium_status
" redrawstatus " comment this line
endif
endfunction I've found that this happens only when the autocmd augroup codeium
autocmd!
autocmd InsertEnter,CursorMovedI,CompleteChanged * call codeium#DebouncedComplete()
autocmd BufEnter * if mode() =~# '^[iR]'|call codeium#DebouncedComplete()|endif
autocmd InsertLeave * call codeium#Clear()
" autocmd BufLeave * if mode() =~# '^[iR]'|call codeium#Clear()|endif " this autocmd is triggered |
Again, this seems like the same issue from #2766 where the cause was doing certain operations inside a |
@jamestrew yes indeed, I tried tweaking everything and found out that it's not the bug you were describing. It's actually |
so i guess i have to cross-post this on codeium.vim's github @Nebell |
@Nebell, i am using {
'vim.fn["codeium#GetStatusString"]()',
fmt = function(str)
if str == " ON" then
return " "
elseif str == " OFF" then
return " "
elseif str == " * " then
return " "
else
return " " .. str
end
end,
}, |
I don't know how to fix it on |
@rasulomaroff your issue appears to be a separate thing. Can you create a new issue for it? I'm also curious if you are able to replicate your issue with my minimal config from above (#2995 (comment)) It would be great if you can also try to replicate this without telescope and just using vim/neovim api as this may very well be not specific to telescope. You can see an example of how I did this for the issue affecting codeium.vim here neovim/neovim#27038 |
@jamestrew It's really hard to reproduce this issue without using Telescope, because I believe it happens when several conditions are met. Anyway, I don't think this is a telescope bug even though it happens only when I'm using it. As I stated above, when I put some So, to reproduce my issue you have to:
-- restores the latest cursor position when opening a buffer
local group = vim.api.nvim_create_augroup('restore-cursor-position', {})
vim.api.nvim_create_autocmd('BufReadPre', {
desc = 'Jump to the latest position in this buffer',
group = group,
callback = function(opts)
vim.api.nvim_create_autocmd('FileType', {
once = true,
buffer = opts.buf,
group = group,
callback = function()
local ft = vim.bo.filetype
-- ignore these filetypes
if ft == 'commit' or ft == 'rebase' then return end
local mark = vim.api.nvim_buf_get_mark(opts.buf, '"')
if mark[1] > 0 and mark[1] <= vim.api.nvim_buf_line_count(opts.buf) then
-- vim.api.nvim_win_set_cursor(0, mark)
vim.cmd.normal { 'g`"zz', bang = true }
end
end,
})
end,
})
vim.api.nvim_create_autocmd('ModeChanged', {
pattern = '*:*',
callback = function() vim.print(vim.v.event.new_mode) end,
}) This autocmd basically restores the last position in a buffer
What to note here:
As I said, even though it happens using telescope, this is clearly not a telescope bug. Something when calling Should I create a new issue for this? If so, clearly in |
so the magic problem is solved i guess, but it really was a nuisance, i had to press
|
Description
when i opened a file with
Telescope live_grep
orTelescope find_files
it opens the files, but they get opened in a differed custom mode i would say, like lualine shows it'sNormal
mode and my cursor is also thick [for insert it is thin], but i can type in like normal letters, if there's a keymap with that letter, the which-key pops up and i can go back to normal mode with<Esc>
but this is annoyingNeovim version
Operating system and version
6.7.9-arch1-1
Telescope version / branch / rev
v0.1.6 -> master
checkhealth telescope
Steps to reproduce
just try using the pickers...
Expected behavior
No magic mode, it automatically goes into sort of insert mode
Actual behavior
Kooha-2024-03-20-23-14-17.webm
i use lazy.nvim
Minimal config
The text was updated successfully, but these errors were encountered: