5 Commits

Author SHA1 Message Date
  Brennen Bearnes 0e6961232b add notes-math 2 months ago
  Brennen Bearnes 9661af6e16 notes-init-metadata: add some indices to metadata.db 2 months ago
  Brennen Bearnes d4e9fe758e notes-tag-index: add all link targets to index 2 months ago
  Brennen Bearnes 2476cd4f45 notes-links: add target format, document formats a bit 2 months ago
  Brennen Bearnes 5d28acf7ed vimwiki: add ssh link handling 2 months ago
5 changed files with 57 additions and 8 deletions
Split View
  1. +8
    -0
      home/.vim/vimrc
  2. +20
    -0
      home/bin/notes-init-metadata
  3. +16
    -0
      home/bin/notes-links
  4. +3
    -0
      home/bin/notes-math
  5. +10
    -8
      home/bin/notes-tag-index

+ 8
- 0
home/.vim/vimrc View File

@ -439,6 +439,14 @@ let mapleader = ","
catch
echo "Failed opening workspace location in vim."
endtry
elseif a:link =~# '^ssh://'
try
" chop off the leading file: - see :h expr-[:] for syntax:
execute ':terminal ssh ' . a:link[6:]
return 1
catch
echo "Failed opening SSH connection in vim."
endtry
" elseif a:link =~# '^https\?:'
" try
" execute ':terminal lynx ' . a:link


+ 20
- 0
home/bin/notes-init-metadata View File

@ -29,5 +29,25 @@ c.execute(
'''
)
c.execute(
'''CREATE INDEX "links_page_idx" ON "links" (
"page"
);
'''
)
c.execute(
'''CREATE INDEX "links_target_idx" ON "links" (
"target"
);
'''
)
c.execute(
'''CREATE INDEX "pages_page_idx" ON "pages" (
"page"
);
'''
conn.commit()
conn.close()

+ 16
- 0
home/bin/notes-links View File

@ -22,6 +22,16 @@ Currently this is vimwiki-dependent.
# Links in foo (experimental, probably broken):
notes links --source foo
# Format (defaults to location):
notes links --format target
=head1 OUTPUT FORMATS
B<--format> options include C<vimwiki>, C<tsv>, C<location>, C<target>,
C<full>, and C<name>.
Formats may be glitchy.
=head1 AUTHOR
Brennen Bearnes
@ -90,6 +100,12 @@ my %FORMATS = (
return $result . "\n";
},
# List of bare link _target_ names
target => sub {
my ($data) = @_;
return $data->{target} . "\n";
},
# Fulltext of vimwiki pages:
full => sub {
my ($data) = @_;


+ 3
- 0
home/bin/notes-math View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "$@" | bc -ql

+ 10
- 8
home/bin/notes-tag-index View File

@ -2,17 +2,19 @@
cd "$HOME/notes" || exit 1
# TODO:
# - Arguably the following should select _things that are linked to_ as well.
# That is, I want to be able to automate links to stuff that I haven't
# actually defined a page for yet.
# - Also, arguably, the grep should be done in notes-pages instead. It was
# TODO:
#
# - Arguably, the grep should be done in the notes subcommand instead. It was
# just kind of a pain when I was looking at this.
#
# - With links included, this is noticeably kind of slow.
#
# - This reveals some weirdness in what's getting dumped into the link database.
# Probably worth digging into that eventually.
sort \
<(notes-pages --format name| grep -v '^(log|diary)/') \
<(notes-pages --format name | grep -Ev '^(log|diary)/') \
<(notes-links --format target | grep -Ev '^(|log|diary|https?|ssh|workspace|file)[/:]') \
pinboard-tag-index \
p1k3-index \
| uniq

Loading…
Cancel
Save