-
nvim windows11 My simplified configuration is as follows: vim.keymap.set({'n', 'v', 't'}, '<C-j>', '<C-w>j')
vim.keymap.set({'n', 'v', 't'}, '<C-k>', '<C-w>k')
vim.keymap.set({'n', 'v', 't'}, '<C-h>', '<C-w>h')
vim.keymap.set({'n', 'v', 't'}, '<C-l>', '<C-w>l')
require "lazy".setup{
{
"ibhagwan/fzf-lua",
opts = {
keymap = {
fzf = {
["<C-j>"] = "down",
["<C-k>"] = "up",
},
},
}
}
} I use |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
setup a filetype autocmd on ft=fzf |
Beta Was this translation helpful? Give feedback.
-
Thank you for the reminder. I found a way to achieve this. function autoKey(func)
local act = func==vim.keymap.del and {}
func({'n', 'v', 't'}, '<C-j>', act or '<C-w>j')
func({'n', 'v', 't'}, '<C-k>', act or '<C-w>k')
func({'n', 'v', 't'}, '<C-h>', act or '<C-w>h')
func({'n', 'v', 't'}, '<C-l>', act or '<C-w>l')
end
autoKey(vim.keymap.set)
vim.api.nvim_create_autocmd("FileType", {
pattern = "fzf",
callback = function()
autoKey(vim.keymap.del)
end,
})
vim.api.nvim_create_autocmd("BufWinLeave", {
pattern = "*",
callback = function()
if vim.bo.filetype == "fzf" then
autoKey(vim.keymap.set)
end
end,
})
|
Beta Was this translation helpful? Give feedback.
-
to avoid reset map u can set buf local map the key to itself on fzf filetype |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reminder {
"ibhagwan/fzf-lua",
config = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = "fzf",
callback = function()
vim.keymap.set('t', '<C-j>', '<C-j>', { buffer = true })
vim.keymap.set('t', '<C-k>', '<C-k>', { buffer = true })
end,
})
end,
} |
Beta Was this translation helpful? Give feedback.
Thanks for the reminder