Comments (14)
What mappings are you guys using now? As the <cr>
based mappings are causing trouble for so many people, I'm looking to change (or rather: add) new defaults for insert and normal mode as well. But I'm kinda unsure on what to settle on. In normal mode, I'd probably go with y
for yank additions, Y
for deletions, and u
for restore to that point. What are your ideas for insert mode?
from telescope-undo.nvim.
@fecet I use kitty + fish. I don't think that the shell really enters into the keybinding mess around <cr>
, though.
from telescope-undo.nvim.
I followed this for my iterm config and it began working https://stackoverflow.com/questions/16359878/how-to-map-shift-enter
from telescope-undo.nvim.
I suspect there might be interference from your terminal emulator. What do you use? Might that prevent receiving <S-Cr>
and <C-Cr>
? On the other hand, why would telescope receive a signal to close if Cr
plus modifiers didn't make it through... I'm afraid I need more info to reproduce this. (@meijieru as well, assuming you have the same issue when Thumbing Up ;))
So ideally: I need to know your terminal emulator, your shell, and if you can reproduce it with less suspicious bindings than Cr
with mods?
from telescope-undo.nvim.
I had remade the same bindings to send a hello message to make sure they were getting called and they were.
undo = {
side_by_side = true,
mappings = {
i = {
["<cr>"] = require("telescope-undo.actions").yank_additions,
["<S-cr>"] = print("<S-cr>"),
["<C-cr>"] = print("<C-cr>"),
},
},
},
Both got printed to :Messages
Terminal: iTerm 2
Shell: fish
I didn't mean like "close close" Telescope, all three binds close the Telescope popup; yanking additions works perfectly, yanking deletions always empties my clipboard, and nothing happens for restore.
Btw I LOVE this plugin
from telescope-undo.nvim.
I have the same issue with the restore command, but yank deletions works just fine
Terminal: Alacritty
Shell: Fish
return {
'nvim-telescope/telescope.nvim',
cond = function() return not vim.g.vscode end,
config = function()
local actions = require('telescope.actions')
local action_layout = require("telescope.actions.layout")
require("telescope").load_extension("fzf")
require("telescope").load_extension("undo")
require("telescope").setup {
defaults = {
prompt_prefix = " ",
selection_caret = " ",
sorting_strategy = "ascending",
layout_config = {
height = 0.80,
prompt_position = "top",
},
borderchars = {
prompt = { "─", " ", " ", " ", "─", "─", " ", " " },
results = { " " },
preview = { " " },
},
mappings = {
n = {
["<M-p>"] = action_layout.toggle_preview
},
i = {
["<C-j>"] = {
actions.move_selection_next, type = "action",
opts = { nowait = true, silent = true }
},
["<C-k>"] = {
actions.move_selection_previous, type = "action",
opts = { nowait = true, silent = true }
},
["<C-u>"] = false,
["<M-p>"] = action_layout.toggle_preview
}
}
},
pickers = {
find_files = {
find_command = { "fd", "--type", "f", "--no-ignore-vcs", "--strip-cwd-prefix" },
},
live_grep = {
live_grep_command = { "rg" },
},
grep_string = {
grep_string_command = { "rg" },
}
},
extensions = {
undo = {
side_by_side = true,
entry_format = "state #$ID, $STAT, $TIME",
mappings = {
i = {
-- IMPORTANT: Note that telescope-undo must be available when telescope is configured if
-- you want to replicate these defaults and use the following actions. This means
-- installing as a dependency of telescope in it's `requirements` and loading this
-- extension from there instead of having the separate plugin definition as outlined
-- above.
["<cr>"] = require("telescope-undo.actions").yank_additions,
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
["<C-Cr>"] = require("telescope-undo.actions").restore,
},
},
},
}
}
end,
keys = {
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
{ "<leader>fF", "<cmd>Telescope find_files hidden=true<cr>", desc = "Grep Project" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Find Hidden Files" },
-- find
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
-- git
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
-- search
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>fd", "<cmd>Telescope lsp_definitions<cr>", desc = "Diagnostics" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
{ "<leader>ut", "<cmd>Telescope undo<cr>", desc = "UndoTree" },
},
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = vim.fn.executable 'make' == 1,
},
"debugloop/telescope-undo.nvim",
},
cond = function() return not vim.g.vscode end,
}
from telescope-undo.nvim.
@maugusto99 Does yanking additions work for you? I can yank additions, but whenever I yank deletions it sets my register to be empty
from telescope-undo.nvim.
@WilliamWelsh try another terminal. In kitty and wezterm works just fine but inside alacritty I have to explicity mark C-return to ReceiveChar for telescope restore state works.
As @debugloop said it must be a terminal problem.
from telescope-undo.nvim.
As a curious beginner, most terminal cannot distinguish between and simple, I'm curious to know what terminal or shell you are using. Can you please share your preferred option?
from telescope-undo.nvim.
I think so too. I have had a similar issue, but I'm not sure if it's because the terminal cannot distinguish between S-CR and CR by default, or if there are unexpected issues with key mappings related to CR.
Just to confirm, in the default settings, the terminal doesn't know if the user pressed Shift+Enter or just Enter, and we can verify it from the output after pressing Ctrl+V followed by the key sequence right?
from telescope-undo.nvim.
Same here i'm currently using kitty and I can't restore values enter just closes the view
https://github.com/kevinrobayna/dotfiles/blob/master/.config/nvim/lua/plugins/telescope.lua#L83
from telescope-undo.nvim.
same problem here I also use kitty no mapping for Enter for my terminal
require("telescope-undo.actions").restore command not works
from telescope-undo.nvim.
I followed this for my iterm config and it began working https://stackoverflow.com/questions/16359878/how-to-map-shift-enter
Thank you @sethawright , the info in the link worked for me as well. I use Kitty-Tmux-LazyVim.
In kitty.conf I added :
map shift+enter send_text all \x1b[13;2u
map ctrl+enter send_text all \x1b[13;5u
and in tmux.conf added these lines:
bind -n S-Enter send-keys Escape "[13;2u"
bind -n C-Enter send-keys Escape "[13;5u"
Great plugin btw, thank you @debugloop !
from telescope-undo.nvim.
Thanks for providing a definitive answer @sethawright ! Still open to potential alternative defaults that don't involve <cr>
, but for now this seems the solution.
from telescope-undo.nvim.
Related Issues (20)
- Question; In fact not related to your code HOT 1
- Don't print filename in preview HOT 2
- Alternative to $TIME with absolute time HOT 1
- No preview window HOT 3
- Unable to map `<cr>` to `require("telescope-undo.actions").restore` when using lazy.nvim HOT 1
- Bug: Options are ignored HOT 18
- Bug: Instead of re-using scrolloff, let's have an specific option HOT 1
- Bug: Preview show "[Process exited 0]" when delta is used HOT 1
- Add support for telescope theme HOT 4
- Add an option to merge yank_addition and yank_deletion HOT 2
- Incompatibility with Zellij HOT 1
- Does not work with page and neovim remote HOT 2
- [Feature request]: Show which version is currently saved HOT 1
- Expected behavior of key mappings seems like they are not working. HOT 10
- Restore does not seem to be working HOT 1
- Diff Preview Against Current File HOT 8
- Error : after the second argument: expected table, got nil HOT 5
- u_undo: line numbers wrong HOT 1
- delta in wsl not working HOT 3
- [Bug / Question] Undo preview only showing difference HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telescope-undo.nvim.