|
|
@ -822,7 +822,8 @@ let mapleader = "," |
|
|
|
|
|
|
|
" view log for current file |
|
|
|
" TODO: consider extending this to all files in some way... |
|
|
|
map <Leader>wl :call <SID>LogForFile()<CR> |
|
|
|
map <Leader>wl :call <SID>NotesLogsForFile()<CR> |
|
|
|
map <Leader>wf :call <SID>NotesFullLogsForFile()<CR> |
|
|
|
|
|
|
|
" view backlinks for current file |
|
|
|
map <Leader>wL :call <SID>NotesLinksForFile()<CR> |
|
|
@ -873,10 +874,19 @@ let mapleader = "," |
|
|
|
|
|
|
|
" take some custom actions after reading a wiki page: |
|
|
|
function! s:WikiBufReadPostOverrides() |
|
|
|
let realpath = system('readlink -fn ' . shellescape(expand('%'))) |
|
|
|
|
|
|
|
" regenerate wiki pages with `%% exec-raw auto` on load |
|
|
|
" XXX: don't run this for _logscratch files |
|
|
|
" (except for log scratch files - that could get real messy) |
|
|
|
if search("%% exec-raw auto", "nw") |
|
|
|
call <SID>RunFilter("filter-exec-raw") |
|
|
|
if match(realpath, '_logscratch') > -1 |
|
|
|
" no-op for the moment, might be other things to do here? |
|
|
|
" i'm not honestly sure if this is reachable because i'm not sure |
|
|
|
" that the postread here actually gets triggered at all. |
|
|
|
echom "logscratch - not honoring exec-raw auto" |
|
|
|
else |
|
|
|
call <SID>RunFilter("filter-exec-raw") |
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
" turn off wrapping for wiki pages with `%% nowrap` on load |
|
|
@ -889,7 +899,7 @@ let mapleader = "," |
|
|
|
function! s:WikiBufWritePostOverrides() |
|
|
|
" update link database |
|
|
|
let realpath = system('readlink -fn ' . shellescape(expand('%'))) |
|
|
|
if match(realpath, '_logscratch.wiki') > -1 |
|
|
|
if match(realpath, '_logscratch') > -1 |
|
|
|
return |
|
|
|
endif |
|
|
|
silent execute ":!notes-collect-metadata " . realpath |
|
|
@ -1069,7 +1079,7 @@ let mapleader = "," |
|
|
|
endfunction |
|
|
|
|
|
|
|
" Catenate log entries for current wiki page |
|
|
|
function! s:LogForFile() |
|
|
|
function! s:NotesFullLogsForFile() |
|
|
|
let realpath = system('readlink -fn ' . shellescape(expand('%'))) |
|
|
|
let hash = sha256(realpath) |
|
|
|
echom 'Finding logs for ' . realpath |
|
|
@ -1082,6 +1092,18 @@ let mapleader = "," |
|
|
|
1 |
|
|
|
endfunction |
|
|
|
|
|
|
|
" Location list with log entries for current file: |
|
|
|
function! s:NotesLogsForFile() |
|
|
|
let realpath = system('readlink -fn ' . shellescape(expand('%'))) |
|
|
|
" override default grep so we can populate the location list: |
|
|
|
setlocal grepprg=notes-logs-by-link\ --format\ location\ --file\ $* |
|
|
|
silent execute "silent lgrep! " . shellescape(realpath) |
|
|
|
redraw! |
|
|
|
" restore global setting for grepprg: |
|
|
|
setlocal grepprg< |
|
|
|
lopen |
|
|
|
endfunction |
|
|
|
|
|
|
|
" get a list of key bindings, along with where they were defined, and |
|
|
|
" open it in a tab. this variant of redir and map seen at: |
|
|
|
" https://stackoverflow.com/questions/7642746/is-there-any-way-to-view-the-currently-mapped-keys-in-vim#7642762 |
|
|
|