Cybrkyd's Git Repositories

gedit-config - commit: 0e5eccd

commit 0e5eccd4b7926e365c85e0144ff65720e3474adc5883d4adc84375393e79b0ac
author cybrkyd <git@cybrkyd.com> 2026-05-07 18:40:07 +0100
committer cybrkyd <git@cybrkyd.com> 2026-05-07 18:40:07 +0100

Commit Message

Ext tool - YAML

📊 Diffstat

readme.md 43
1 files changed, 41 insertions(+), 2 deletions(-)

Diff

diff --git a/readme.md b/readme.md
index fcb0402..f4c187f 100644
--- a/readme.md
+++ b/readme.md
@@ -26,7 +26,7 @@ Tab trigger: **linkx**
## External Tools
- ##### Fold text to 80 columns
+ #### Fold text to 80 columns
Shortcut key: **Alt+J**<br>
Save: Nothing<br>
@@ -42,11 +42,50 @@ fold -w 80 -s
<br>
- ##### Rename open Markdown doc with title from YAML
+ #### Rename open Markdown doc with title from YAML, and open it in new tab
Shortcut key: **Alt+F9**<br>
Save: Nothing<br>
Input: Nothing<br>
Output: Nothing<br>
+ ```bash
+ #!/usr/bin/env bash
+
+ exec >/dev/null 2>&1
+
+ file="$GEDIT_CURRENT_DOCUMENT_PATH"
+
+ if [[ -z "$file" || ! -f "$file" ]]; then
+ exit 0
+ fi
+
+ title=$(grep -m1 '^title:' "$file" | sed 's/^title:[[:space:]]*//')
+
+ if [[ -z "$title" ]]; then
+ exit 0
+ fi
+
+ slug=$(echo "$title" \
+ | tr '[:upper:]' '[:lower:]' \
+ | sed -E 's/[^a-z0-9]+/-/g; s/^-|-$//g')
+
+ dir=$(dirname "$file")
+ new="$dir/$slug.md"
+
+ # already correct name
+ if [[ "$file" == "$new" ]]; then
+ exit 0
+ fi
+
+ # write temp file then replace
+ tmp="${new}.tmp"
+
+ cat "$file" > "$tmp" && mv "$tmp" "$new" && rm "$file"
+
+ # Open the new file in new tab
+ gedit "$new" 2>/dev/null &
+
+ exit 0
+ ```