How to use the neovim.Command function in neovim

To help you get started, we’ve selected a few neovim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mhartington / nvim-typescript / rplugin / node / nvim_typescript / src / index.ts View on Github external
// });
    // console.warn(JSON.stringify(watcher.getWatched()));


  }


  @Command('TSStop')
  async tsstop() {
    if (this.client.serverHandle != null) {
      this.client.stopServer();
      await printHighlight(this.nvim, `Server stopped`, 'ErrorMsg');
    }
  }

  @Command('TSReloadProject')
  async reloadProject() {
    await this.client.reloadProject();
    await this.getDiagnostics();
  }

  @Function('TSCmRefresh')
  async onCMRefresh(args: any[]) {
    const info = args[0];
    const ctx = args[1];

    const line = ctx['lnum'];
    const offset = ctx['col'];
    const prefix = ctx['base'];
    const startcol = ctx['startcol'];
    // recheck
    if (await this.nvim.call('cm#context_changed', ctx)) return;
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / src / index.ts View on Github external
//   // console.warn(JSON.stringify(this.completionChangeEvent));
  //
  //   // console.warn('COMPLETION START')
  //   this.doingCompletion = true
  // }
  // @Autocmd('CompleteDone', { pattern: '*', sync: true})
  // async onCompleteDone() {
  //   this.completedItem  = await this.nvim.getVvar('completed_item') as CompletionItem;
  //   // console.warn(JSON.stringify(this.completedItem));
  //
  //   // console.warn("COMPLECTION DONE")
  //   this.doingCompletion = false
  //   this.getDiagnostics()
  // }

  @Command('TSType')
  async getType() {
    await this.reloadFile();
    const args = await this.getCommonData();
    try {
      const typeInfo = await this.client.quickInfo(args);
      if (Object.getOwnPropertyNames(typeInfo).length > 0) {
        try {
          const window = await createHoverWindow(this.nvim, typeInfo)
          this.floatingWindow.push(window);
        }
        catch (e) {
          await printHighlight(this.nvim, await truncateMsg(this.nvim, typeInfo.displayString), 'MoreMsg', 'Function');
        }
      }
    } catch (err) {
      // console.warn('in catch', JSON.stringify(err));
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
__metadata("design:returntype", Promise)
], TSHost.prototype, "onBufEnter", null);
__decorate([
    neovim_1.Function('TSOnBufSave'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "onBufSave", null);
__decorate([
    neovim_1.Command('TSStart'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsstart", null);
__decorate([
    neovim_1.Command('TSStop'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsstop", null);
__decorate([
    neovim_1.Command('TSReloadProject'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "reloadProject", null);
__decorate([
    neovim_1.Function('TSCmRefresh'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "onCMRefresh", null);
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
__metadata("design:returntype", Promise)
], TSHost.prototype, "getSig", null);
__decorate([
    neovim_1.Command('TSDef'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getDef", null);
__decorate([
    neovim_1.Command('TSDefPreview'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getDefPreview", null);
__decorate([
    neovim_1.Command('TSDoc'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getDoc", null);
__decorate([
    neovim_1.Command('TSRename', { nargs: '*' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsRename", null);
__decorate([
    neovim_1.Command('TSSig'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tssig", null);
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
__metadata("design:returntype", Promise)
], TSHost.prototype, "tsDeoplete", null);
__decorate([
    neovim_1.Command('TSGetDocSymbols'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getdocsymbols", null);
__decorate([
    neovim_1.Function('TSGetDocSymbolsFunc', { sync: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getdocsymbolsFunc", null);
__decorate([
    neovim_1.Command('TSGetWorkspaceSymbols', { nargs: '*' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getWorkspaceSymbols", null);
__decorate([
    neovim_1.Function('TSGetWorkspaceSymbolsFunc', { sync: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getWorkspaceSymbolsFunc", null);
__decorate([
    neovim_1.Function('TSGetProjectInfoFunc', { sync: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getProjectInfoFunc", null);
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
return {
                file,
                line: cursorPos[0],
                offset: cursorPos[1] + 1
            };
        });
    }
};
__decorate([
    neovim_1.Command('TSType'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getType", null);
__decorate([
    neovim_1.Command('TSTypeDef'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tstypedef", null);
__decorate([
    neovim_1.Command('TSImport'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsImport", null);
__decorate([
    neovim_1.Command('TSSig'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getSig", null);
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
__metadata("design:returntype", Promise)
], TSHost.prototype, "getDoc", null);
__decorate([
    neovim_1.Command('TSRename', { nargs: '*' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsRename", null);
__decorate([
    neovim_1.Command('TSSig'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tssig", null);
__decorate([
    neovim_1.Command('TSRefs'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsRefs", null);
__decorate([
    neovim_1.Command('TSEditConfig'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsEditconfig", null);
__decorate([
    neovim_1.Function('TSOmnicFunc', { sync: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getCompletions", null);
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
__metadata("design:returntype", Promise)
], TSHost.prototype, "tsRename", null);
__decorate([
    neovim_1.Command('TSSig'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tssig", null);
__decorate([
    neovim_1.Command('TSRefs'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsRefs", null);
__decorate([
    neovim_1.Command('TSEditConfig'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsEditconfig", null);
__decorate([
    neovim_1.Function('TSOmnicFunc', { sync: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "getCompletions", null);
__decorate([
    neovim_1.Function('TSComplete', { sync: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsComplete", null);
github billyvg / tigris.nvim / rplugin / node / tigris.js / src / index.js View on Github external
disable() {
    this.nvim.setVar(ENABLE_VAR, false);
    this.clear();
  }

  @Function('tigris_toggle')
  async toggle() {
    const enabled = await this.nvim.getVar(ENABLE_VAR);
    if (enabled) {
      this.disable();
    } else {
      this.enable();
    }
  }

  @Command('TigrisClear')
  async clear() {
    const buffer = await this.nvim.buffer;
    this.nvim.outWrite('Clearing\n');
    buffer.clearHighlight({ srcId: -1 });
    DEBUG_MAP.clear();
  }

  @Function('tigris_parse_debounced')
  parseDebounced(args) {
    this.flyParse(args);
  }

  @Function('tigris_parse')
  parseFunc(args) {
    this.nvim.outWrite('vim func parse');
    try {
github mhartington / nvim-typescript / rplugin / node / nvim_typescript / lib / index.js View on Github external
__metadata("design:returntype", Promise)
], TSHost.prototype, "onBufSave", null);
__decorate([
    neovim_1.Command('TSStart'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsstart", null);
__decorate([
    neovim_1.Command('TSStop'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "tsstop", null);
__decorate([
    neovim_1.Command('TSReloadProject'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "reloadProject", null);
__decorate([
    neovim_1.Function('TSCmRefresh'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "onCMRefresh", null);
__decorate([
    neovim_1.Function('TSNcm2OnComplete'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], TSHost.prototype, "onNcm2Complete", null);

neovim

Nvim msgpack API client and remote plugin provider

MIT
Latest version published 2 months ago

Package Health Score

81 / 100
Full package analysis