How to use @chemzqm/neovim - 3 common examples

To help you get started, we’ve selected a few @chemzqm/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 neoclide / coc.nvim / src / util / highlight.ts View on Github external
}, 50)
          }
        })
      }
    }
    try {
      proc.once('exit', () => {
        if (exited) return
        logger.info('highlight nvim exited.')
        resolve([])
      })
      timer = setTimeout(() => {
        exit()
        resolve([])
      }, timeout)
      nvim = attach({ proc }, null, false)
      const callback = (method, args) => {
        if (method == 'redraw') {
          for (let arr of args) {
            let [name, ...list] = arr
            if (name == 'hl_attr_define') {
              for (let item of list) {
                let id = item[0]
                let { hi_name } = item[item.length - 1][0]
                hlMap.set(id, hi_name)
              }
            }
            if (name == 'grid_line') {
              // logger.debug('list:', JSON.stringify(list, null, 2))
              for (let def of list) {
                let [, line, col, cells] = def
                if (line >= lines.length) continue
github neoclide / coc.nvim / src / attach.ts View on Github external
export default (opts: Attach, requestApi = true): Plugin => {
  const nvim: NeovimClient = attach(opts, log4js.getLogger('node-client'), requestApi)
  // Overwriding the URI.file function in case of cygwin.
  nvim.eval('has("win32unix")?get(g:,"coc_cygqwin_path_prefixes", v:null):v:null').then(prefixes => {
    if (!prefixes) return
    const old_uri = URI.file
    URI.file = (path): URI => {
      path = path.replace(/\\/g, '/')
      Object.keys(prefixes).forEach(k => path = path.replace(new RegExp('^' + k, 'gi'), prefixes[k]))
      return old_uri(path)
    }
  }).logError()
  const plugin = new Plugin(nvim)
  let clientReady = false
  let initialized = false
  nvim.on('notification', async (method, args) => {
    switch (method) {
      case 'VimEnter': {
github neoclide / vim-node-rpc / bin / server.js View on Github external
const attach = require('@chemzqm/neovim').attach
const logger = require('../lib/logger')('server')

let nvim

if (process.env.NVIM_LISTEN_ADDRESS) {
  nvim = attach({
    socket: process.env.NVIM_LISTEN_ADDRESS
  })
} else {
  nvim = attach({
    socket: {
      port: process.env.NVIM_LISTEN_PORT,
      host: '127.0.0.1'
    }
  })
}

nvim.on('request', (_method, args, resp) => {
  let buffer = Buffer.alloc(args[0], 'a')
  resp.send({ r: buffer.toString('ascii') })
})

@chemzqm/neovim

NodeJS client API for vim8 and neovim

MIT
Latest version published 1 year ago

Package Health Score

49 / 100
Full package analysis

Popular @chemzqm/neovim functions