coffee-nvim


Ⅰ. 插件描述

coffeescript host & lib for scripting neovim

Ⅱ. 基本信息

创建日期:  2015-09-18
使用用户:  1
Github星:  1
插件作者:  Rom Grk

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'romgrk/coffee-nvim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'romgrk/coffee-nvim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'romgrk/coffee-nvim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/romgrk/coffee-nvim

Ⅳ. 文档说明

Coffee Host for Nvim

Version: 0.1

This plugin aims to provide a rpc-plugin host for coffeescripting (node.js),
as well as a familiar set of instructions inspired by vimscript.

let g:COFFEELIB_ENABLE = 1

" if
let g:debug = 1
" then
"    <F1>: start coffeelib host
"    <F2>: stop coffeelib host

What's working

Commands:
CoffeelibRun: Run current buffer
CoffeelibPlugin: Register current buffer as a plugin

Lib


Nvim = { 
  # neovim-client API...
  # all functions can be called sync/async depending if you pass a callback 
}

# Global objects

current.buffer == Nvim.getCurrentBuffer()
current.window == ...
current.tab    == ...

# buffers: listed buffers only
buffers == Nvim.getBuffers().filter((b) -> b.listed)
windows == Nvim.getWindows()
tabs    == Nvim.getTabpages()

# Buffer properties:
buffer.number: Read-only
buffer.name:   bufname
buffer.lenght: buffer.lineCount()
buffer.listed: buffer.getOption('buflisted')
buffer.type:   buffer.getOption('buftype')
buffer.valid:  buffer.isValid()

# Option & Var access
buffer[':VARNAME'] # => buffer.getVar('VARNAME')
buffer['&OPTNAME'] # => buffer.getOption('OPTNAME')
# same goes for window & tabpage

# Cursor
cursor                          # => [line, row]
cursor[0] == cursor.line        # true
cursor[1] == cursor.row         # true
cursor = 2                      # => position [2, 0]
cursor = [10, 3]                # => position [10, 3]
cursor.row += 5                 # => position [10, 8]

cursor = current.buffer.length  # => last line

cursor += 10                # => Error
# equivalent to: cursor = [10, 8] + 10

# Functions
call.getcmdline() # => :call getcmdline()
# => returns the function result

# Other
echo()
echohl()

input('keys<esc>')
execute('wincmd w')

get('varname')
set('option', 'value') OR set('option?')

Debug

In a separate terminal
Spawn a log-server: cd $COFFEELIB_DIR & node dev/server

log.info 'hey' 
# => outputs 'hey' in terminal where log-server is running

添加新评论