示例#1
0
def check_tmux_bin(*args):
    try:
        return _plugin.check_tmux_bin()
    except TmuxFacadeException as e:
        echoerr(_plugin.vim, str(e), _plugin.plugin_name)
    except (AttributeError, NameError):
        echoerr(
            vim,
            "tmux not found in $PATH. Make sure tmux is installed.",
            "tmuxdir",
        )
示例#2
0
 def check_tmux_bin(self, args: List) -> bool:
     try:
         return self._rplugin.tmux_dir._check_tmux_bin()
     except TmuxFacadeException as e:
         echoerr(self._rplugin.nvim, str(e), self._rplugin.plugin_name)
     except AttributeError:
         echoerr(
             nvim,
             "tmux not found in $PATH. Make sure tmux is installed.",
             "tmuxdir",
         )
     return False
示例#3
0
 def tmuxdir_clear_ignored(self, args: List) -> bool:
     if len(args) != 1:
         echoerr(
             self._rplugin.nvim,
             "TmuxdirClearIgnored expects a single argument",
             self._rplugin.plugin_name,
         )
         return False
     try:
         root_dir = expanduser_raise_if_not_dir(args[0])
         return self._rplugin.tmux_dir.clear_ignored_dir(root_dir)
     except OSError as e:
         echoerr(self._rplugin.nvim, str(e), self._rplugin.plugin_name)
         return False
示例#4
0
 def tmuxdir_add(self, args: List) -> List[str]:
     if len(args) != 1:
         echoerr(
             self._rplugin.nvim,
             "TmuxdirAdd expects a single argument",
             self._rplugin.plugin_name,
         )
         return []
     try:
         root_dir = expanduser_raise_if_not_dir(args[0])
         return [self._rplugin.tmux_dir._add(root_dir)]
     except OSError as e:
         echoerr(self._rplugin.nvim, str(e), self._rplugin.plugin_name)
         return []
示例#5
0
    def __init__(self, vim: vim.Nvim) -> None:
        """Constructor of TmuxDirPlugin."""
        self.vim = vim
        self.plugin_name = "tmuxdir"

        # vim settings
        self.root_markers: List[str] = self.vim.eval("TmuxdirRootMarkers()")
        self.base_dirs: List[str] = self.vim.eval("TmuxdirBaseDirs()")

        self.dir_mngr = DirMngr(
            base_dirs=self.base_dirs, root_markers=self.root_markers
        )

        self.tmux_dir = TmuxDirFacade(self.base_dirs, self.root_markers)
        try:
            self.tmux_dir._check_tmux_bin()
        except TmuxFacadeException as e:
            echoerr(self.vim, str(e), self.plugin_name)
示例#6
0
    def __init__(self, nvim: nvim.Nvim) -> None:

        try:
            self._rplugin = TmuxDirPlugin(nvim)
        except TmuxFacadeException as e:
            echoerr(nvim, str(e), "tmuxdir")
示例#7
0
def tmuxdir_clear_ignored(*args):
    try:
        return _plugin.tmuxdir_clear_ignored(args)
    except OSError as e:
        echoerr(_plugin.vim, str(e), _plugin.plugin_name)
示例#8
0
import vim

from tmuxdir.rplugin import TmuxDirPlugin, TmuxFacadeException
from tmuxdir.util import echoerr

try:
    _plugin = TmuxDirPlugin(vim)
except TmuxFacadeException as e:
    echoerr(vim, str(e), "tmuxdir")


def check_tmux_bin(*args):
    try:
        return _plugin.check_tmux_bin()
    except TmuxFacadeException as e:
        echoerr(_plugin.vim, str(e), _plugin.plugin_name)
    except (AttributeError, NameError):
        echoerr(
            vim,
            "tmux not found in $PATH. Make sure tmux is installed.",
            "tmuxdir",
        )


def tmuxdir_add(*args):
    try:
        return _plugin.tmuxdir_add(args)
    except OSError as e:
        echoerr(_plugin.vim, str(e), _plugin.plugin_name)