Closed RayZ0rr closed 2 years ago
I'm having the exact same issue with junegunn/fzf, :Files, :GFiles and :History are not working.
here is the buttons section:
dashboard.section.buttons.val = {
dashboard.button( "f", " > Find file", ":call ControlP()<CR>"),
dashboard.button( "r", " > Recent" , ":History<CR>"),
dashboard.button( "s", " > Settings" , ":e $MYVIMRC<CR>"),
dashboard.button( "e", " > New file" , ":ene<CR>"),
dashboard.button( "q", " > Quit NVIM", ":qa<CR>"),
}
the ControlP() function is just a function that calls :GFiles or :Files depending on if I'm inside a git project or not
this is really strange to me, the dashboard theme calls feedkeys
internally when you press <CR>
https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/themes/dashboard.lua#L53
so pressing <CR>
should result in the same behavior as you literally typing the 3rd argument to button
this problem doesn't happen with telescope or clap, i haven't used any other fuzzy finders so i don't have a great intuition for what kind of problems could arise. the two things i can think of that might be fishy off the top of my head are
sorry, it's pretty late and i'm not at my work machine rn so i'll continue taking notes :9
something other debugging troubleshooting steps to try
dashboard.button( "s", " > Settings" , ":e $MYVIMRC | :FzfLua files cwd=~/.config/nvim | :somenoop<CR>"),
I managed to get this working for Fzf-lua by editing dashboard button
function. Here's my relevant section from config. I have commented out original code above my modification for reference
local function button(sc, txt, keybind, keybind_opts)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = {
position = "center",
shortcut = sc,
cursor = 5,
width = 50,
hl = "Label",
align_shortcut = "right",
hl_shortcut = "Keyword",
}
if keybind then
keybind_opts = if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
-- opts.keymap = { "n", sc_, keybind, keybind_opts }
opts.keymap = { "n", sc_, "<cmd>" .. keybind .. "<cr>", keybind_opts }
end
local function on_press()
local key = vim.api.nvim_replace_termcodes(sc_ .. "<Ignore>", true, false, true)
-- vim.api.nvim_feedkeys(key, "normal", false)
vim.cmd(keybind)
end
return {
type = "button",
val = txt,
on_press = on_press,
opts = opts,
}
end
The buttons
group now looks like this:
local buttons = {
type = "group",
val = {
button("e", " New file", "ene"),
button("f", " File Explorer","FzfLua files"),
button("o", " Recently opened files","FzfLua oldfiles"),
button("g", " Find word","FzfLua grep_project"),
button("m", " Jump to bookmarks","lua require('fzf-lua').marks()"),
button("s", " Open last session","sessionManager load_session"),
-- button("SPC f f", " Find file","lua require('fzf-lua').files()"),
-- button("SPC f o", " Recently opened files","FzfLua oldfiles"),
-- button("SPC f g g", " Find word","FzfLua grep_project"),
-- button("SPC f m", " Jump to bookmarks","lua require('fzf-lua').marks()"),
-- button("SPC s l", " Open last session"),
},
opts = {
spacing = 1,
},
}
My full config is here.
ok this for sure some quirk of feedkeys
. i'm going to push a hotfix that will fix this but break the button pressing queue feature
I am using the following config with alpha :
alpha.lua
```lua local alpha = require'alpha' local dashboard = require'alpha.themes.dashboard' dashboard.section.header.val = { [[ __ ]], [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], } dashboard.section.buttons.val = { dashboard.button( "e", " New file" , ":eneI am not able to use the options
f
,r
ands
by pressing enter key on them. Thefzf-lua
opens and closes immediately. I can open these choices by pressingf
,r
ands
keys respectively. Other choices can be selected with enter key. Fors
choice, selecting with enter key on it opens init.vim but not fzf-lua window. Usings
key opens both.