-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vim simiplifications; zettel scripts
- Loading branch information
Showing
4 changed files
with
119 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
syn match UrlNoSpell '\w\+:\/\/[^[:space:]]\+' contains=@NoSpell | ||
syn match TimestampNoSpell '\v\d{8}T\d{6}(-.{-}>)?' contains=@NoSpell | ||
syn match TimestampNoSpell '\v(.{-}>-)?\d{8}T\d{6}' contains=@NoSpell | ||
syn match LinkNoSpell '\v(\[+)[^]]+(\]+)' contains=@NoSpell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
let s:zetdir = expand('~/zettelkasten/') | ||
|
||
function! zet#new(...) | ||
let l:zetdir = expand('~/Sync/brisync/zettelkasten/') | ||
exec 'cd ' . l:zetdir | ||
exec 'cd ' . s:zetdir | ||
|
||
if len(a:000) == 0 | ||
return | ||
endif | ||
|
||
let l:filename = l:zetdir . strftime('%Y%m%dT%H%M%S') . '-' . join(a:000, '-') . '.md' | ||
let l:filename = s:zetdir . strftime('%Y%m%dT%H%M%S') . ' ' . join(a:000, ' ') . '.md' | ||
exec 'e ' . l:filename | ||
exec "silent! norm ggO\<c-r>=strftime('%Y%m%dT%H%M%S')\<cr>\<cr>\<esc>GI# " . join(a:000, ' ') . "\<cr>\<cr>\<esc>" | ||
exec "silent! norm! ggO#" . join(a:000, ' ') . "\<cr>\<esc>G" | ||
endfunction | ||
|
||
|
||
function s:linkto(filename) | ||
call setpos('.', [0, line('$'), 0, 0]) | ||
silent! norm! ?^[[? | ||
call append(line('.'), '[[' . a:filename . ']]') | ||
endfunction | ||
|
||
function! zet#link(otherfile) | ||
exec 'cd ' . s:zetdir | ||
let l:thisfile = expand('%') | ||
if l:thisfile == a:otherfile | ||
echoerr "Can't link a file to itself" | ||
endif | ||
|
||
call s:linkto(a:otherfile) | ||
exec 'split ' . a:otherfile | ||
call s:linkto(l:thisfile) | ||
endfunction | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
command! -nargs=* Zet call zet#new(<f-args>) | ||
command! -complete=file -nargs=1 ZetLink call zet#link(<f-args>) |