Beispiel #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")
Beispiel #2
0
def test_jump(vim: Nvim) -> None:
    vim.command("edit text1")
    vim.command("split text2")
    vim.command("split text3")
    vim.command("tabnew")
    vim.command("edit text4")
    vim.command("split text5")
    vim.command("split text6")
    w = Window(vim)
    w.jump({"action__tabnr": 1, "action__winnr": 3})  # text1
    assert Path(vim.current.buffer.name).name == "text1"
Beispiel #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"])