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

Keep_insert not working #6

Closed
danymat opened this issue Feb 13, 2022 · 8 comments
Closed

Keep_insert not working #6

danymat opened this issue Feb 13, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@danymat
Copy link

danymat commented Feb 13, 2022

Hello, I use now your plugin as primary workspace jumping, and it works very well, congrats, and thanks !

It seems that keep_insert is not working, this is my telescope config and my workspace one:

		use({
			"nvim-telescope/telescope.nvim",
			config = function()
				local actions = require("telescope.actions")
				require("telescope").setup({
					defaults = require("telescope.themes").get_ivy({
						winblend = 10,
						mappings = {
							i = {
								["<C-j>"] = actions.move_selection_next,
								["<C-k>"] = actions.move_selection_previous,

								["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
								["<C-a>"] = actions.send_to_qflist + actions.open_qflist,
							},
							n = {
								["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
								["<C-a>"] = actions.send_to_qflist + actions.open_qflist,
							},
						},
					}),
					extensions = {
						["ui-select"] = require("telescope.themes").get_cursor(),
						workspaces = {
							keep_insert = true,
						},
					},
				})

				require("telescope").load_extension("ui-select")
				require("telescope").load_extension("fzf")
				require("telescope").load_extension("workspaces")
			end,
			requires = {
				"nvim-lua/popup.nvim",
				"nvim-telescope/telescope-ui-select.nvim",
				"nvim-telescope/telescope-fzf-native.nvim",
				"natecraddock/workspaces.nvim",
			},
		})

		use({
			"natecraddock/workspaces.nvim",
			config = function()
				require("workspaces").setup({
					hooks = {
						open = { "Telescope find_files" },
					},
				})
			end,
		})

PS: not related to this issue, but I don't feel like creating an other issue for this:
Would it be possible to provide vim.notify messages after a WorkspaceAdd, WorkspaceRemove, WorkspaceList (if no workspaces) ?

@natecraddock natecraddock self-assigned this Feb 13, 2022
@natecraddock natecraddock added the bug Something isn't working label Feb 13, 2022
@natecraddock
Copy link
Owner

Thank you for reporting and sharing so much details! That will help me debug. I won't have time to look closer until tomorrow, but I've also seen some issues with keep_insert lately so I'm interested in getting this resolved quickly. I'll keep you updated!

Would it be possible to provide vim.notify messages after a WorkspaceAdd, WorkspaceRemove, WorkspaceList (if no workspaces) ?

I think this is fine, let me make sure I understand. After a WorkspacesAdd or WorkspacesRemove a notification indicating success, and after WorkspacesList a notification warning if there are no workspaces? I'll probably put this behind a configuration boolean.

I use now your plugin as primary workspace jumping, and it works very well, congrats, and thanks !

I'm glad you find it useful :)

@natecraddock
Copy link
Owner

Other than installing ui-select and fzf extensions, I replicated your setup and cannot reproduce. I open a workspace and the find_files picker opens in insert mode. When you say keep_insert isn't working, do you mean that the picker opens in normal mode after using the extension :Telescope workspaces when it should be insert, right?

Based on the behavior of startinsert and stopinsert, I'm thinking this might be a timing/race condition bug. My open hook first tries to load a saved session, and if that fails it tries to open a find_files picker. In that case the picker opens in normal mode for me instead of insert mode. I have a few ideas and I'll try those to see if I can resolve anything.

@danymat
Copy link
Author

danymat commented Feb 14, 2022

Other than installing ui-select and fzf extensions, I replicated your setup and cannot reproduce. I open a workspace and the find_files picker opens in insert mode. When you say keep_insert isn't working, do you mean that the picker opens in normal mode after using the extension :Telescope workspaces when it should be insert, right?

:Telescope workspaces opens in insert mode, but after <CR>, the hook is back on normal mode

@danymat
Copy link
Author

danymat commented Feb 14, 2022

I think this is fine, let me make sure I understand. After a WorkspacesAdd or WorkspacesRemove a notification indicating success, and after WorkspacesList a notification warning if there are no workspaces? I'll probably put this behind a configuration boolean.

Exactly !

natecraddock added a commit that referenced this issue Feb 14, 2022
Issue #6 reports the keep_insert setting not maintaining insert mode in
chained telescope pickers. I am unable to reproduce, but I observe
similar behavior when starting a picker in my own workspace open hooks.

Rather than relying on telescope to set insert mode properly, we can
just schedule a call to :startinsert which hopefully runs later after
telescope setup finishes.
@natecraddock
Copy link
Owner

I just made the fix-6-keep-insert branch which hopefully resolves this issue. When you get a chance, could you test it and let me know if everything works?

@danymat
Copy link
Author

danymat commented Feb 14, 2022

It works well !

@natecraddock
Copy link
Owner

Great to hear! Merged to master

@natecraddock
Copy link
Owner

natecraddock commented Feb 15, 2022

Going to leave this as a note here: https://github.com/nvim-telescope/telescope.nvim/pull/1600/files Seems like this was introduced in nvim 0.6.1, and it may be fixed in 0.7.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants