mirror of
https://github.com/vbatts/utils.git
synced 2024-12-04 14:35:41 +00:00
update readme, add vim
This commit is contained in:
parent
d856d5bea4
commit
37f00446a3
2 changed files with 79 additions and 0 deletions
20
README.md
20
README.md
|
@ -12,6 +12,26 @@ Simple date formating for notes
|
|||
|
||||
go get github.com/vbatts/freezing-octo-hipster/cmd/next-note
|
||||
|
||||
### Usage
|
||||
|
||||
next-note -h
|
||||
Usage of next-note:
|
||||
-c=false: print current week's filename
|
||||
-d=false: print current date
|
||||
-dir="": Base directory for tasks
|
||||
-p=false: print previous week's filename
|
||||
|
||||
### vim
|
||||
|
||||
Copy ./cmd/next-note/next-note.vim to ~/.vim/plugin/
|
||||
|
||||
This provides commands, like:
|
||||
|
||||
* `:Nd` - append the date to the current buffer
|
||||
* `:Nc` - to open a tabe for current week's notes file
|
||||
* `:Np` - to open a tabe for previous week's notes file
|
||||
* `:Nn` - to open a tabe for next week's notes file
|
||||
|
||||
## find-todos
|
||||
|
||||
Look through your notes directory for TODO items.
|
||||
|
|
59
cmd/next-note/next-note.vim
Normal file
59
cmd/next-note/next-note.vim
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
if exists("loaded_next_note")
|
||||
finish
|
||||
endif
|
||||
let loaded_next_note = 1
|
||||
|
||||
function! s:AppendDatetime()
|
||||
let lines = [system("next-note -d")]
|
||||
call append( line('$'), lines )
|
||||
endfunction
|
||||
|
||||
function! s:OpenPrevWeeksNote()
|
||||
let cmd_output = system("next-note -p")
|
||||
if cmd_output == ""
|
||||
echohl WarningMsg |
|
||||
\ echomsg "Warning: next note already exists" |
|
||||
\ echohl None
|
||||
return
|
||||
endif
|
||||
execute "tabe " . cmd_output
|
||||
execute "tabm +1"
|
||||
endfunction
|
||||
|
||||
function! s:OpenCurrentWeeksNote()
|
||||
let cmd_output = system("next-note -c")
|
||||
if cmd_output == ""
|
||||
echohl WarningMsg |
|
||||
\ echomsg "Warning: next note already exists" |
|
||||
\ echohl None
|
||||
return
|
||||
endif
|
||||
execute "tabe " . cmd_output
|
||||
execute "tabm 1"
|
||||
endfunction
|
||||
|
||||
function! s:OpenNextWeeksNote()
|
||||
let cmd_output = system("next-note")
|
||||
if cmd_output == ""
|
||||
echohl WarningMsg |
|
||||
\ echomsg "Warning: next note already exists" |
|
||||
\ echohl None
|
||||
return
|
||||
endif
|
||||
execute "tabe " . cmd_output
|
||||
execute "tabm 1"
|
||||
endfunction
|
||||
|
||||
command! Ndate
|
||||
\ call s:AppendDatetime()
|
||||
|
||||
command! Nprev
|
||||
\ call s:OpenPrevWeeksNote()
|
||||
|
||||
command! Nnext
|
||||
\ call s:OpenNextWeeksNote()
|
||||
|
||||
command! Ncurr
|
||||
\ call s:OpenCurrentWeeksNote()
|
||||
|
Loading…
Reference in a new issue