summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Berwaldt <zberwaldt@tutamail.com>2025-02-13 20:59:08 -0500
committerZach Berwaldt <zberwaldt@tutamail.com>2025-02-13 20:59:08 -0500
commit83e091e7c5eefec6bd6c9001cbc35a6fb75895f7 (patch)
treea43d9f95ab85090f2d7d4968da5a40a6109c5469
parent0fea88ad9689d0816f5ba8e261e8b08ae4e2bf11 (diff)
update organize notes command to close and reopen the active note.
-rw-r--r--note_tools/commands.py9
1 files changed, 8 insertions, 1 deletions
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
2import sublime_plugin 2import sublime_plugin
3import datetime 3import datetime
4import os 4import os
5import sys
5from pathlib import Path 6from pathlib import Path
6from typing import List, Optional, Tuple 7from typing import List, Optional, Tuple
7 8
@@ -15,6 +16,11 @@ class OrganizeNotesCommand(sublime_plugin.WindowCommand):
15 16
16 notes_path = None 17 notes_path = None
17 18
19 active_sheet = self.window.active_sheet()
20
21 # Close the active note right away
22 active_sheet.close()
23
18 if project_data and "folders" in project_data: 24 if project_data and "folders" in project_data:
19 for folder in project_data['folders']: 25 for folder in project_data['folders']:
20 folder_path = folder['path'] 26 folder_path = folder['path']
@@ -30,7 +36,8 @@ class OrganizeNotesCommand(sublime_plugin.WindowCommand):
30 dirs = os.path.join(notes_path, year, month) 36 dirs = os.path.join(notes_path, year, month)
31 os.makedirs(dirs, exist_ok=True) 37 os.makedirs(dirs, exist_ok=True)
32 new_note = os.path.join(notes_path, year, month, note.name) 38 new_note = os.path.join(notes_path, year, month, note.name)
33 os.rename(note.resolve(), new_note) 39 os.rename(note.resolve(), new_note)
40 new_view = self.window.open_file(new_note)
34 else: 41 else:
35 sublime.message_dialog("No 'Notes' directory found in the project. Please add a 'Notes' folder.") 42 sublime.message_dialog("No 'Notes' directory found in the project. Please add a 'Notes' folder.")
36 43