-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd.txt
More file actions
47 lines (38 loc) · 2.57 KB
/
Copy pathd.txt
File metadata and controls
47 lines (38 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
This was totally a matter of time, wasn't it?
\e[38;5;201;1md\e[0m shows (and lets you edit) notes on commands or flags or software and whatever you want basically.
USAGE:
d foo shows notes for \e[38;5;208mfoo\e[0m
d -e foo lets you edit notes for \e[38;5;208mfoo\e[0m
d -s bar searches all notes for \e[38;5;208mbar\e[0m (case-insensitive)
d -c/--color foo force color even if piping output elsewhere
It will match unique substrings of notes, so to see \e[38;5;208mphp_fork\e[0m notes you can use \e[38;5;208md fork\e[0m.
It has tab-completion (see FILES)
\e[1m## EDITING\e[0m
\e[38;5;208md -e foo\e[0m pulls up your preferred \e[32m$EDITOR\e[0m (nano by default) to edit the \e[32m$D_DOCS\e[38;5;226m/foo.txt\e[0m file.
You can simply start editing a new note (\e[38;5;208md -e newthing\e[0m) to create it.
ANSI escape sequences for colors are supported, check \e[38;5;208md colors\e[0m for a quickstart on those.
Lines that start with '#' are colored with a/the comment color (blue by default), see preferences below.
Notes of which the names (and thus filenames) start with \e[34;1mprivate_\e[0m are ignored by git.
When invoking the editor it does not try to match unique substrings of existing note names.
\e[1m## FILES, PREFERENCES\e[0m
The notes files are .txt files that live in \e[32m$D_DOCS\e[0m, or by default \e[38;5;226m~/.local/share/d_docs\e[0m, so either checkout the git
repo there or set \e[32m$D_DOCS\e[0m to its path.
It has a tab-completion function in d.bash_completion, you can symlink that to say
\e[38;5;226m~/.local/share/bash-completion/completions/d\e[0m , or wherever your bash completion functions live.
There's a tiny 'preferences' file \e[1md.conf\e[0m (basically a list of bash variables that will be sourced) you can make in
\e[32m$D_DOCS\e[0m (based on say \e[32m$D_DOCS\e[38;5;226m/d.conf.sample\e[0m)
- comment: lets you set a comment ansi color which I think actually works these days. NB: quote the value if it contains ';' characters
- commit_edits: if non-empty, \e[1md\e[0m will prompt you for a commit message after you edited a note
an empty message will skip the commit and just exit.
if as git message you enter the letter 'd', it'll show a diff before asking for a message again.
NB: the git thing does not work if you invoked editing using a symlink of the note name, like \e[38;5;208md -e ff\e[0m for firefox
notes.
## In short:
# show usage and available .txt files
$ d
# print notes for foo
$ d foo
# edit foo notes (foo.txt will be created if it does not exist)
$ d -e foo
# search contents of all notes
$ d -s foobar