How to use the neovim.attach 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 iamcco / markdown-preview.nvim / src / attach / index.ts View on Github external
export default function(options: Attach): IPlugin {
  const nvim: NeovimClient = attach(options)

  nvim.on('notification', async (method: string, args: any[]) => {
    const opts = args[0] || args
    const bufnr = opts.bufnr
    const buffers = await nvim.buffers
    const buffer = buffers.find(b => b.id === bufnr)
    if (method === 'refresh_content') {
      const winline = await nvim.call('winline')
      const currentWindow = await nvim.window
      const winheight = await nvim.call('winheight', currentWindow.id)
      const cursor = await nvim.call('getpos', '.')
      const renderOpts = await nvim.getVar('mkdp_preview_options')
      const pageTitle = await nvim.getVar('mkdp_page_title')
      const name = await buffer.name
      const content = await buffer.getLines()
      const currentBuffer = await nvim.buffer
github iamcco / markdown-preview.vim / app / lib / attach / index.js View on Github external
function default_1(options) {
    const nvim = neovim_1.attach(options);
    nvim.on('notification', (method, args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
        const opts = args[0];
        const bufnr = opts.bufnr;
        const buffers = yield nvim.buffers;
        const buffer = buffers.find(b => b.id === bufnr);
        if (method === 'refresh_content') {
            const cursor = yield nvim.call('getpos', '.');
            const content = yield buffer.getLines();
            app.refreshPage({
                bufnr,
                data: {
                    cursor,
                    content
                }
            });
        }
github VSCodeVim / Vim / src / neovim / neovim.ts View on Github external
private async startNeovim() {
    this.logger.debug('Spawning Neovim process...');
    let dir = dirname(vscode.window.activeTextEditor!.document.uri.fsPath);
    if (!(await util.promisify(exists)(dir))) {
      dir = __dirname;
    }
    this.process = spawn(configuration.neovimPath, ['-u', 'NONE', '-i', 'NONE', '-n', '--embed'], {
      cwd: dir,
    });

    this.process.on('error', err => {
      this.logger.error(`Error spawning neovim. ${err.message}.`);
      configuration.enableNeovim = false;
    });

    return attach({ proc: this.process });
  }
github iamcco / markdown-preview.nvim / app / lib / attach / index.js View on Github external
function default_1(options) {
    const nvim = neovim_1.attach(options);
    nvim.on('notification', (method, args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
        const opts = args[0] || args;
        const bufnr = opts.bufnr;
        const buffers = yield nvim.buffers;
        const buffer = buffers.find(b => b.id === bufnr);
        if (method === 'refresh_content') {
            const winline = yield nvim.call('winline');
            const currentWindow = yield nvim.window;
            const winheight = yield nvim.call('winheight', currentWindow.id);
            const cursor = yield nvim.call('getpos', '.');
            const renderOpts = yield nvim.getVar('mkdp_preview_options');
            const pageTitle = yield nvim.getVar('mkdp_page_title');
            const name = yield buffer.name;
            const content = yield buffer.getLines();
            const currentBuffer = yield nvim.buffer;
            app.refreshPage({
github iamcco / markdown-preview.vim / src / attach / index.ts View on Github external
export default function(options: Attach): IPlugin {
  const nvim: NeovimClient = attach(options)

  nvim.on('notification', async (method: string, args: any[]) => {
    const opts = args[0]
    const bufnr = opts.bufnr
    const buffers = await nvim.buffers
    const buffer = buffers.find(b => b.id === bufnr)
    if (method === 'refresh_content') {
      const cursor = await nvim.call('getpos', '.')
      const content = await buffer.getLines()
      app.refreshPage({
        bufnr,
        data: {
          cursor,
          content
        }
      })

neovim

Nvim msgpack API client and remote plugin provider

MIT
Latest version published 2 months ago

Package Health Score

81 / 100
Full package analysis