Iron-E / nvim-libmodal

Create new "modes" for Neovim!
Other
118 stars 7 forks source link

Compatibility with `sindrets/winshift.nvim` #16

Closed chardskarth closed 2 years ago

chardskarth commented 2 years ago

Before everything, AWESOME PLUGIN! many thanks to you good sir. 🙏🏼


Issue: I added this function that enters a layer:

local function t(str)
    return vim.api.nvim_replace_termcodes(str, true, true, true)
end

_G.windowlayer = function()
    local ok, libmodal = pcall(require, "libmodal")
    if not ok then
        return
    end

    libmodal.mode.enter("WindowMode", {
        h = t("normal <C-w><"),
        j = t("normal <C-w>-"),
        k = t("normal <C-w>+"),
        l = t("normal <C-w>>"),
        ["="] = t("normal <C-w>="),

        H = t("normal <Cmd>WinShift left<CR>"),
        J = t("normal <Cmd>WinShift down<CR>"),
        K = t("normal <Cmd>WinShift up<CR>"),
        L = t("normal <Cmd>WinShift right<CR>"),
        x = t("normal <Cmd>WinShift swap<CR>"),

        ["<"] = t("normal :BufferLineMovePrev<CR>"),
        [">"] = t("normal :BufferLineMoveNext<CR>"),
    })
end

It seems when I press the x key, it doesn't wait for a response unlike when I run :WinShift swap in command line.

I'm a newb but I can try helping if this is really an issue, just point me where to fix this. Thanks!

Iron-E commented 2 years ago

I think it has to do with<Cmd>. If you do the following, it works (for me at least):

x = function() require('winshift').cmd_winshift 'swap' end,
chardskarth commented 2 years ago

Many thanks to you and your fam! 🎉