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


TypeScript Nvim.input方法代碼示例

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


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

示例1: 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

示例2: 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

示例3:

        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

示例4: char2nr

 client.eval('mode()').then((value: string) => {
     if (value.length === 0) {
         return;
     }
     const ch = value[0];
     const code = value.charCodeAt(0);
     if (ch === 'v'       // visual mode
         || ch === 'V'    // visual line mode
         || code === 22   // visual block mode. 22 is returned by ':echo char2nr("\<C-v>")'
         ) {
         client.input('"+y');
     }
 });
開發者ID:haifengkao,項目名稱:NyaoVim-Unofficial,代碼行數:13,代碼來源:nyaovim-app.ts

示例5: 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

示例6: if

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

            let command: string;

            const ch = value[0];
            const code = value.charCodeAt(0);
            if (ch === 'v') {
                // visual mode
                // deleting the highlighted area
                // to prevent vim from copying the area to the pasteboard
                command = '"_d"+P';
            } else if (ch === 'V') {
                // visual line mode
                command = '"_d"+p';
            } else if (code === 22 || ch === 'n') {
                // visual block mode
                // the "_d trick doesn't work here
                // because the visual selection will disappear after "_d command
                // or normal mode
                command = '"+p';
            } else if (ch === 'i') {
                // insert mode
                // gp will move cursor to the last of pasted content
                command = '<C-o>"+gp';
            } else if (ch === 'c') {
                    // command line mode
                command = '<C-r>+';
            }

            if (command) {
                client.input(command);
            }
        });
開發者ID:haifengkao,項目名稱:NyaoVim-Unofficial,代碼行數:36,代碼來源:nyaovim-app.ts


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