예제 #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")
예제 #2
0
def test_only(vim: Nvim) -> None:
    vim.command("edit text1")
    vim.command("split text2")
    vim.command("split text3")
    w = Window(vim)
    w.only({"action__tabnr": 1, "action__winnr": 1})  # text3
    assert vim.funcs.winnr("$") == 1
    assert Path(vim.current.buffer.name).name == "text3"
예제 #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"])