Skip to content

Commit 786711b

Browse files
committed
copy: improve the copy submenu (relative path)
root first second <- selected item relative path: first/second use to be /first/second path from root: /first/second [new] fix #55
1 parent 1c28c3d commit 786711b

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

FMcommands/copy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ def run(self, which, paths=None):
1919
text.append(os.path.basename(path))
2020
elif which == "absolute path":
2121
text.append(path)
22-
elif which == "relative path":
22+
elif which in ("path from root", "relative path"):
2323
for folder in folders:
2424
if folder not in path:
2525
continue
26-
text.append(path.replace(folder, ""))
26+
27+
text.append(os.path.join("/", path.replace(folder, "")))
28+
if which == "relative path":
29+
# remove the initial /
30+
text[-1] = text[-1][1:]
2731
break
2832

2933
copy("\n".join(bit.replace(os.path.sep, "/") for bit in text))

Side Bar.sublime-menu

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@
134134
"paths": []
135135
}
136136
},
137+
{
138+
"caption": "Path from root",
139+
"command": "fm_copy",
140+
"args": {
141+
"which": "path from root",
142+
"paths": []
143+
}
144+
},
137145
{
138146
"caption": "Relative Path",
139147
"command": "fm_copy",

0 commit comments

Comments
 (0)