本文整理汇总了TypeScript中promised-neovim-client.Nvim类的典型用法代码示例。如果您正苦于以下问题:TypeScript Nvim类的具体用法?TypeScript Nvim怎么用?TypeScript Nvim使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Nvim类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: subscribe
subscribe(client: Nvim) {
client.on('notification', this.call.bind(this));
for (const name in this.definitions) {
client.subscribe(name);
}
this.client = client;
}
开发者ID:munyari,项目名称:NyaoVim,代码行数:7,代码来源:nyaovim-app.ts
示例2: run
async run(vimState: VimState, command: string) {
await this.syncVSToVim(vimState);
command = ':' + command + '\n';
command = command.replace('<', '<lt>');
await this.nvim.input(command);
if ((await this.nvim.getMode()).blocking) {
await this.nvim.input('<esc>');
}
await this.syncVimToVs(vimState);
return;
}
开发者ID:knze,项目名称:Vim,代码行数:13,代码来源:neovim.ts
示例3: unsubscribe
unsubscribe() {
if (this.client) {
for (const name in this.definitions) {
this.client.unsubscribe(name);
}
}
}
开发者ID:munyari,项目名称:NyaoVim,代码行数:7,代码来源:nyaovim-app.ts
示例4: input
async input(vimState: VimState, keys: string) {
await this.syncVSToVim(vimState);
await this.nvim.input(keys);
await this.syncVimToVs(vimState);
return;
}
开发者ID:knze,项目名称:Vim,代码行数:7,代码来源:neovim.ts
示例5: syncVimToVs
// Data flows from Vim to VS
private async syncVimToVs(vimState: VimState) {
const buf = await this.nvim.getCurrentBuf();
const lines = await buf.getLines(0, -1, false);
// one Windows, lines that went to nvim and back have a '\r' at the end,
// which causes the issues exhibited in #1914
const fixedLines =
process.platform === 'win32' ? lines.map((line, index) => line.replace(/\r$/, '')) : lines;
await TextEditor.replace(
new vscode.Range(
0,
0,
TextEditor.getLineCount() - 1,
TextEditor.getLineMaxColumn(TextEditor.getLineCount() - 1)
),
fixedLines.join('\n')
);
Logger.debug(
`Neovim: ${lines.length} lines in nvim but ${TextEditor.getLineCount()} in editor.`
);
let [row, character] = ((await this.nvim.callFunction('getpos', ['.'])) as Array<number>).slice(
1,
3
);
vimState.editor.selection = new vscode.Selection(
new Position(row - 1, character),
new Position(row - 1, character)
);
if (configuration.expandtab) {
await vscode.commands.executeCommand('editor.action.indentationToSpaces');
}
// We're only syncing back the default register for now, due to the way we could
// be storing macros in registers.
const vimRegToVsReg = {
v: RegisterMode.CharacterWise,
V: RegisterMode.LineWise,
'\x16': RegisterMode.BlockWise,
};
vimState.currentRegisterMode =
vimRegToVsReg[(await this.nvim.callFunction('getregtype', ['"'])) as string];
Register.put((await this.nvim.callFunction('getreg', ['"'])) as string, vimState);
}
开发者ID:knze,项目名称:Vim,代码行数:47,代码来源:neovim.ts
示例6:
client.eval('mode()').then((value: string) => {
if (value.length === 0) {
return;
}
const command = value[0] === 'n' ? 'ggVG' : '<Esc>ggVG';
client.input(command);
});
开发者ID:haifengkao,项目名称:NyaoVim-Unofficial,代码行数:8,代码来源:nyaovim-app.ts
示例7: dispose
dispose() {
if (this.nvim) {
this.nvim.quit();
}
if (this.process) {
this.process.kill();
}
}
开发者ID:knze,项目名称:Vim,代码行数:9,代码来源:neovim.ts
注:本文中的promised-neovim-client.Nvim类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论