camspiers / snap

A fast finder system for neovim.
The Unlicense
490 stars 17 forks source link

how can we remap the Preview key bindings? #24

Closed sandangel closed 3 years ago

sandangel commented 3 years ago

I would like to remap the key bindings for scrolling up/down the preview window can it accept/reuse the FZF options in the environment variables?

camspiers commented 3 years ago

You can now override the default mappings with your own:

https://github.com/camspiers/snap/commit/3f068ca0361f47118fa00b455623a5bbd0b007d8

These are the default mappings:

{
    ["enter-split"] = {"<C-x>"},
    ["enter-tab"] = {"<C-t>"},
    ["enter-vsplit"] = {"<C-v>"},
    ["next-item"] = {"<C-n>"},
    ["next-page"] = {"<C-f>"},
    ["prev-item"] = {"<C-p>"},
    ["prev-page"] = {"<C-b>"},
    ["select-all"] = {"<C-a>"},
    ["view-page-down"] = {"<C-d>"},
    ["view-page-up"] = {"<C-u>"},
    enter = {"<CR>"},
    exit = {"<Esc>", "<C-c>"},
    next = {"<C-q>"},
    select = {"<Tab>"},
    unselect = {"<S-Tab>"}
}
snap.run {
  producer = snap.get'producer.ripgrep.vimgrep',
  select = snap.get'select.vimgrep'.select,
  multiselect = snap.get'select.vimgrep'.multiselect,
  views = {snap.get'preview.vimgrep'},
  mappings = {
    ["view-page-down"] = { put your mappings here },
    ["view-page-up"] = { put your mappings here },
  }
}