A collection of files I use to maintain my zettelkasten.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
799 B

if exists("$TITFICHE_HOME") && expand('%:p') =~ $TITFICHE_HOME
function! NewTitfiche()
let dir = strftime("%Y/%m/%d")
call mkdir(dir, 'p')
let zId = dir . '/' . strftime("%H:%M")
edit `=zId . ".md"`
call append(0, "# /" . zId . " ")
normal 1G$
startinsert!
endfunction
function! MkLink(p)
call mkdir(fnamemodify(a:p, ':h'), 'p')
call system('ln ' . expand('%:S') . ' ' . fnamemodify(a:p, ':S'))
endfunction
command! -nargs=1 -complete=file_in_path Tag call MkLink(<f-args>)
set isfname+=:
set includeexpr=substitute(v:fname,'/','','')
cd $TITFICHE_HOME
nnoremap <C-l> "zciw(/<C-r>#)<Esc>%i[<C-r>z]<Esc>%
vnoremap <C-l> "zc(/<C-r>#)<Esc>%i[<C-r>z]<Esc>%
inoremap <C-l> (/<C-r>#)<Esc>%i[]<Left>
nnoremap <C-n> :call NewTitfiche()<CR>
nnoremap <C-t> :Tag<Space>
endif