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

  1. if exists("$TITFICHE_HOME") && expand('%:p') =~ $TITFICHE_HOME
  2. function! NewTitfiche()
  3. let dir = strftime("%Y/%m/%d")
  4. call mkdir(dir, 'p')
  5. let zId = dir . '/' . strftime("%H:%M")
  6. edit `=zId . ".md"`
  7. call append(0, "# /" . zId . " ")
  8. normal 1G$
  9. startinsert!
  10. endfunction
  11. function! MkLink(p)
  12. call mkdir(fnamemodify(a:p, ':h'), 'p')
  13. call system('ln ' . expand('%:S') . ' ' . fnamemodify(a:p, ':S'))
  14. endfunction
  15. command! -nargs=1 -complete=file_in_path Tag call MkLink(<f-args>)
  16. set isfname+=:
  17. set includeexpr=substitute(v:fname,'/','','')
  18. cd $TITFICHE_HOME
  19. nnoremap <C-l> "zciw(/<C-r>#)<Esc>%i[<C-r>z]<Esc>%
  20. vnoremap <C-l> "zc(/<C-r>#)<Esc>%i[<C-r>z]<Esc>%
  21. inoremap <C-l> (/<C-r>#)<Esc>%i[]<Left>
  22. nnoremap <C-n> :call NewTitfiche()<CR>
  23. nnoremap <C-t> :Tag<Space>
  24. endif