本文整理匯總了TypeScript中neovim.Neovim.input方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Neovim.input方法的具體用法?TypeScript Neovim.input怎麽用?TypeScript Neovim.input使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neovim.Neovim
的用法示例。
在下文中一共展示了Neovim.input方法的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;
}