Adapt votion file creation routines.

main
Felix Martin 2022-04-22 21:42:28 -04:00
parent 9bf4b54340
commit 5c78e872be
4 changed files with 30 additions and 9 deletions

View File

@ -0,0 +1,20 @@
import os
import vim
import datetime
FILE_TEMPLATE = """---
tags: [journal]
---
"""
def create_daily_journal():
file_name = datetime.datetime.now().strftime("journal-%Y-%m-%d.md")
file_path = os.path.join("/home/felixm/owc/archive/2022", file_name)
with open(file_path, "w") as f:
f.write(FILE_TEMPLATE)
return file_path
file_path = create_daily_journal()
vim.command(f":edit {file_path}")

View File

@ -10,13 +10,10 @@ tags: []
"""
def create_page():
creation_date = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
# creation_date = datetime.datetime.now().replace(microsecond=0).isoformat()
file_name = creation_date + ".md"
file_name = datetime.datetime.now().strftime("new-note-%Y-%m-%dT%H-%M-%S.md")
file_path = os.path.join("/home/felixm/owc/active", file_name)
with open(file_path, "w") as f:
s = FILE_TEMPLATE.format(creation_date=creation_date)
f.write(s)
f.write(FILE_TEMPLATE)
return file_path
file_path = create_page()

View File

@ -288,10 +288,13 @@ endfunction
nnoremap <leader>vo :RgVotion<CR>
nnoremap <leader>vt :RgVotionTitle<CR>
nnoremap <leader>va :RgVotionTags<CR>
command! VotionNew :py3file ~/.vim/scripts/votion.py
nnoremap <leader>vn :VotionNew<CR>
nnoremap <leader>vd :call delete(expand('%')) \| bp\| bd #<CR>
command! VotionJournal :py3file ~/.vim/scripts/votion-journal.py
nnoremap <leader>vj :VotionJournal<CR>
command! VotionNote :py3file ~/.vim/scripts/votion-note.py
nnoremap <leader>vn :VotionNote<CR>
" open nerdtree
noremap <leader>nt :Vexplore<CR>
noremap <leader>ob :Buffers<CR>
@ -309,7 +312,7 @@ command! -bang -nargs=* RgVotion
command! -bang -nargs=* RgVotionTitle
\ call fzf#vim#grep(
\ 'rg -i --column --line-number --no-heading --color=always --smart-case -- title: '.shellescape(<q-args>).' ~/owc', 1,
\ 'rg -i --column --line-number --no-heading --color=always --smart-case -- ^title: '.shellescape(<q-args>).' ~/owc', 1,
\ fzf#vim#with_preview({'options': ['--with-nth', '5..']}), <bang>0)
command! -bang -nargs=* RgVotionTags

View File

@ -20,8 +20,9 @@ alias vi="vim"
alias felixio="ssh felixio@felixm.de"
alias failx="ssh felixio@felixm.de"
alias feh="feh -F -."
alias vn="vim -c VotionNew"
alias vn="vim -c VotionNote"
alias vt="vim -c RgVotionTitle"
alias vj="vim -c VotionJournal"
alias fcd='cd "$(fd -t d | fzf)"'
alias ytmp3='yt-dlp --extract-audio --audio-format mp3 '
alias private-session='export SAVEHIST=0 && export HISTSIZE=0'