Esempio n. 1
0
class Kind(Openable):
    def __init__(self, vim: Nvim) -> None:
        super().__init__(vim)

        self.name = "dwm"
        self.default_action = "focus"
        self.redraw_actions += ["delete"]
        self.persist_actions += ["delete"]
        self.__kind = Window(vim)

    def action_focus(self, context: UserContext) -> None:
        self.action_jump(context)
        self.vim.call("DWM_Focus")

    def action_open(self, context: UserContext) -> None:
        self.__kind.open(context["targets"])

    def action_jump(self, context: UserContext) -> None:
        self.__kind.jump(context["targets"][0])

    def action_only(self, context: UserContext) -> None:
        self.__kind.only(context["targets"][0])

    def action_delete(self, context: UserContext) -> None:
        self.__kind.delete(context["targets"])
        self.vim.command("wincmd H")
        self.vim.call("DWM_ResizeMasterPaneWidth")
Esempio n. 2
0
def test_open(vim: Nvim) -> None:
    vim.command("edit text1")
    vim.command("split text2")
    vim.command("split text3")
    w = Window(vim)
    w.open({"action__tabnr": 1, "action__winnr": 3})  # text1
    assert [Path(x.buffer.name).name for x in vim.windows] == [
        "text1",
        "text2",
        "text1",
    ]
Esempio n. 3
0
class Kind(Openable):
    def __init__(self, vim: Nvim) -> None:
        super().__init__(vim)

        self.name = "window"
        self.default_action = "jump"
        self.redraw_actions += ["delete"]
        self.persist_actions += ["delete"]
        self.__kind = Window(vim)

    def action_open(self, context: UserContext) -> None:
        self.__kind.open(context["targets"][0])

    def action_jump(self, context: UserContext) -> None:
        self.__kind.jump(context["targets"][0])

    def action_only(self, context: UserContext) -> None:
        self.__kind.only(context["targets"][0])

    def action_delete(self, context: UserContext) -> None:
        self.__kind.delete(context["targets"])