diff --git a/src/view-manager.ts b/src/view-manager.ts index a634b7c..1da3f86 100644 --- a/src/view-manager.ts +++ b/src/view-manager.ts @@ -83,6 +83,19 @@ export class ViewManager { } } + async insertAtTitle(value: string, overwrite = false): Promise { + const file = this.app.workspace.getActiveFile(); + let newName = file.basename; + if (overwrite) { + newName = `${value}`; + } else { + newName = `${newName} ${value}`; + } + // @ts-ignore + const newPath = file.getNewPathAfterRename(newName) + await this.app.fileManager.renameFile(file, newPath); + } + async insertAtCursor(value: string, overwrite = false): Promise { const activeView = this.app.workspace.getActiveViewOfType(MarkdownView);