This commit is contained in:
Tal Wrii 2025-01-02 22:20:41 +01:00
parent c4881d5129
commit 63be14b992
3 changed files with 14 additions and 2 deletions

View file

@ -6,6 +6,9 @@ This can be useful when developing plugins, or for "light-weight" scripting with
A range of convenience functions partly inspired by emacs is also provided.
# Demo
![demo](demo.gif)
# Installation
In your obsidian vault there should be a `.obsidian/plugins` directory. You can clone this repo into that
directory and then run the following to build the plugin:
@ -70,8 +73,8 @@ openSetting(name: string) - Open settings and display the tab (see left hand sid
* lineAtPoint(p?:string) - Retunrs the line at the cursor position. Default to current positiong.
### Reading and files
* writeToFile(name, string) - Overwrite the markdown file called name with the given string
* appendToFile(name, string) - Append to the markdown file called `name` with the given string
* writeToFile(name: string) - Overwrite the markdown file called name with the given string
* appendToFile(name: string) - Append to the markdown file called `name` with the given string
### Processes
* runProc(s: string) - Parse the bash-style command string s (e.g "ls /home") and call runProc on it

BIN
demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View file

@ -1,5 +1,14 @@
import { FuzzySuggestModal, App } from 'obsidian';
export function fuzzySelect(app: App, choices: Array<string>, prompt?: string) {
// doc: fuzzily select from a list of strings
return new Promise((reject, resolve) => {
let selector = new FuzzySelector(app, prompt || "select:", choices, [reject, resolve])
selector.run()
})
}
export class FuzzySelector extends FuzzySuggestModal<string> {
resolve: (_: any) => void
reject: (_: any) => void