@@ -31,7 +31,7 @@ def run_edit(cfg: EditConfig) -> int:
31
31
zo_paths = expand_file_group_paths (
32
32
cfg .zo_paths , file_group_map = cfg .file_group_map
33
33
)
34
- zo_paths = _zdir_paths (cfg .zettel_dir , zo_paths )
34
+ zo_paths = _add_paths_to_zdir (cfg .zettel_dir , zo_paths )
35
35
for zo_path in zo_paths :
36
36
for pattern , tmpl_path in cfg .template_pattern_map .items ():
37
37
if match := pattern .match (zo_path .stem ):
@@ -53,8 +53,17 @@ def run_edit(cfg: EditConfig) -> int:
53
53
return 0
54
54
55
55
56
- def _zdir_paths (zdir : PathLike , paths : Iterable [PathLike ]) -> list [Path ]:
57
- return [p if zdir in p .parents else zdir / p for p in paths ]
56
+ def _add_paths_to_zdir (
57
+ zdir : PathLike , paths : Iterable [PathLike ]
58
+ ) -> list [Path ]:
59
+ zdir_path = Path (zdir )
60
+ new_paths = []
61
+ for p in paths :
62
+ path = Path (p )
63
+ new_paths .append (
64
+ path if zdir_path in path .parents else zdir_path / path
65
+ )
66
+ return new_paths
58
67
59
68
60
69
def _start_vim_loop (zo_paths : Iterable [Path ], cfg : EditConfig ) -> None :
@@ -83,7 +92,7 @@ def _start_vim_loop(zo_paths: Iterable[Path], cfg: EditConfig) -> None:
83
92
84
93
cfg .keep_alive_file .unlink ()
85
94
vimala .vim (
86
- * _zdir_paths (cfg .zettel_dir , paths ),
95
+ * _add_paths_to_zdir (cfg .zettel_dir , paths ),
87
96
commands = _process_vim_commands (cfg .zettel_dir , cfg .vim_commands ),
88
97
)
89
98
0 commit comments