本文整理汇总了TypeScript中neovim.Neovim.getVvar方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Neovim.getVvar方法的具体用法?TypeScript Neovim.getVvar怎么用?TypeScript Neovim.getVvar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neovim.Neovim
的用法示例。
在下文中一共展示了Neovim.getVvar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: run
async run(vimState: VimState, command: string) {
if (!this.nvim) {
this.nvim = await this.startNeovim();
await this.nvim.uiAttach(80, 20, {
ext_cmdline: false,
ext_popupmenu: false,
ext_tabline: false,
ext_wildmenu: false,
rgb: false,
});
const apiInfo = await this.nvim.apiInfo;
const version = apiInfo[1].version;
logger.debug(`Neovim Version: ${version.major}.${version.minor}.${version.patch}`);
}
await this.syncVSToVim(vimState);
command = (':' + command + '\n').replace('<', '<lt>');
// Clear the previous error and status messages.
// API does not allow setVvar so do it manually
await this.nvim.command('let v:errmsg="" | let v:statusmsg=""');
// Execute the command
logger.debug(`Neovim: Running ${command}.`);
await this.nvim.input(command);
const mode = await this.nvim.mode;
if (mode.blocking) {
await this.nvim.input('<esc>');
}
// Check if an error occurred
const errMsg = await this.nvim.getVvar('errmsg');
let statusBarText = '';
if (errMsg && errMsg.toString() !== '') {
statusBarText = errMsg.toString();
} else {
// Check to see if a status message was updated
const statusMsg = await this.nvim.getVvar('statusmsg');
if (statusMsg && statusMsg.toString() !== '') {
statusBarText = statusMsg.toString();
}
}
// Sync buffer back to vscode
await this.syncVimToVs(vimState);
return statusBarText;
}