Compare commits
11 Commits
fdffaf42c5
...
f3693f3533
Author | SHA1 | Date |
---|---|---|
Sam Greytalon | f3693f3533 | |
Sam Greytalon | 43acaf7535 | |
Sam Greytalon | 9b1866f169 | |
Sam Greytalon | b92898d8bb | |
Sam Greytalon | 671ca40bb3 | |
Sam Greytalon | 41e34e8911 | |
Sam Greytalon | 40c9c0fd80 | |
Sam Greytalon | e6e0ee3b05 | |
Sam Greytalon | bddbda89f6 | |
Sam Greytalon | 4cc3855e7a | |
Sam Greytalon | 8bc3d3cd99 |
|
@ -17,6 +17,8 @@ else
|
||||||
set -x EDITOR "vim -u ~/.config/vim/vimrc"
|
set -x EDITOR "vim -u ~/.config/vim/vimrc"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias datenow="date '+%Y-%m-%d'"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function please
|
function please
|
||||||
|
@ -57,7 +59,9 @@ if status --is-interactive
|
||||||
alias g="git"
|
alias g="git"
|
||||||
|
|
||||||
mkdir -p ~/.local
|
mkdir -p ~/.local
|
||||||
if [ (expr (date '+%s') - (cat "$HOME/.local/last_shell" 2>/dev/null || echo 0)) -gt "28800" ]
|
set time_diff (expr (date '+%s') - (cat "$HOME/.local/last_shell" 2>/dev/null || echo 0))
|
||||||
|
if [ "$time_diff" -gt "28800" ]
|
||||||
|
[ -d "$HOME/tmp" ] && rm -rf "$HOME/tmp/*"
|
||||||
git sit && date '+%s' > "$HOME/.local/last_shell"
|
git sit && date '+%s' > "$HOME/.local/last_shell"
|
||||||
echo ""
|
echo ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = main
|
defaultBranch = main
|
||||||
[user]
|
[user]
|
||||||
name = Sam Greytalon
|
name = Sam Talonborn
|
||||||
email = sam@oaktal.com
|
email = sam@oaktal.com
|
||||||
[pull]
|
[pull]
|
||||||
rebase = false
|
rebase = false
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,5 @@
|
||||||
nnoremap gf :let @a='../'.expand('%')<CR>vi>y<Esc>:tabnew <C-R>"<CR>:let @"=@a
|
nnoremap gl vi)y<Esc>:tabnew <C-R>"<CR>
|
||||||
vnoremap gf y<Esc>:let @a='../'.expand('%')<CR>:tabnew <C-R>"<CR>:let @"=@a
|
vnoremap gl y<Esc>:tabnew <C-R>"<CR>
|
||||||
nnoremap mf viwc[]<Esc>hpla(<>)<Left><Left><C-R>=expand('%')<CR><Esc>F/l"_dt>hpa.md<Esc>
|
nnoremap ml viwc[]<Esc>hpla()<Esc>hpa.md<Esc>
|
||||||
vnoremap mf c[]<Esc>hpla(<>)<Left><Left><C-R>=expand('%')<CR><Esc>F/l"_dt>hpa.md<Esc>
|
vnoremap ml c[]<Esc>hpla()<Esc>hpa.md<Esc>
|
||||||
nnoremap ml :r!grep -Rl '' .<Left><Left><Left>
|
|
||||||
vnoremap ml y<Esc>:execute 'r!grep -Rl '.shellescape(@", 1).' .'<CR>
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ autocmd FileType markdown set columns=80
|
||||||
autocmd FileType markdown set linebreak
|
autocmd FileType markdown set linebreak
|
||||||
autocmd FileType markdown setlocal comments+=">"
|
autocmd FileType markdown setlocal comments+=">"
|
||||||
|
|
||||||
|
autocmd FileType gemtext setlocal wrap
|
||||||
|
autocmd FileType gemtext setlocal linebreak
|
||||||
|
autocmd FileType gemtext setlocal columns=80
|
||||||
|
|
||||||
autocmd FileType text setlocal textwidth=120
|
autocmd FileType text setlocal textwidth=120
|
||||||
autocmd FileType text setlocal formatoptions=tcroqawn
|
autocmd FileType text setlocal formatoptions=tcroqawn
|
||||||
autocmd FileType text,markdown,gemtext set spell
|
autocmd FileType text,markdown,gemtext set spell
|
||||||
|
|
|
@ -5,4 +5,4 @@ Host *
|
||||||
IgnoreUnknown UseKeychain
|
IgnoreUnknown UseKeychain
|
||||||
UseKeychain yes
|
UseKeychain yes
|
||||||
AddKeysToAgent yes
|
AddKeysToAgent yes
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_ed25519
|
||||||
|
|
|
@ -7,7 +7,7 @@ dest="$3"
|
||||||
root="$(pwd)"
|
root="$(pwd)"
|
||||||
|
|
||||||
rm -r "$dest"
|
rm -r "$dest"
|
||||||
cp -r "$src" "$dest"
|
rsync -a --exclude '.*' "$src" "$dest"
|
||||||
|
|
||||||
files="$(find "$dest" -type f)"
|
files="$(find "$dest" -type f)"
|
||||||
|
|
||||||
|
|
68
bin/gmi2html
68
bin/gmi2html
|
@ -51,14 +51,14 @@ print OUT <<"END_HTML";
|
||||||
END_HTML
|
END_HTML
|
||||||
|
|
||||||
my $line = convert_gmi_line($old_title);
|
my $line = convert_gmi_line($old_title);
|
||||||
print OUT " $line\n";
|
print OUT " $line";
|
||||||
|
|
||||||
foreach $line (<IN>) {
|
foreach $line (<IN>) {
|
||||||
chomp $line;
|
chomp $line;
|
||||||
my $out = convert_gmi_line($line);
|
my $out = convert_gmi_line($line);
|
||||||
|
|
||||||
if (defined $out) {
|
if (defined $out) {
|
||||||
print OUT " $out\n";
|
print OUT " $out";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,30 +68,50 @@ print OUT <<'END_HTML';
|
||||||
END_HTML
|
END_HTML
|
||||||
|
|
||||||
sub convert_gmi_line {
|
sub convert_gmi_line {
|
||||||
state $mode = 'normal';
|
state $pre = 0;
|
||||||
state $list = 0;
|
state $list = 0;
|
||||||
|
|
||||||
my ($line) = @_;
|
my ($line) = @_;
|
||||||
|
|
||||||
if ($mode eq 'pre') {
|
if ($pre == 1) {
|
||||||
if ($line eq '```') {
|
if ($line eq '```') {
|
||||||
$mode = 'normal';
|
$pre = 0;
|
||||||
return undef;
|
return "</pre>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $line;
|
return " $line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($line =~ /^\* /) {
|
if ($line eq '```') {
|
||||||
if ($list == 0) {
|
$pre = 1;
|
||||||
return '<ul>';
|
|
||||||
|
if ($list == 1) {
|
||||||
|
$list = 0;
|
||||||
|
return "</ul>\n <pre>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<pre>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($list == 0) {
|
||||||
|
if ($line =~ /^\* /) {
|
||||||
$list = 1;
|
$list = 1;
|
||||||
|
my $listitem = convert_gmi_line($line);
|
||||||
|
|
||||||
|
return "<ul>\n $listitem";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($list == 1) {
|
if (not $line =~ /^\* /) {
|
||||||
return '</ul>';
|
|
||||||
$list = 0;
|
$list = 0;
|
||||||
|
my $nextline = convert_gmi_line($line);
|
||||||
|
|
||||||
|
if (defined $nextline) {
|
||||||
|
return "</ul>\n $nextline";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "</ul>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,43 +122,39 @@ sub convert_gmi_line {
|
||||||
my $text = $2;
|
my $text = $2;
|
||||||
$link =~ s/\.gmi/\.html/;
|
$link =~ s/\.gmi/\.html/;
|
||||||
|
|
||||||
return "<p><a href=\"$link\">$text</a></p>";
|
return "<p><a href=\"$link\">$text</a></p>\n";
|
||||||
}
|
}
|
||||||
when(/^#[^#]/) {
|
when(/^#[^#]/) {
|
||||||
$line =~ s/^#\s*//;
|
$line =~ s/^#\s*//;
|
||||||
|
|
||||||
return "<h1>$line</h1>";
|
return "<h1>$line</h1>\n";
|
||||||
}
|
}
|
||||||
when(/^##[^#]/) {
|
when(/^##[^#]/) {
|
||||||
$line =~ s/^##\s*//;
|
$line =~ s/^##\s*//;
|
||||||
|
|
||||||
return "<h2>$line</h2>";
|
return "<h2>$line</h2>\n";
|
||||||
}
|
}
|
||||||
when(/^###/) {
|
when(/^###/) {
|
||||||
$line =~ s/^###\s*//;
|
$line =~ s/^###\s*//;
|
||||||
|
|
||||||
return "<h3>$line</h3>";
|
return "<h3>$line</h3>\n";
|
||||||
}
|
}
|
||||||
when(/^\*\s*/) {
|
when(/^\*\s*/) {
|
||||||
$line =~ s/^\*\s*//;
|
$line =~ s/^\*\s*//;
|
||||||
|
|
||||||
return "<li>$line</li>";
|
return " <li>$line</li>\n";
|
||||||
}
|
}
|
||||||
when(/^>/) {
|
when(/^>/) {
|
||||||
$line =~ s/^>//;
|
$line =~ s/^>\s*//;
|
||||||
|
|
||||||
return "<blockquote>$line</blockquote>";
|
return "<blockquote>$line</blockquote>\n";
|
||||||
}
|
|
||||||
when('```') {
|
|
||||||
$mode = 'pre';
|
|
||||||
return undef;
|
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
if ($line eq '') {
|
if ($line eq '') {
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<p>$line</p>";
|
return "<p>$line</p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,20 @@ while [ $# -ne 0 ]; do
|
||||||
echo "$time $file"
|
echo "$time $file"
|
||||||
done | sort -k 1,1 | awk '{ $1="" }1')"
|
done | sort -k 1,1 | awk '{ $1="" }1')"
|
||||||
;;
|
;;
|
||||||
|
TITLE)
|
||||||
|
files="$(echo "$files" | while read -r file; do
|
||||||
|
path="$(echo "$file" | awk '{ print $1 }')"
|
||||||
|
title="$(cat "$file" | sed '1!d')"
|
||||||
|
echo "$path $title"
|
||||||
|
done | sort -k 2 | awk '{ print $1 }')"
|
||||||
|
;;
|
||||||
|
SUBTITLE)
|
||||||
|
files="$(echo "$files" | while read -r file; do
|
||||||
|
path="$(echo "$file" | awk '{ print $1 }')"
|
||||||
|
subtitle="$(cat "$file" | sed '2!d')"
|
||||||
|
echo "$path $subtitle"
|
||||||
|
done | sort -k 2 | awk '{ print $1 }')"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift
|
shift
|
||||||
|
@ -75,6 +89,12 @@ while [ $# -ne 0 ]; do
|
||||||
echo "$file $(head -n1 "$path" 2> /dev/null | sed 's/^#//g' | sed 's/^ //g')"
|
echo "$file $(head -n1 "$path" 2> /dev/null | sed 's/^#//g' | sed 's/^ //g')"
|
||||||
done)"
|
done)"
|
||||||
;;
|
;;
|
||||||
|
SUBTITLE)
|
||||||
|
files="$(echo "$files" | while read -r file; do
|
||||||
|
[ "$file" = "" ] && continue
|
||||||
|
path="$(echo "$file" | awk '{ print $1 }')"
|
||||||
|
echo "$file $(cat "$path" 2> /dev/null | sed '2!d' | sed 's/^##//g' | sed 's/^ //g')"
|
||||||
|
done)"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift
|
shift
|
||||||
|
|
Loading…
Reference in New Issue