obsidianで選択した文字列をファイルとして切り出す拡張です。
これまでは、新規ノート作成、タイトル入力、中身のコピーと、複数の手順を踏む必要がありましたが、これで1発で新規ファイルに切り出せます。
1行目をファイル名として認識するモードと、
ファイル名をダイアログから入力するモードがあります。
実行方法
切り出したい文字列を選択状態にしてショートカットキーで実行です。
ショートカットキーは、
ファイル名をダイアログから入力するモード : Ctrl +Shift + C
1行目をファイル名として認識するモード : Ctrl +Shift + N
ただ、私の環境ではうまく動きませんでした。
コマンドは、コマンドパレットからも起動できます。
コマンドパレットは、Ctrl + p で表示できます。
そこで、”refactor” と入力すれば、コマンドが出てくるので、選択することで実行できます。

選択範囲を別ファイルに切り出すコマンド
Extract selection to new note – first line as filename
This command copies the selected text into the content of a new note using the first line as the file name for the new note.
このコマンドは、最初の行を新しいメモのファイル名として使用して、選択したテキストを新しいメモのコンテンツにコピーします。
切り出す範囲を選択します。
先頭の行がファイル名になります。

この状態で、Ctrl + Shift + N を押すと、別ファイルができます。
(私の環境だと動かなかったので、別の方法を説明します)
コマンドパレットを開いて(Ctrl+p)、”ref”と入力するとコマンドが表示されるので選択します。

新しいファイルとして切り出されます

Extract selection to new note – content only
This command only copies the selected text into the content of a new note. The user is prompted to enter a file name for the new note.
このコマンドは、選択したテキストのみを新しいメモのコンテンツにコピーします。ユーザーは、新しいメモのファイル名を入力するように求められます。
ファイル名を聞かれます。

現在の行から後ろを別ファイルに切り出すコマンド
上のとは別に、現在のカーソル位置から後ろを、別ファイルとして切り出すモードもあります。
Split note here – current line as note file name
This command splits the current note into a new note from the current line using the current line as the file name for the new note.
このコマンドは、現在の行を新しいメモのファイル名として使用して、現在のメモを現在の行から新しいメモに分割します。
Split note here – content only
This command splits the current note into a new note from the current line. The user is prompted to enter a file name for the new note.
このコマンドは、現在のノートを現在の行からの新しいノートに分割します。ユーザーは、新しいメモのファイル名を入力するように求められます。
コメント