Giter Site home page Giter Site logo

Comments (14)

debugloop avatar debugloop commented on June 3, 2024 3

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.

debugloop avatar debugloop commented on June 3, 2024 1

@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.

sethawright avatar sethawright commented on June 3, 2024 1

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.

debugloop avatar debugloop commented on June 3, 2024

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.

WilliamWelsh avatar WilliamWelsh commented on June 3, 2024

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.

maugusto99 avatar maugusto99 commented on June 3, 2024

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.

WilliamWelsh avatar WilliamWelsh commented on June 3, 2024

@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.

maugusto99 avatar maugusto99 commented on June 3, 2024

@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.

fecet avatar fecet commented on June 3, 2024

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.

fecet avatar fecet commented on June 3, 2024

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.

kevinrobayna avatar kevinrobayna commented on June 3, 2024

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.

Cruising0904 avatar Cruising0904 commented on June 3, 2024

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.

tomlajtos avatar tomlajtos commented on June 3, 2024

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.

debugloop avatar debugloop commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.