March 22, 2023

  • codex being deprecated, meaning im switching over my entire stenography stack to turbo (~exhausting!~)
blue lock day off 1.png
blue lock day off 2.png

*these blue lock guys make me wanna try harder at life, yah? -- to burn with raw competitive egotism for my chosen art form*

c(arouse)l.png
sunny beach!.png

bramadams.dev is a reader-supported published Zettelkasten. Both free and paid subscriptions are available. If you want to support my work, the best way is by taking out a paid subscription.

a command to move an image under a link to attachments folder (good for published bhovs!)

this.addCommand({
			id: "move-image-under-cursor",
			name: "Move image under cursor",
			editorCallback: async (editor, view: MarkdownView) => {
				if (!view) {
					new Notice("No active view");
					return;
				}

				const cursorPos = editor.getCursor();
				const lineText = editor.getLine(cursorPos.line);
				const match = /!\[\[(.+)\]\]/.exec(lineText);

				if (!match || !match[1]) {
					console.error(
						"No valid file link found at cursor position"
					);
					return;
				}

				const fileName = match[1];

				try {
					// Get abstract representation of source file based on its path
					const sourceFilePath = `Private/Screenshots/${fileName}`;
					const sourceFile: TFile | null =
						(await this.app.vault.getAbstractFileByPath(
							sourceFilePath
						)) as TFile;

					if (!sourceFile) {
						console.error(`Could not find file ${fileName}`);
						return;
					}

					// Move/rename the file by changing its parent folder
					const newParentFolderName = "Attachments";

					this.app.fileManager.renameFile(
						sourceFile,
						`${newParentFolderName}/${sourceFile.name}`
					);

					console.log(
						`Successfully moved/renamed ${fileName} to ${newParentFolderName}/${sourceFile.name}`
					);
				} catch (error) {
					console.error(error);
				}
			},
		});