當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript promised-neovim-client.Nvim類代碼示例

本文整理匯總了TypeScript中promised-neovim-client.Nvim的典型用法代碼示例。如果您正苦於以下問題:TypeScript Nvim類的具體用法?TypeScript Nvim怎麽用?TypeScript Nvim使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Nvim類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: subscribe

 subscribe(client: Nvim) {
     client.on('notification', this.call.bind(this));
     for (const name in this.definitions) {
         client.subscribe(name);
     }
     this.client = client;
 }
開發者ID:munyari,項目名稱:NyaoVim,代碼行數:7,代碼來源:nyaovim-app.ts

示例2: run

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

    await this.nvim.input(command);
    if ((await this.nvim.getMode()).blocking) {
      await this.nvim.input('<esc>');
    }
    await this.syncVimToVs(vimState);

    return;
  }
開發者ID:knze,項目名稱:Vim,代碼行數:13,代碼來源:neovim.ts

示例3: unsubscribe

 unsubscribe() {
     if (this.client) {
         for (const name in this.definitions) {
             this.client.unsubscribe(name);
         }
     }
 }
開發者ID:munyari,項目名稱:NyaoVim,代碼行數:7,代碼來源:nyaovim-app.ts

示例4: input

  async input(vimState: VimState, keys: string) {
    await this.syncVSToVim(vimState);
    await this.nvim.input(keys);
    await this.syncVimToVs(vimState);

    return;
  }
開發者ID:knze,項目名稱:Vim,代碼行數:7,代碼來源:neovim.ts

示例5: syncVimToVs

  // Data flows from Vim to VS
  private async syncVimToVs(vimState: VimState) {
    const buf = await this.nvim.getCurrentBuf();
    const lines = await buf.getLines(0, -1, false);

    // one Windows, lines that went to nvim and back have a '\r' at the end,
    // which causes the issues exhibited in #1914
    const fixedLines =
      process.platform === 'win32' ? lines.map((line, index) => line.replace(/\r$/, '')) : lines;

    await TextEditor.replace(
      new vscode.Range(
        0,
        0,
        TextEditor.getLineCount() - 1,
        TextEditor.getLineMaxColumn(TextEditor.getLineCount() - 1)
      ),
      fixedLines.join('\n')
    );

    Logger.debug(
      `Neovim: ${lines.length} lines in nvim but ${TextEditor.getLineCount()} in editor.`
    );

    let [row, character] = ((await this.nvim.callFunction('getpos', ['.'])) as Array<number>).slice(
      1,
      3
    );
    vimState.editor.selection = new vscode.Selection(
      new Position(row - 1, character),
      new Position(row - 1, character)
    );

    if (configuration.expandtab) {
      await vscode.commands.executeCommand('editor.action.indentationToSpaces');
    }
    // We're only syncing back the default register for now, due to the way we could
    // be storing macros in registers.
    const vimRegToVsReg = {
      v: RegisterMode.CharacterWise,
      V: RegisterMode.LineWise,
      '\x16': RegisterMode.BlockWise,
    };
    vimState.currentRegisterMode =
      vimRegToVsReg[(await this.nvim.callFunction('getregtype', ['"'])) as string];
    Register.put((await this.nvim.callFunction('getreg', ['"'])) as string, vimState);
  }
開發者ID:knze,項目名稱:Vim,代碼行數:47,代碼來源:neovim.ts

示例6:

        client.eval('mode()').then((value: string) => {
            if (value.length === 0) {
                return;
            }

            const command = value[0] === 'n' ? 'ggVG' : '<Esc>ggVG';
            client.input(command);
        });
開發者ID:haifengkao,項目名稱:NyaoVim-Unofficial,代碼行數:8,代碼來源:nyaovim-app.ts

示例7: dispose

  dispose() {
    if (this.nvim) {
      this.nvim.quit();
    }

    if (this.process) {
      this.process.kill();
    }
  }
開發者ID:knze,項目名稱:Vim,代碼行數:9,代碼來源:neovim.ts


注:本文中的promised-neovim-client.Nvim類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。