code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
formatTime(date, sep, locale) {
return self.ctx.bean.util.formatTime(date, sep, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | formatTime | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async getData({ site }) {
// data
const self = this;
const _csses = [];
const _jses = [];
const _envs = {};
let _pathIntermediate = await this.getPathIntermediate(site.language && site.language.current);
_pathIntermediate = path.join(_pathIntermediate, '/');
const _textLo... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | getData | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
require(fileName) {
const _path = self.resolvePath('', this._filename, fileName);
return require3(_path);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | require | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
url(fileName, language) {
if (fileName && (fileName.indexOf('http://') === 0 || fileName.indexOf('https://') === 0)) {
return self.ctx.bean.util.escapeURL(fileName);
}
let _path = self.resolvePath('', path.relative(_pathIntermediate, this._filename), fileName);
_path ... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | url | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
css(fileName) {
_csses.push(self.resolvePath(_pathIntermediate, this._filename, fileName));
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | css | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
js(fileName) {
_jses.push(self.resolvePath(_pathIntermediate, this._filename, fileName));
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | js | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
env(name, value) {
_envs[name] = value;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | env | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
text(...args) {
return self.ctx.text.locale(_textLocale, ...args);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | text | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
formatDateTime(date) {
return this.time.formatDateTime(date, `${site.env.format.date} ${site.env.format.time}`);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | formatDateTime | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
safeHtml(str) {
return self.ctx.helper.shtml(str);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | safeHtml | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
escapeHtml(str) {
return self.ctx.bean.util.escapeHtml(str);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | escapeHtml | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
escapeURL(str) {
return self.ctx.bean.util.escapeURL(str);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | escapeURL | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async buildLanguages({ progressId, progressNo = 0 }) {
try {
// time start
const timeStart = new Date();
// site
const site = await this.combineSiteBase();
const languages = site.language ? site.language.items.split(',') : [null];
// progress
const progress... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | buildLanguages | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async buildLanguage({ language, progressId, progressNo = 0 }) {
try {
// time start
const timeStart = new Date();
// progress
const progress0_Total = 2;
let progress0_progress = 0;
// progress: initialize
if (progressId) {
await this.ctx.bean.prog... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | buildLanguage | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async registerWatchers() {
// info
const watcherInfos = [];
// site
const site = await this.combineSiteBase();
const languages = site.language ? site.language.items.split(',') : [null];
// loop languages
for (const language of languages) {
// info
const watcherI... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | registerWatchers | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async registerWatcher({ language }) {
// info
const watcherInfo = await this._collectWatcher({ language });
// register
this.app.meta['a-cms:watcher'].register(watcherInfo);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | registerWatcher | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _collectWatcher({ language }) {
// site
const site = await this.getSite({ language });
// watcher
site._watchers = [];
// / files
// / plugins<theme<custom
// plugins
for (const relativeName in this.app.meta.modules) {
const module = this.app.meta.module... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _collectWatcher | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async createSitemapIndex({ site }) {
// content
const urlRawRoot = this.getUrlRawRoot(site);
let items = '';
const languages = site.language ? site.language.items.split(',') : [null];
for (const language of languages) {
items += ` <sitemap>
<loc>${urlRawRoot}${!site.language |... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | createSitemapIndex | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async createRobots({ site }) {
// content
const urlRawRoot = this.getUrlRawRoot(site);
const content = `User-agent: *
Allow: /
Sitemap: ${urlRawRoot}/sitemapindex.xml
`;
// write
const pathRawDist = await this.getPathRawDist(site);
await fse.outputFile(`${pathRawDist}/robots.txt`, c... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | createRobots | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async copyThemes(pathIntermediate, themeModuleName) {
await this._copyThemes(pathIntermediate, themeModuleName);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | copyThemes | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _copyThemes(pathIntermediate, themeModuleName) {
// module
const module = this.app.meta.modules[themeModuleName];
if (!module) this.ctx.throw.module(moduleInfo.relativeName, 1003, themeModuleName);
// extend
const moduleExtend = this.ctx.bean.util.getProperty(module, 'package.eggBorn... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _copyThemes | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
watcherThemes(site, themeModuleName) {
this._watcherThemes(site, themeModuleName);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | watcherThemes | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
_watcherThemes(site, themeModuleName) {
// module
const module = this.app.meta.modules[themeModuleName];
if (!module) this.ctx.throw.module(moduleInfo.relativeName, 1003, themeModuleName);
// extend
const moduleExtend = this.ctx.bean.util.getProperty(module, 'package.eggBornModule.cms.exte... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _watcherThemes | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _checkIfSiteBuilt({ site, force }) {
// check if build site first
const pathIntermediate = await this.getPathIntermediate(site.language && site.language.current);
const fileName = path.join(pathIntermediate, 'main/article.ejs');
const exists = await fse.pathExists(fileName);
if (exis... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _checkIfSiteBuilt | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async getArticleUrl({ key, options }) {
// options
const returnPhysicalPath = options && options.returnPhysicalPath;
const returnWaitingPath = options && options.returnWaitingPath;
// article
const article = await this.ctx.bean.cms.render.getArticle({ key, inner: true });
if (!articl... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | getArticleUrl | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
getAtomClassFullName(atomClass) {
return `${atomClass.module}:${atomClass.atomClassName}`;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | getAtomClassFullName | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async getFrontEnvs({ language }) {
const envs = {};
for (const module of this.ctx.app.meta.modulesArray) {
// may be more atoms
const atoms = this.ctx.bean.util.getProperty(module, 'main.meta.base.atoms');
if (!atoms) continue;
for (const key in atoms) {
if (atoms[k... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | getFrontEnvs | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
function autoCloseGT(cm) {
if (cm.getOption('disableInput')) return CodeMirror.Pass;
var ranges = cm.listSelections(),
replacements = [];
var opt = cm.getOption('autoCloseTags');
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var pos = ranges[... | Tag-closer extension for CodeMirror.
This extension adds an "autoCloseTags" option that can be set to
either true to get the default behavior, or an object to further
configure its behavior.
These are supported options:
`whenClosing` (default true)
Whether to autoclose when the '/' of a closing tag is typed.
`when... | autoCloseGT | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | MIT |
function autoCloseCurrent(cm, typingSlash) {
var ranges = cm.listSelections(),
replacements = [];
var head = typingSlash ? '/' : '</';
var opt = cm.getOption('autoCloseTags');
var dontIndentOnAutoClose = typeof opt == 'object' && opt.dontIndentOnSlash;
for (var i = 0; i < ranges.length; i++) {... | Tag-closer extension for CodeMirror.
This extension adds an "autoCloseTags" option that can be set to
either true to get the default behavior, or an object to further
configure its behavior.
These are supported options:
`whenClosing` (default true)
Whether to autoclose when the '/' of a closing tag is typed.
`when... | autoCloseCurrent | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | MIT |
function autoCloseSlash(cm) {
if (cm.getOption('disableInput')) return CodeMirror.Pass;
return autoCloseCurrent(cm, true);
} | Tag-closer extension for CodeMirror.
This extension adds an "autoCloseTags" option that can be set to
either true to get the default behavior, or an object to further
configure its behavior.
These are supported options:
`whenClosing` (default true)
Whether to autoclose when the '/' of a closing tag is typed.
`when... | autoCloseSlash | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | MIT |
function indexOf(collection, elt) {
if (collection.indexOf) return collection.indexOf(elt);
for (var i = 0, e = collection.length; i < e; ++i) if (collection[i] == elt) return i;
return -1;
} | Tag-closer extension for CodeMirror.
This extension adds an "autoCloseTags" option that can be set to
either true to get the default behavior, or an object to further
configure its behavior.
These are supported options:
`whenClosing` (default true)
Whether to autoclose when the '/' of a closing tag is typed.
`when... | indexOf | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | MIT |
function closingTagExists(cm, context, tagName, pos, newTag) {
if (!CodeMirror.scanForClosingTag) return false;
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!nextClose || nextClose.tag != tagName) return false;
// If the... | Tag-closer extension for CodeMirror.
This extension adds an "autoCloseTags" option that can be set to
either true to get the default behavior, or an object to further
configure its behavior.
These are supported options:
`whenClosing` (default true)
Whether to autoclose when the '/' of a closing tag is typed.
`when... | closingTagExists | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/addon/edit/closetag.js | MIT |
Vim = function () {
function enterVimMode(cm) {
cm.setOption('disableInput', true);
cm.setOption('showCursorWhenSelecting', false);
CodeMirror.signal(cm, 'vim-mode-change', { mode: 'normal' });
cm.on('cursorActivity', onCursorActivity);
maybeInitVimState(cm);
CodeMirror.on(cm.get... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | Vim | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function enterVimMode(cm) {
cm.setOption('disableInput', true);
cm.setOption('showCursorWhenSelecting', false);
CodeMirror.signal(cm, 'vim-mode-change', { mode: 'normal' });
cm.on('cursorActivity', onCursorActivity);
maybeInitVimState(cm);
CodeMirror.on(cm.getInputField(), 'paste', g... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | enterVimMode | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function leaveVimMode(cm) {
cm.setOption('disableInput', false);
cm.off('cursorActivity', onCursorActivity);
CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));
cm.state.vim = null;
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | leaveVimMode | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function detachVimMap(cm, next) {
if (this == CodeMirror.keyMap.vim) {
CodeMirror.rmClass(cm.getWrapperElement(), 'cm-fat-cursor');
if (cm.getOption('inputStyle') == 'contenteditable' && document.body.style.caretColor != null) {
disableFatCursorMark(cm);
cm.getInputField().styl... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | detachVimMap | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function attachVimMap(cm, prev) {
if (this == CodeMirror.keyMap.vim) {
CodeMirror.addClass(cm.getWrapperElement(), 'cm-fat-cursor');
if (cm.getOption('inputStyle') == 'contenteditable' && document.body.style.caretColor != null) {
enableFatCursorMark(cm);
cm.getInputField().styl... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | attachVimMap | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function updateFatCursorMark(cm) {
if (!cm.state.fatCursorMarks) return;
clearFatCursorMark(cm);
var ranges = cm.listSelections(),
result = [];
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i];
if (range.empty()) {
var lineLength = cm.getLine(rang... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | updateFatCursorMark | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function clearFatCursorMark(cm) {
var marks = cm.state.fatCursorMarks;
if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | clearFatCursorMark | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function enableFatCursorMark(cm) {
cm.state.fatCursorMarks = [];
updateFatCursorMark(cm);
cm.on('cursorActivity', updateFatCursorMark);
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | enableFatCursorMark | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function disableFatCursorMark(cm) {
clearFatCursorMark(cm);
cm.off('cursorActivity', updateFatCursorMark);
// explicitly set fatCursorMarks to null because event listener above
// can be invoke after removing it, if off is called from operation
cm.state.fatCursorMarks = null;
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | disableFatCursorMark | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cmKey(key, cm) {
if (!cm) {
return undefined;
}
if (this[key]) {
return this[key];
}
var vimKey = cmKeyToVimKey(key);
if (!vimKey) {
return false;
}
var cmd = CodeMirror.Vim.findKey(cm, vimKey);
if (typeof cmd == 'function') {
... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | cmKey | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cmKeyToVimKey(key) {
if (key.charAt(0) == "'") {
// Keypress character binding of format "'a'"
return key.charAt(1);
}
var pieces = key.split(/-(?!$)/);
var lastPiece = pieces[pieces.length - 1];
if (pieces.length == 1 && pieces[0].length == 1) {
// No-modi... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | cmKeyToVimKey | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getOnPasteFn(cm) {
var vim = cm.state.vim;
if (!vim.onPasteFn) {
vim.onPasteFn = function () {
if (!vim.insertMode) {
cm.setCursor(offsetCursor(cm.getCursor(), 0, 1));
actions.enterInsertMode(cm, {}, vim);
}
};
}
return vim.onP... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | getOnPasteFn | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function makeKeyRange(start, size) {
var keys = [];
for (var i = start; i < start + size; i++) {
keys.push(String.fromCharCode(i));
}
return keys;
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | makeKeyRange | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isLine(cm, line) {
return line >= cm.firstLine() && line <= cm.lastLine();
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isLine | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isLowerCase(k) {
return /^[a-z]$/.test(k);
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isLowerCase | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isMatchableSymbol(k) {
return '()[]{}'.indexOf(k) != -1;
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isMatchableSymbol | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isNumber(k) {
return numberRegex.test(k);
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isNumber | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isUpperCase(k) {
return upperCaseChars.test(k);
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isUpperCase | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isWhiteSpaceString(k) {
return /^\s*$/.test(k);
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isWhiteSpaceString | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function isEndOfSentenceSymbol(k) {
return '.?!'.indexOf(k) != -1;
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | isEndOfSentenceSymbol | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function inArray(val, arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == val) {
return true;
}
}
return false;
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | inArray | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function defineOption(name, defaultValue, type, aliases, callback) {
if (defaultValue === undefined && !callback) {
throw Error('defaultValue is required unless callback is provided');
}
if (!type) {
type = 'string';
}
options[name] = {
type: type,
defaultVa... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | defineOption | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function setOption(name, value, cm, cfg) {
var option = options[name];
cfg = cfg || {};
var scope = cfg.scope;
if (!option) {
return new Error('Unknown option: ' + name);
}
if (option.type == 'boolean') {
if (value && value !== true) {
return new Error('Inva... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | setOption | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function getOption(name, cm, cfg) {
var option = options[name];
cfg = cfg || {};
var scope = cfg.scope;
if (!option) {
return new Error('Unknown option: ' + name);
}
if (option.callback) {
var local = cm && option.callback(undefined, cm);
if (scope !== 'global... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | getOption | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
createCircularJumpList = function () {
var size = 100;
var pointer = -1;
var head = 0;
var tail = 0;
var buffer = new Array(size);
function add(cm, oldCur, newCur) {
var current = pointer % size;
var curMark = buffer[current];
function useNextSlot(cursor) {
... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | createCircularJumpList | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function add(cm, oldCur, newCur) {
var current = pointer % size;
var curMark = buffer[current];
function useNextSlot(cursor) {
var next = ++pointer % size;
var trashMark = buffer[next];
if (trashMark) {
trashMark.clear();
}
buffer[nex... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | add | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function useNextSlot(cursor) {
var next = ++pointer % size;
var trashMark = buffer[next];
if (trashMark) {
trashMark.clear();
}
buffer[next] = cm.setBookmark(cursor);
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | useNextSlot | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function move(cm, offset) {
pointer += offset;
if (pointer > head) {
pointer = head;
} else if (pointer < tail) {
pointer = tail;
}
var mark = buffer[(size + pointer) % size];
// skip marks that are temporarily removed from text buffer
if (mark... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | move | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function find(cm, offset) {
var oldPointer = pointer;
var mark = move(cm, offset);
pointer = oldPointer;
return mark && mark.find();
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | find | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
createInsertModeChanges = function (c) {
if (c) {
// Copy construction
return {
changes: c.changes,
expectCursorActivityForChange: c.expectCursorActivityForChange,
};
}
return {
// Change list
changes: [],
// Set to true on change, fa... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | createInsertModeChanges | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function MacroModeState() {
this.latestRegister = undefined;
this.isPlaying = false;
this.isRecording = false;
this.replaySearchQueries = [];
this.onRecordingDone = undefined;
this.lastInsertModeChanges = createInsertModeChanges();
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | MacroModeState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function maybeInitVimState(cm) {
if (!cm.state.vim) {
// Store instance state in the CodeMirror object.
cm.state.vim = {
inputState: new InputState(),
// Vim's input state that triggered the last edit, used to repeat
// motions and operators with '.'.
lastEd... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | maybeInitVimState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function resetVimGlobalState() {
vimGlobalState = {
// The current search query.
searchQuery: null,
// Whether we are searching backwards.
searchIsReversed: false,
// Replace part of the last substituted pattern
lastSubstituteReplacePart: undefined,
jumpList... | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | resetVimGlobalState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function toCtxArray(ctx) {
return ctx ? [ctx] : ['normal', 'insert', 'visual'];
} | Ex commands
Care must be taken when adding to the default Ex command map. For any
pair of commands that have a shared prefix, at least one of their
shortNames must not match the prefix of the other command. | toCtxArray | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function handleMacroRecording() {
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.isRecording) {
if (key == 'q') {
macroModeState.exitMacroRecordMode();
clearInputState(cm);
return true;
}
if (origin... | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | handleMacroRecording | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function handleEsc() {
if (key == '<Esc>') {
// Clear input state and get back to normal mode.
clearInputState(cm);
if (vim.visualMode) {
exitVisualMode(cm);
} else if (vim.insertMode) {
exitInsertMode(cm);
}
r... | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | handleEsc | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function doKeyToKey(keys) {
// TODO: prevent infinite recursion.
var match;
while (keys) {
// Pull off one command key, which is either a single character
// or a special sequence wrapped in '<' and '>', e.g. '<Space>'.
match = /<\w+-.+?>|<\w+>|./.exec(k... | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | doKeyToKey | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function handleKeyInsertMode() {
if (handleEsc()) {
return true;
}
var keys = (vim.inputState.keyBuffer = vim.inputState.keyBuffer + key);
var keysAreChars = key.length == 1;
var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'in... | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | handleKeyInsertMode | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function handleKeyNonInsertMode() {
if (handleMacroRecording() || handleEsc()) {
return true;
}
var keys = (vim.inputState.keyBuffer = vim.inputState.keyBuffer + key);
if (/^[1-9]\d*$/.test(keys)) {
return true;
}
var keysMatcher = /^... | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | handleKeyNonInsertMode | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function InputState() {
this.prefixRepeat = [];
this.motionRepeat = [];
this.operator = null;
this.operatorArgs = null;
this.motion = null;
this.motionArgs = null;
this.keyBuffer = []; // For matching multi-key commands.
this.registerName = null; // Defaults to the unnam... | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | InputState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function clearInputState(cm, reason) {
cm.state.vim.inputState = new InputState();
CodeMirror.signal(cm, 'vim-command-done', reason);
} | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | clearInputState | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function Register(text, linewise, blockwise) {
this.clear();
this.keyBuffer = [text || ''];
this.insertModeChanges = [];
this.searchQueries = [];
this.linewise = !!linewise;
this.blockwise = !!blockwise;
} | This is the outermost function called by CodeMirror, after keys have
been mapped to their Vim equivalents.
Finds a command based on the key (and cached keys if there is a
multi-key sequence). Returns `undefined` if no key is matched, a noop
function if a partial match is found (multi-key), and a function to
execute th... | Register | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function defineRegister(name, register) {
var registers = vimGlobalState.registerController.registers;
if (!name || name.length != 1) {
throw Error('Register name must be 1 character');
}
if (registers[name]) {
throw Error('Register already defined ' + name);
}
regist... | Defines an external register.
The name should be a single character that will be used to reference the register.
The register should support setText, pushText, clear, and toString(). See Register
for a reference implementation. | defineRegister | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function RegisterController(registers) {
this.registers = registers;
this.unnamedRegister = registers['"'] = new Register();
registers['.'] = new Register();
registers[':'] = new Register();
registers['/'] = new Register();
} | Defines an external register.
The name should be a single character that will be used to reference the register.
The register should support setText, pushText, clear, and toString(). See Register
for a reference implementation. | RegisterController | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function HistoryController() {
this.historyBuffer = [];
this.iterator = 0;
this.initialPrefix = null;
} | Defines an external register.
The name should be a single character that will be used to reference the register.
The register should support setText, pushText, clear, and toString(). See Register
for a reference implementation. | HistoryController | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function handleQuery(query, ignoreCase, smartCase) {
vimGlobalState.searchHistoryController.pushInput(query);
vimGlobalState.searchHistoryController.reset();
try {
updateSearchQuery(cm, query, ignoreCase, smartCase);
} catch (e) {
showConfirm(cm, 'Invalid ... | Defines an external register.
The name should be a single character that will be used to reference the register.
The register should support setText, pushText, clear, and toString(). See Register
for a reference implementation. | handleQuery | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function onPromptClose(query) {
cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
handleQuery(query, true /** ignoreCase */, true /** smartCase */);
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.isRecording) {
logSearchQuery(macroMod... | Defines an external register.
The name should be a single character that will be used to reference the register.
The register should support setText, pushText, clear, and toString(). See Register
for a reference implementation. | onPromptClose | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function defineOperator(name, fn) {
operators[name] = fn;
} | An operator acts on a text selection. It receives the list of selections
as input. The corresponding CodeMirror selection is guaranteed to
match the input selection. | defineOperator | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
whitespaceLength = function (str) {
var tabs = str.split('\t').length - 1;
var spaces = str.split(' ').length - 1;
return tabs * tabSize + spaces * 1;
} | An operator acts on a text selection. It receives the list of selections
as input. The corresponding CodeMirror selection is guaranteed to
match the input selection. | whitespaceLength | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function clipCursorToContent(cm, cur) {
var vim = cm.state.vim;
var includeLineBreak = vim.insertMode || vim.visualMode;
var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine());
var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak;
var ch = Math.min(Math.max(0, cur.ch),... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | clipCursorToContent | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function copyArgs(args) {
var ret = {};
for (var prop in args) {
if (args.hasOwnProperty(prop)) {
ret[prop] = args[prop];
}
}
return ret;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | copyArgs | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function offsetCursor(cur, offsetLine, offsetCh) {
if (typeof offsetLine === 'object') {
offsetCh = offsetLine.ch;
offsetLine = offsetLine.line;
}
return Pos(cur.line + offsetLine, cur.ch + offsetCh);
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | offsetCursor | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function commandMatches(keys, keyMap, context, inputState) {
// Partial matches are not applied. They inform the key handler
// that the current key sequence is a subsequence of a valid key
// sequence, so that the key buffer is not cleared.
var match,
partial = [],
full = [];
... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | commandMatches | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function commandMatch(pressed, mapped) {
if (mapped.slice(-11) == '<character>') {
// Last character matches anything.
var prefixLen = mapped.length - 11;
var pressedPrefix = pressed.slice(0, prefixLen);
var mappedPrefix = mapped.slice(0, prefixLen);
return pressedPrefix ==... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | commandMatch | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function lastChar(keys) {
var match = /^.*(<[^>]+>)$/.exec(keys);
var selectedCharacter = match ? match[1] : keys.slice(-1);
if (selectedCharacter.length > 1) {
switch (selectedCharacter) {
case '<CR>':
selectedCharacter = '\n';
break;
case '<Space>'... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | lastChar | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function repeatFn(cm, fn, repeat) {
return function () {
for (var i = 0; i < repeat; i++) {
fn(cm);
}
};
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | repeatFn | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function copyCursor(cur) {
return Pos(cur.line, cur.ch);
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | copyCursor | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cursorEqual(cur1, cur2) {
return cur1.ch == cur2.ch && cur1.line == cur2.line;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | cursorEqual | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cursorIsBefore(cur1, cur2) {
if (cur1.line < cur2.line) {
return true;
}
if (cur1.line == cur2.line && cur1.ch < cur2.ch) {
return true;
}
return false;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | cursorIsBefore | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cursorMin(cur1, cur2) {
if (arguments.length > 2) {
cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1));
}
return cursorIsBefore(cur1, cur2) ? cur1 : cur2;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | cursorMin | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cursorMax(cur1, cur2) {
if (arguments.length > 2) {
cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1));
}
return cursorIsBefore(cur1, cur2) ? cur2 : cur1;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | cursorMax | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function cursorIsBetween(cur1, cur2, cur3) {
// returns true if cur2 is between cur1 and cur3.
var cur1before2 = cursorIsBefore(cur1, cur2);
var cur2before3 = cursorIsBefore(cur2, cur3);
return cur1before2 && cur2before3;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | cursorIsBetween | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function lineLength(cm, lineNum) {
return cm.getLine(lineNum).length;
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | lineLength | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s+|\s+$/g, '');
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | trim | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function escapeRegex(s) {
return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1');
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | escapeRegex | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function extendLineToColumn(cm, lineNum, column) {
var endCh = lineLength(cm, lineNum);
var spaces = new Array(column - endCh + 1).join(' ');
cm.setCursor(Pos(lineNum, endCh));
cm.replaceRange(spaces, cm.getCursor());
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | extendLineToColumn | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function selectBlock(cm, selectionEnd) {
var selections = [],
ranges = cm.listSelections();
var head = copyCursor(cm.clipPos(selectionEnd));
var isClipped = !cursorEqual(selectionEnd, head);
var curHead = cm.getCursor('head');
var primIndex = getIndex(ranges, curHead);
var wa... | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | selectBlock | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
function selectForInsert(cm, head, height) {
var sel = [];
for (var i = 0; i < height; i++) {
var lineHead = offsetCursor(head, i, 0);
sel.push({ anchor: lineHead, head: lineHead });
}
cm.setSelections(sel, 0);
} | Clips cursor to ensure that line is within the buffer's range
If includeLineBreak is true, then allow cur.ch == lineLength. | selectForInsert | javascript | cabloy/cabloy | src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.