From 83e091e7c5eefec6bd6c9001cbc35a6fb75895f7 Mon Sep 17 00:00:00 2001 From: Zach Berwaldt Date: Thu, 13 Feb 2025 20:59:08 -0500 Subject: update organize notes command to close and reopen the active note. --- note_tools/commands.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/note_tools/commands.py b/note_tools/commands.py index 3c26915..755bd5d 100644 --- a/note_tools/commands.py +++ b/note_tools/commands.py @@ -2,6 +2,7 @@ import sublime import sublime_plugin import datetime import os +import sys from pathlib import Path from typing import List, Optional, Tuple @@ -15,6 +16,11 @@ class OrganizeNotesCommand(sublime_plugin.WindowCommand): notes_path = None + active_sheet = self.window.active_sheet() + + # Close the active note right away + active_sheet.close() + if project_data and "folders" in project_data: for folder in project_data['folders']: folder_path = folder['path'] @@ -30,7 +36,8 @@ class OrganizeNotesCommand(sublime_plugin.WindowCommand): dirs = os.path.join(notes_path, year, month) os.makedirs(dirs, exist_ok=True) new_note = os.path.join(notes_path, year, month, note.name) - os.rename(note.resolve(), new_note) + os.rename(note.resolve(), new_note) + new_view = self.window.open_file(new_note) else: sublime.message_dialog("No 'Notes' directory found in the project. Please add a 'Notes' folder.") -- cgit v1.1