Skip to content

Commit

Permalink
Add method to create link with new note
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBockelandt committed Mar 6, 2020
1 parent 2b4288f commit 308c54a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions autoload/notoire.vim
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ function! notoire#create_note(cmd)
exe a:cmd g:notoire_folder . "/" . note_id . ".note"
endfunction

function! notoire#create_note_with_link(cmd)
" if we are on a link, we open it
" if we are not on a link, create one with the current selection. Current
" word if there is no selection
" When we decide to create a new link, we need to display a buffer with the
" list of possible notes to link to or the option for a new note.
" Possibility of searching through existing notes easily to find the one
" create a link to a new note with the visual selection
" TODO ideally it would ask for the note to link to, instead of creating a new
" note by default
function! notoire#create_link(cmd)
let new_note_id = notoire#get_next_note_id()
exe "normal! \ei[\e`>lli](" . new_note_id . ")\e"
exe a:cmd g:notoire_folder . "/" . new_note_id . ".note"
endfunction

6 changes: 3 additions & 3 deletions plugin/notoire.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ command! NotoireCreateNote call notoire#create_note("edit")
command! NotoireCreateNoteSplit call notoire#create_note("split")
command! NotoireCreateNoteVsplit call notoire#create_note("vsplit")

command! NotoireCreateNoteWithLink call notoire#create_note_with_link("edit")
command! NotoireCreateNoteWithLinkSplit call notoire#create_note_with_link("split")
command! NotoireCreateNoteWithLinkVsplit call notoire#create_note_with_link("vsplit")
command! NotoireCreateLink call notoire#create_link("edit")
command! NotoireCreateLinkSplit call notoire#create_link("split")
command! NotoireCreateLinkVsplit call notoire#create_link("vsplit")

command! NotoireCheckHealth call notoire#check_health()

0 comments on commit 308c54a

Please sign in to comment.