matbme / JABS.nvim

Just Another Buffer Switcher for Neovim
GNU General Public License v3.0
281 stars 10 forks source link

Opening the preview window overwrites keymap for 'q' #38

Open jeff-dh opened 1 year ago

jeff-dh commented 1 year ago

When you open the preview window in JABS the keymap for q get's overwritten for that buffer. That's hard coded:

-- function M.previewBuf()
    [...]
    -- Close preview with "q"
    api.nvim_buf_set_keymap(buf, "n", "q",
        [[:lua require'jabs'.closePreviewBuf()<CR>]],
        { nowait = true, noremap = true, silent = true })
    [...]

The mapping still exists after the preview window is closed and if you open the same buffer in a different window -- for editing -- the mapping is still active (and calls closePreviewBuf).

If q would not be mapped to any other command this might not be toooooo bad, but q is mapped to start a recording by default and that's not possible anymore.......

jeff-dh commented 1 year ago

https://vi.stackexchange.com/questions/7734/how-to-save-and-restore-a-mapping