Skip to content

Commit 7aee30f

Browse files
Merge pull request #1 from JakeRoggenbuck/new-commands
New commands
2 parents 2546dc3 + e8be2b6 commit 7aee30f

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,14 @@ nnoremap <Leader>nd :call NewDraft()<CR>
3131
nnoremap <Leader>ld :call ListDrafts()<CR>
3232
```
3333

34+
#### `OpenDrafts` Keybind
35+
```vim
36+
nnoremap <Leader>z :call OpenDrafts()<CR>
37+
```
38+
3439
## Use
35-
- Open vim and run `:call NewDraft()` or `:call NewDraft("<Title>")` to auto name with the date and time
40+
- Open vim and run `:Draft` or `:Draft "<Title>"` to auto name with the date and time
41+
- Edit the file extension `:DraftExt .md` to change the file to markdown
3642
- Draft will open a new file in a specific directory, with a unique name
3743
- The file will be based on a template with stuff like the title and datetime
3844

@@ -45,16 +51,8 @@ nnoremap <Leader>ld :call ListDrafts()<CR>
4551

4652

4753
## TODO
48-
- Open file in vim buffer
49-
- Have keybind and directory set in plugin
50-
- Have search to reopen and view other drafts
51-
- Make command to run command `:Draft <Title>` and `:Draft`
52-
- Have plugin contain correct api, for new file and search
53-
- Make a search in python
54-
- Make list, let you open listed files to edit
55-
- Change file extension, maybe a keybind or a function call, but append .txt or .md to a file
5654
- Keybind or function call to copy contents with and without header to file
57-
- Make a convert to pdf more markdown
55+
- Make a convert to pdf for markdown
5856

5957
## Maybe TODO
6058
- 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

plugin/draft.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" draft.vim - Quickly writeup and save drafts for messaging apps in your favorite editor
22
" Authors: Jake Roggenbuck
3-
" Version: 0.1
3+
" Version: 0.2
44
" License: MIT
55

66
if exists('g:loaded_draft_plugin') || &compatible || v:version < 700
@@ -57,3 +57,12 @@ for file in list_drafts(drafts_directory):
5757
print(file)
5858
EOF
5959
endfunc
60+
61+
func! g:ChangeFileExt(ext)
62+
let s:filename = expand('%:p')
63+
execute "file " . s:filename . a:ext
64+
endfunc
65+
66+
command! -bar -bang -nargs=? Draft call NewDraft(<q-args>)
67+
command! -bar -bang -nargs=? DraftExt call ChangeFileExt(<q-args>)
68+
command! -bar -bang OpenDrafts call OpenDrafts()

0 commit comments

Comments
 (0)