Compare commits

...

2 Commits

Author SHA1 Message Date
91bd01472b tag vim pages as TUI 2026-04-16 15:04:58 +02:00
5b13b2259c rework article command 2026-04-15 11:25:07 +02:00
11 changed files with 31 additions and 33 deletions

View File

@@ -76,29 +76,6 @@ default += .git/info/exclude
.PHONY: database .PHONY: database
database: $(default) ## Make a recfiles database database: $(default) ## Make a recfiles database
%.md:
printf '---\n'
printf 'title: "%s"\n' "$(title)"
printf 'tags: [ "%s" ]\n' "$(shell echo $(basename $(dir $@)) | sed 's/\/$$//' )" | tr '[:upper:]' '[:lower:]' | sed 's#\/#", "#g'
printf 'requires: [ ]\n'
printf '---\n'
ifdef title
col = blue
path = $(shell find $(categories) -type d | sort | uniq | $(FZF))
filename = $(shell echo "$(title)" | tr ' ' '_' | tr -cd '[:alnum:]_')
endif
title = $(shell read -r -p "Title: " line && echo "$${line}" | tr -d '"' | sed 's/\b\(.\)/\U\1/g')
.PHONY: .entry
.entry: $(path)/$(filename).md
.PHONY: article
article: ## Write an article
make -e title="$(title)" .entry
.dbs/map.fmt:| .dbs/ .dbs/map.fmt:| .dbs/
printf '%s\n' '[ {{requires[0]}} ] --> [ {{title}} ] {border-style: dashed;}' > $@ printf '%s\n' '[ {{requires[0]}} ] --> [ {{title}} ] {border-style: dashed;}' > $@
printf '%s\n' '[ {{requires[1]}} ] --> [ {{title}} ] {border-style: dashed;}' >> $@ printf '%s\n' '[ {{requires[1]}} ] --> [ {{title}} ] {border-style: dashed;}' >> $@
@@ -114,3 +91,24 @@ map: db.rec .dbs/map.fmt ## Show knowledge dependency map
.PHONY: clean .PHONY: clean
clean: ## Remove all generated files clean: ## Remove all generated files
$(RM) $(default) $(RM) $(default)
.PHONY: article
article: **/ **/**/ ## Write a new article
category=$(shell echo $^ | tr ' ' '\n' | $(FZF) ) \
&& read -p "Article title? " name \
&& filename="$$(echo "$$name" \
| cut -d: -f1 \
| tr -cd '[:alpha:]' | tr '[A-Z ]' '[a-z_]' )" \
&& $(MAKE) -e TITLE="$$name" "$$category"/"$$filename.md"
%.md:
[ -d "$(@D)" ] || mkdir $(@D)
printf '%s\n' '---' >> $@
printf 'title: %s\n' '$(TITLE)' >> $@
tags="$$(echo $(@D) | sed 's#/$$#"# ; s#/#", "#g ; s#^#"#' )" \
&& printf 'tags [ %s ]\n' "$$tags" >> $@
printf '%s\n\n' '---' >> $@
$(EDITOR) +5 $@
git add $@
git commit -m"article: $(TITLE)"

View File

@@ -1,6 +1,6 @@
--- ---
title: "Interactive String Substitution" title: "Interactive String Substitution"
tags: [ "data", "vim", "substitution" ] tags: [ "data", "vim", "substitution", "replace", "TUI" ]
--- ---
Want to find and replace, but also confirm each instance? Want to find and replace, but also confirm each instance?

View File

@@ -1,6 +1,6 @@
--- ---
title: "vim basics" title: "vim basics"
tags: [ "vim", "basic" ] tags: [ "vim", "basic", "TUI" ]
--- ---
## Instant nano replacement ## Instant nano replacement

View File

@@ -1,6 +1,6 @@
--- ---
title: "vim completion" title: "vim completion"
tags: [ "vim", "completion" ] tags: [ "vim", "completion", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---

View File

@@ -1,6 +1,6 @@
--- ---
title: "vim linewrap" title: "vim linewrap"
tags: [ "vim", "format", "linewrap" ] tags: [ "vim", "format", "linewrap", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---

View File

@@ -1,6 +1,6 @@
--- ---
title: "vim navigation" title: "vim navigation"
tags: [ "vim", "navigation" ] tags: [ "vim", "navigation", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---

View File

@@ -1,6 +1,6 @@
--- ---
title: "find and replace" title: "find and replace"
tags: [ "vim", "search", "replace", "find" ] tags: [ "vim", "search", "replace", "find", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---
Search for the next and or previous occurrence of the word under your cursor with `*` and `#`. Search for the next and or previous occurrence of the word under your cursor with `*` and `#`.

View File

@@ -1,6 +1,6 @@
--- ---
title: "How to Learn `vim`" title: "How to Learn `vim`"
tags: [ "vim", "learning" ] tags: [ "vim", "learning", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---

View File

@@ -1,6 +1,6 @@
--- ---
title: "vim in bash" title: "vim in bash"
tags: [ "vim", "bash", "inputrc" ] tags: [ "vim", "bash", "inputrc", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---

View File

@@ -1,6 +1,6 @@
--- ---
title: "vim windows" title: "vim windows"
tags: [ "vim" ] tags: [ "vim", "TUI" ]
requires: [ "vim basics" ] requires: [ "vim basics" ]
--- ---

View File

@@ -1,6 +1,6 @@
--- ---
title: "Vim Tricks" title: "Vim Tricks"
tags: [ "vim" ] tags: [ "vim", "TUI" ]
requiered: [ "ssh" ] requiered: [ "ssh" ]
--- ---