How to use the neovim.Plugin 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.

github mhartington / nvim-typescript / rplugin / node / nvim_typescript / src / index.ts View on Github external
import { Autocmd, Command, Function, Neovim, Plugin, Window } from 'neovim';
import { fileSync } from 'tmp';
import protocol from 'typescript/lib/protocol';
import { TSServer } from './client';
import { applyCodeFixes, promptForSelection } from './codeActions';
import { DiagnosticHost } from './diagnostic';
import { createFloatingWindow, createHoverWindow } from './floatingWindow';
import { CompletionChangeEvent, CompletionItem } from './types';
import { convertDetailEntry, convertEntry, createLocList, createQuickFixList, getKind, isRenameSuccess, printHighlight, reduceByPrefix, triggerChar, trim, truncateMsg, processErrors } from './utils';
// import { watch } from 'chokidar'
// import {createMonitor} from 'watch'

// var nsfw = require('nsfw');
// var watchr = require('watchr')

@Plugin({ dev: false })
export default class TSHost {
  private client = TSServer;
  private diagnosticHost = DiagnosticHost;
  private maxCompletion: number;
  private expandSnippet: boolean;
  enableDiagnostics: boolean;
  quietStartup: boolean;

  private completionChangeEvent: CompletionChangeEvent;
  private completedItem: CompletionItem;
  floatingWindow: Window[] = [];
  doingCompletion = false;
  suggestionsEnabled: any;
  constructor(public nvim: Neovim) { }

  // @Autocmd('TextChangedP', { pattern: '*', sync: true })
github billyvg / tigris.nvim / rplugin / node / tigris.js / src / index.js View on Github external
const DEBUG_MAP = new Map();
const HL_MAP = new Map();


const debouncedParser = _.debounce.call(_, async (nvim, filename, parseFunc) => {
  const enableFly = await nvim.getVar(FLY_VAR);

  console.log(`[${filename.split('/').pop()}] Fly parse enabled: ${enableFly}`);

  if (enableFly) {
    parseFunc({ filename, clear: true });

  }
}, DELAY_DEFAULT);

@Plugin({
  name: 'tigris',
})
class TigrisPlugin {
  flyParse(filename) {
    debouncedParser(this.nvim, filename, this.parse.bind(this));
  }

  @Function('tigris_enable')
  async enable() {
    await this.nvim.setVar(ENABLE_VAR, true);
    this.parse();
  }

  @Function('tigris_disable')
  disable() {
    this.nvim.setVar(ENABLE_VAR, false);
github neoclide / npm.nvim / src / index.js View on Github external
import { Plugin, Function, Autocmd, Command } from 'neovim'
import pify from 'pify'
import fs from 'fs'
import path from 'path'

@Plugin({ dev: false })
export default class NpmPlugin {

  async findDirectory() {
    let p = await this.nvim.eval('getcwd()')
    while(true) {
      if (!p || p == '/') break
      try {
        let stat = await pify(fs.stat)(path.join(p, 'package.json'))
        if (stat.isFile()) {
          return p
        }
      } catch (e) {
      }
      p = path.dirname(p)
    }
  }

neovim

Neovim client API and neovim remote plugin provider

MIT
Latest version published 10 months ago

Package Health Score

64 / 100
Full package analysis