Closed sanchon closed 7 years ago
I've verified that :saveas filename.txt
doesn't work for me either. It says "Update successful" but it appears to update the remote Simplenote file rather than saving locally.
This is intended functionality. See https://github.com/mrtazz/simplenote.vim/blob/master/autoload/SimplenoteUtilities.py#L297
When I want to do this I just yank the buffer contents (ggyG) and paste that to a new buffer and save that. We could add an export command, but personally that seems superfluous given the built in functionality in Vim. Open to opinions though.
I don't know about the limitations of vimscript you have to deal with, but I was surprised that :saveas
wouldn't work like that.
I would not support a separate export command because that's also not idiomatic Vim. I'd prefer :saveas
show an error message if it can't be made to work as expected.
To clarify, I use other idiomatic Vim commands in my Simplenote notes: :xa
, :qa
, etc. I expected :saveas
and :w filename
to behave unsurprisingly as well.
I found a more... let' say... elegant way, in my opinion, using this plugin: clone that clones a buffer. I clone the scratch buffer and after that I can save it or whatever without affecting the original one and the plugin.
I often save my notes locally to "evolve" them when necessary into more complicated documents, or to use Pandoc and convert them to html or word files... I think that it would be great to have an option to disable the default behavior, so that :w
works as expected in a scratch buffer (there'd still be a :SimplenoteUpdate
command to update the remote Simplenote note)
I agree with @atomicules that a export command would be superfluous
Still really not sure how I feel about this. Gonna let it stew awhile and think about it.
I am now trying to get some Markdown preview working using pandoc - Mainly because the SimpleNote webapp does not render pipe tables.
I do not mind running pandoc from vim and opening the resuolt in a browser, but being able to save a current buffer as a temp file (/tmp/ttt.md) and continue working on the note would be really handy.
I was not able to find out how to do that though.
Am I missing something? Could you give me a hint?
BTW.. I really like your plugin!
I think to provide this kind of functionality I'd be looking to get #18 implemented. So... don't hold your breath. I'll leave this open separately for the time being though.
Well, I did a very dirty hack to help me.
I added to .vimrc
the following:
command PreviewSimpleNoteinHTML 0go <bar> yank10000000 <bar> tabnew <bar> put <bar> write! /tmp/ttt.md <bar> close! <bar> !pandoc -o /tmp/ttt.html /tmp/ttt.md && chromium-browser /tmp/ttt.html
..as you can see, I didn't figure out how to select all the way until the end of the file, so if anybody knows how to do it, please let me know!
@elpraga Here's an improved version of the hack:
command PreviewSimpleNoteinHTML silent 1,$yank <bar> new <bar> put 0 <bar> wq /tmp/ttt.md <bar> !pandoc -o /tmp/ttt.html /tmp/ttt.md && chromium-browser /tmp/ttt.html
I think I found a solution, see https://github.com/mrtazz/simplenote.vim/pull/92
Thanks for the efforts here! I shall try to review soon.
Closed via #92.
I can't find a good way to do it... I've tried
:saveas exported.txt
and:w exported.txt
but no luck