Skip to content

Instantly share code, notes, and snippets.

@note103
Created August 31, 2018 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save note103/2efcf0f51203a7a5b45ce31de557238b to your computer and use it in GitHub Desktop.
Save note103/2efcf0f51203a7a5b45ce31de557238b to your computer and use it in GitHub Desktop.
For Scrapbox article
function! s:sbnew(prj)
let prj = a:prj
let input = input('This is @'.prj.': Other Project? [n]: ')
if input != ""
let prj = input
endif
let ans = input('Create? @'.prj.' (y/n) [n]: ')
if ans != 'y'
redraw
echo 'Canceled!'
return
endif
let datetime = strftime('%Y-%m-%d').'-'.strftime('%H-%M-%S')
call append(0, 'https://scrapbox.io/'.prj.'/'.datetime)
let url = getline(1)
execute ':OpenBrowser '.url
execute ':2'
execute ':normal VGy'
endfunction
nnoremap <silent><Leader><Leader>sa :<C-u>call <SID>sbnew('note103')<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment