MacBook-Pro-de-Oscar.local 2026-6-13:18:24:58

This commit is contained in:
oskar
2026-06-13 18:24:59 +02:00
parent e23a1dead0
commit 095fc50a14
96 changed files with 20091 additions and 41578 deletions
+37 -18
View File
@@ -2751,7 +2751,7 @@ class VimOBehaviourOverride {
this.operationPerformer = operationPerformer;
this.inited = false;
this.handleSettingsChange = () => {
if (!this.settings.overrideVimOBehaviour) {
if (this.inited || !this.settings.overrideVimOBehaviour) {
return;
}
if (!window.CodeMirrorAdapter || !window.CodeMirrorAdapter.Vim) {
@@ -2765,28 +2765,22 @@ class VimOBehaviourOverride {
const operationPerformer = this.operationPerformer;
const settings = this.settings;
vim.defineAction("insertLineAfterBullet", (cm, operatorArgs) => {
// Move the cursor to the end of the line
vim.handleEx(cm, "normal! A");
if (!settings.overrideVimOBehaviour) {
if (operatorArgs.after) {
vim.handleEx(cm, "normal! o");
}
else {
vim.handleEx(cm, "normal! O");
}
const view = plugin.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
const obsidianEditor = view === null || view === void 0 ? void 0 : view.editor;
if (!obsidianEditor) {
vim.enterInsertMode(cm);
return;
}
const view = plugin.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
const editor = new MyEditor(view.editor);
this.moveCursorToLineEnd(obsidianEditor);
if (!settings.overrideVimOBehaviour) {
this.openPlainLine(obsidianEditor, operatorArgs.after);
vim.enterInsertMode(cm);
return;
}
const editor = new MyEditor(obsidianEditor);
const root = parser.parse(editor);
if (!root) {
if (operatorArgs.after) {
vim.handleEx(cm, "normal! o");
}
else {
vim.handleEx(cm, "normal! O");
}
this.openPlainLine(obsidianEditor, operatorArgs.after);
vim.enterInsertMode(cm);
return;
}
@@ -2823,6 +2817,31 @@ class VimOBehaviourOverride {
this.handleSettingsChange();
});
}
moveCursorToLineEnd(editor) {
const cursor = editor.getCursor();
editor.setCursor({
line: cursor.line,
ch: editor.getLine(cursor.line).length,
});
}
getLineIndent(line) {
return line.match(/^[ \t]*/)[0];
}
openPlainLine(editor, after) {
const cursor = editor.getCursor();
const line = editor.getLine(cursor.line);
const indent = this.getLineIndent(line);
if (after) {
const insertAt = { line: cursor.line, ch: line.length };
editor.replaceRange(`\n${indent}`, insertAt, insertAt);
editor.setCursor({ line: cursor.line + 1, ch: indent.length });
}
else {
const insertAt = { line: cursor.line, ch: 0 };
editor.replaceRange(`${indent}\n`, insertAt, insertAt);
editor.setCursor({ line: cursor.line, ch: indent.length });
}
}
unload() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.inited) {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-outliner",
"name": "Outliner",
"version": "4.10.0",
"version": "4.10.1",
"minAppVersion": "1.11.7",
"description": "Work with your lists like in Workflowy or RoamResearch.",
"author": "Viacheslav Slinko",