Switch to jrnl
3 files changed, 19 insertions(+), 113 deletions(-)

A => .config/jrnl/jrnl.yaml
M .profile
R bin/jrnl => 
A => .config/jrnl/jrnl.yaml +19 -0
@@ 0,0 1,19 @@ 
+colors:
+  body: none
+  date: GREEN
+  tags: MAGENTA
+  title: RED
+default_hour: 9
+default_minute: 0
+editor: kak
+encrypt: false
+highlight: true
+indent_character: '|'
+journals:
+  default: ~/documents/journals/default.txt
+  work: ~/documents/journals/work.txt
+linewrap: 79
+tagsymbols: '@'
+template: false
+timeformat: '%Y-%m-%d %H:%M'
+version: v2.4.5

          
M .profile +0 -1
@@ 19,7 19,6 @@ export SHITIVERSE_POD="soc.punktrash.clu
 export XDG_DESKTOP_DIR="$HOME/desktop"
 export XDG_DOWNLOAD_DIR="$HOME/downloads"
 export XDG_DOCUMENTS_DIR="$HOME/documents"
-export XDG_JOURNAL_DIR="$XDG_DOCUMENTS_DIR/journal"
 export XDG_MUSIC_DIR="$HOME/music"
 export XDG_PICTURES_DIR="$HOME/pictures"
 export XDG_SCREENSHOTS_DIR="$HOME/screenshots"

          
R bin/jrnl =>  +0 -112
@@ 1,112 0,0 @@ 
-#!/bin/sh
-
-terminal=""
-[ -t 1 ] && terminal="true"
-
-journal_folder_path="${XDG_JOURNAL_DIR:-$XDG_DOCUMENTS_DIR/journal}"
-
-PROMPT="\033[32m"
-RESET="\033[39m"
-
-PAGER=${PAGER:-more}
-EDITOR=${EDITOR:-vim}
-
-[ "less" = "$PAGER" ] && PAGER="less -RXF"
-
-edit() {
-	journal_name="$@.md"
-
-	file_path="$journal_folder_path/$journal_name"
-
-	if [ ! -d "$(dirname "$file_path")" ]; then
-		mkdir -p "$(dirname "$file_path")"
-		[ $? -ne 0 ] && exit 1
-	fi
-
-	exec "$EDITOR" "$file_path"
-}
-
-index() {
-	file_path="$journal_folder_path/index.md"
-
-	exec "$EDITOR" "$file_path"
-}
-
-escape() {
-	echo "$@" | sed -e 's/\([|\\/]\)/\\\1/g'
-}
-
-build_query() {
-	search_query=$(escape "$1")
-	shift
-	for arg in "$@"
-	do
-		search_query="$search_query|$(escape "$arg")"
-	done
-
-	echo "$search_query"
-}
-
-display_file_path() {
-	if [ "true" = "$terminal" ]; then
-		echo "$PROMPT$1$RESET"
-	else
-		echo "$1"
-	fi
-}
-
-smart_grep_file() {
-	if [ "true" = "$terminal" ]; then
-		grep --color=always -iE -B4 -A4 "$1" "$2"
-	else
-		grep -iE -B4 -A4 "$1" "$2"
-	fi
-}
-
-search() {
-	search_query="$1"
-	grep -lR "$search_query" "$journal_folder_path" | sed 's/\(.*\):\([[:digit:]]\+\)/\2:\1/' | sort -nr | sed 's/[[:digit:]]\+:\(.*\)/\1/'
-}
-
-if [ "-h" = "$1" ]; then
-	PROGRAM="$(basename $0)"
-	cat <<-_EOF
-	Usage:
-	    $PROGRAM index.md
-	    	go to the index page
-	    $PROGRAM the futur file name.md
-	    	to to a page named "the futur file name.md"
-	    $PROGRAM search "this word" "this other words" those three words
-	    	search and display pages containing "this word" OR "this other words" OR "those" OR "three" OR "words"
-	_EOF
-
-	exit
-fi
-
-if [ "-" = "$1" ]
-then
-	shift
-	search_query=$(build_query "$@")
-	search "$search_query" | while read -r file_path; do
-		display_file_path "$file_path"
-		smart_grep_file "$search_query" "$file_path"
-	done | $PAGER
-	exit $?
-fi
-
-if [ "--" = "$1" ]
-then
-	shift
-	search_query=$(build_query "$@")
-	results="$(search "$search_query")"
-	exec "$EDITOR" $results
-	exit $?
-fi
-
-if [ -n "$1" ]
-then
-	exec "$EDITOR" "$journal_folder_path"/"$@"
-fi
-
-index
-