Skip to content

📝 Quickly write up and save drafts for messaging apps in your favorite editor. Save notes, code examples, or homework assignments.

License

Notifications You must be signed in to change notification settings

JakeRoggenbuck/draft.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Draft.vim

Vim Python Version Python

📝 Quickly write up and save drafts for messaging apps in your favorite editor vimawesome.com/plugin/draft-vim

Why use Draft.vim

I often write important messages in a vim buffer before I send it.

  • The main reason for this is because it is simply faster.
  • The second reason is you might want syntax highlighting or auto formatting.
  • Also, sometimes you want to write a message without worrying about accidentally sending it.

Requirements

Features

  • Quickly open a new, well named file in a consistent directory
  • Each file automatically contains attributes like the date and title that can be searchable

Setup and Config

Make a drafts directory

" Add the command to setup a drafts directory
let g:drafts_directory = "/path/to/drafts/"

Optional, create a keybind for the commands

NewDraft Keybind

nnoremap <Leader>nd :call NewDraft()<CR>

ListDrafts Keybind

nnoremap <Leader>ld :call ListDrafts()<CR>

OpenDrafts Keybind

nnoremap <Leader>z :call OpenDrafts()<CR>

Usage

Commands

Command Description
Draft Open a blanck new draft
Draft "title" Open a draft with a title
DraftExt "extension" Change the file extension of a draft
Drafts Open the draft directory in a buffer
DraftCopy Copy the contents of the draft to the clipboard
DraftSearch Search through drafts by keyword

More info

  • New draft: run :Draft or :Draft "<Title>" to auto name with the date and time
  • Edit the file extension: run :DraftExt .md to change the file to markdown
  • Open the drafts directory: run :Drafts
  • Copy the contents of the current draft :DraftCopy
  • Draft will open a new file in a specific directory, with a unique name
  • The file will be based on a template with stuff like the title and datetime

Install

Vim-Plug

Plug 'jakeroggenbuck/draft.vim'

Vundle

Plugin 'jakeroggenbuck/draft.vim'

Changelog

0.1 draft.vim - not fully functional, just a concept

  • Open a new draft with a name
  • List the draft but no reopening them

0.2 draft.vim - first complete version

  • Add OpenDrafts()
  • Add new command aliases Draft, DraftExt

0.3 draft.vim - more features

  • Add ClipDraft() for DraftCopy
  • Add Buffer reload for DraftExt

0.4 draft.vim - convert features

  • Add ConvertMDToHTML() for DraftToHTML
  • Add ConvertMDToPDF() for DraftToPDF
  • Add ConvertHTMLToPDF and ConvertToPDFFromTemplate() for DraftToTemplatePDF
  • Add template for html conversion
  • Change readme format a little
  • Add vimawesome link!

0.5 draft.vim - more features

  • Add DraftDragonPDF for DraftDragonPDF
  • Add DraftOpenPDF for OpenPDF
  • Add requirements

0.6 draft.vim - added search

  • Add DraftSearch by word
:DraftSearch <term>

:DraftSearch school

0.7 draft.vim - search fixes

  • Rank searches
  • Fix parenthesis in filename bug

0.8 draft.vim - date format fix

  • Change default date format to m/d/y
  • Documentation fixes and additions
  • Fix rename symbols issue
  • Add testing for python

Testing

pip install -r requirements.txt
cd python

pytest

TODO

  • Make md to template pdf correctly do syntax highlight

Maybe TODO

  • Make a draft file type with metadata and parse out the metadata when opened in vim, then use this data to search for notes better and stuff, like have raw data for python to search better with

About

📝 Quickly write up and save drafts for messaging apps in your favorite editor. Save notes, code examples, or homework assignments.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published