当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Nvim.getVvar方法代码示例

本文整理汇总了TypeScript中promised-neovim-client.Nvim.getVvar方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Nvim.getVvar方法的具体用法?TypeScript Nvim.getVvar怎么用?TypeScript Nvim.getVvar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在promised-neovim-client.Nvim的用法示例。


在下文中一共展示了Nvim.getVvar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: run

  async run(vimState: VimState, command: string) {
    if (!this.nvim) {
      this.nvim = await this.startNeovim();
    }

    await this.syncVSToVim(vimState);
    command = (':' + command + '\n').replace('<', '<lt>');

    // Clear the previous error and status messages.
    // API does not allow setVvar so do it manually
    await this.nvim.command('let v:errmsg="" | let v:statusmsg=""');

    // Execute the command
    await this.nvim.input(command);
    if ((await this.nvim.getMode()).blocking) {
      await this.nvim.input('<esc>');
    }

    // Check if an error occurred
    const errMsg = await this.nvim.getVvar('errmsg');
    let statusBarText = '';
    if (errMsg && errMsg.toString() !== '') {
      statusBarText = errMsg.toString();
    } else {
      // Check to see if a status message was updated
      const statusMsg = await this.nvim.getVvar('statusmsg');
      if (statusMsg && statusMsg.toString() !== '') {
        statusBarText = statusMsg.toString();
      }
    }

    // Sync buffer back to vscode
    await this.syncVimToVs(vimState);

    return statusBarText;
  }
开发者ID:arussellk,项目名称:Vim,代码行数:36,代码来源:neovim.ts


注:本文中的promised-neovim-client.Nvim.getVvar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。