GithubHelp home page GithubHelp logo

Comments (17)

folke avatar folke commented on July 4, 2024

It's the terminal mappings:

-- Terminal Mappings
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to Left Window" })
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to Lower Window" })
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to Upper Window" })
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to Right Window" })
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })

fyi, I'm actually creating a fzf-lua extra. Will probably release it later today

from lazyvim.

folke avatar folke commented on July 4, 2024

Add the below to your fzf-lua spec:

{
    "ibhagwan/fzf-lua",
    event = "VeryLazy",
    opts = {},
    keys = {
      { "<esc>", "<cmd>close<cr>", ft = "fzf", mode = "t", nowait = true },
      { "<c-j>", "<Down>", ft = "fzf", mode = "t", nowait = true },
      { "<c-k>", "<Up>", ft = "fzf", mode = "t", nowait = true },
   }
}
...

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

Thank you very much @folke for the quick answer.

fyi, I'm actually creating a fzf-lua extra. Will probably release it later today

Oh, exciting; I guess you read my mind 😉; looking forward to it

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

@folke I just saw your addition of the fzf-lua extra. Thank you!

However, I see it disables Telescope. I agree that the two plugins are somehow doing the same thing, but I've been personally using them together (some things in fzf-lua and some things in telescope).

I saw a similar comment about luasnip and nvim-snippets about being able to somehow override the disabling.

Maybe in the snippets case, it might be less applicable, but since I've been using fzf-lua and telescope together, I was wondering if there's any way (or any plan to support) to override what's disabled

from lazyvim.

folke avatar folke commented on July 4, 2024

Then just add telescope with enabled = true to your own config

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

Oh that works, great, didn't know it takes precedence if I do it in my config; thank you!

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

@folke an update on this: I think <C-j> and <C-k> are still not working

Minimal repro:

 -- DO NOT change the paths and don't remove the colorscheme
local 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)

vim.g.mapleader = " "

-- install plugins
local plugins = {
  { 'LazyVim/LazyVim', import = 'lazyvim.plugins' },
  { import = 'lazyvim.plugins.extras.editor.fzf' },
  {
    'nvim-telescope/telescope.nvim',
    enabled = true,
    keys = {
      { '<leader>/', false },
    },
  },
  {
    'ibhagwan/fzf-lua',
    url = 'https://github.com/ibhagwan/fzf-lua',
    cmd = { 'FzfLua' },
    keys = {
      { '<leader>/', '<cmd>FzfLua blines<cr>', desc = 'buffer lines (fzf)' },
    },
    opts = {
      keymap = {
        builtin = {
          ['<C-f>'] = 'preview-page-down',
          ['<C-b>'] = 'preview-page-up',
        },
      },
    },
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

If I do "buffer lines" (using <leader>/), I was expecting <C-j> and <C-k> to work as expected, but that's not the case.

I tried disabling lazyvim altogether and having the keys directly in there like this:

local plugins = {
  -- { 'LazyVim/LazyVim', import = 'lazyvim.plugins' },
  -- { import = 'lazyvim.plugins.extras.editor.fzf' },
  {
    'nvim-telescope/telescope.nvim',
    enabled = true,
    keys = {
      { '<leader>/', false },
    },
  },
  {
    'ibhagwan/fzf-lua',
    url = 'https://github.com/ibhagwan/fzf-lua',
    cmd = { 'FzfLua' },
    keys = {
      { '<leader>/', '<cmd>FzfLua blines<cr>', desc = 'buffer lines (fzf)' },
      { "<c-j>", "<Down>", ft = "fzf", mode = "t", nowait = true },
      { "<c-k>", "<Up>", ft = "fzf", mode = "t", nowait = true },
    },
    opts = {
      keymap = {
        builtin = {
          ['<C-f>'] = 'preview-page-down',
          ['<C-b>'] = 'preview-page-up',
        },
      },
    },
  },
}

And that's still not working.

It only works if I remove the bindings altogether (and disable lazyvim and its fzf extra)

from lazyvim.

folke avatar folke commented on July 4, 2024

IT all works perfectly fine using the fzf-lua extra.
If it doesn't work for you, then you messed something up.

from lazyvim.

dpetka2001 avatar dpetka2001 commented on July 4, 2024

I've also switched fully to fzf-lua Extra since yesterday and can confirm that <C-j>/<C-k> work as they should on my end.

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

If it doesn't work for you, then you messed something up.

I thought that would be the case; that's why I tried with the second minimal repro snippet above; I event shrunk it down to be like this:

-- DO NOT change the paths and don't remove the colorscheme
local 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 = {
  { "LazyVim/LazyVim", import = "lazyvim.plugins" },
  { import = "lazyvim.plugins.extras.editor.fzf" },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

And still doesn't work. I thought the fact that I'm using this minimal config means that there's nothing on my side interfering with anything 🤔

from lazyvim.

dpetka2001 avatar dpetka2001 commented on July 4, 2024

Are you sure you don't have any terminal mappings that might interfere? I just tried the minimal file you mention and it also works there as well.

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

Are you sure you don't have any terminal mappings that might interfere? I just tried the minimal file you mention and it also works there as well.

OMG, you guys are starting to make me feel like I'm crazy 😆

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

This spec works:

local plugins = {
  {
    "ibhagwan/fzf-lua",
  },
}

And when I add lazyvim (not even the extra) seems to break <C-j> and <C-k>

local plugins = {
  { "LazyVim/LazyVim", import = "lazyvim.plugins" },
  {
    "ibhagwan/fzf-lua",
  },
}

This one closes the fzf popup when I press <C-j> and <C-k>.

And this one:

local plugins = {
  { "LazyVim/LazyVim", import = "lazyvim.plugins" },
  { import = "lazyvim.plugins.extras.editor.fzf" },
  {
    "ibhagwan/fzf-lua",
  },
}

Disables them completely and nothing happens when I press them

from lazyvim.

dpetka2001 avatar dpetka2001 commented on July 4, 2024

Here is a screencast of the minimal file you mention

Screencast.2024-06-11.23.11.56.webm

from lazyvim.

folke avatar folke commented on July 4, 2024

Can you make sure your lazy.nvim is 100% up to date?
Even in that repro, you need to open lazy and update (or delete .repro)

from lazyvim.

farzadmf avatar farzadmf commented on July 4, 2024

Man, this is SOOO weird. I tried to do a screen recording (and I did but it's about 34MB and I don't know how to do a smaller one with Mac 🙁 ).

But steps:

  1. Delete .repro folder (to make sure we're clean)
  2. Do nv -u repro.lua and let it do its thing
  3. While lazy.nvim's window is open, press U to udpate everything
  4. Quit and re-open nv -u repro.lua
  5. Press f to open the files dialog
  6. <C-j>, <C-k>, <Up>, and <Down> are all no-ops and don't do anything

So, even if I managed to upload my screen recording, at the end, you would see fzf-lua window appearing there for a while, and that was me pressing the keys and seeing nothing happens

from lazyvim.

dpetka2001 avatar dpetka2001 commented on July 4, 2024

I can't reproduce this as I've already showed in the screencast. You can even see the keys I'm pressing and <C-j>/<C-k> work just fine. It's something specific to your system (terminal or something else).

from lazyvim.

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.