ibhagwan / fzf-lua

Improved fzf.vim written in lua
MIT License
2.31k stars 150 forks source link

[question] Can i map <C-o> to <CR>? #1097

Closed kaiphat closed 7 months ago

kaiphat commented 7 months ago

Can i map <C-o> to open selected file like <CR>?

ibhagwan commented 7 months ago

Yes, you can add the mapping globally keymap:

from the README

require('fzf-lua').setup({
actions = {
-- These override the default tables completely
-- no need to set to `false` to disable an action
-- delete or modify is sufficient
files = {
-- providers that inherit these actions:
--   files, git_files, git_status, grep, lsp
--   oldfiles, quickfix, loclist, tags, btags
--   args
-- default action opens a single selection
-- or sends multiple selection to quickfix
-- replace the default action with the below
-- to open all files whether single or multiple
-- ["default"]     = actions.file_edit,
["ctrl-o"]      = actions.file_edit_or_qf,
["default"]     = actions.file_edit_or_qf,
["ctrl-s"]      = actions.file_split,
["ctrl-v"]      = actions.file_vsplit,
["ctrl-t"]      = actions.file_tabedit,
["alt-q"]       = actions.file_sel_to_qf,
["alt-l"]       = actions.file_sel_to_ll,
},
buffers = {
-- providers that inherit these actions:
--   buffers, tabs, lines, blines
["ctrl-o"]      = actions.buf_edit,
["default"]     = actions.buf_edit,
["ctrl-s"]      = actions.buf_split,
["ctrl-v"]      = actions.buf_vsplit,
["ctrl-t"]      = actions.buf_tabedit,
}
},
})
kaiphat commented 7 months ago

Shame on me

ibhagwan commented 7 months ago

Shame on me

No worries, you can also add a mapping to a picker individually via the corresponding actions table.