EditZettelLast not working
While I was editing my index file, I decided to create a new zettel (let's call it zettel2) with gzn. I made some changes and saved, but then when i used gzu (in normal mode) to go back, My response is simply the file name of zettel2.
I expected gzu to take me back to the index file, but that did not happen.
I have the same problem and in addition InsertZettelLast isn't working as well.
- Editing zettel-1
- Create zettel-2 with
gznand save zettel-2 with:w. - Last edited zettel is zettel-2 because last saved zettel is zettel-2.
We need penultimate edited zettel.
These changes should have made:
func! util#get_file_modified_last(dir, extension)
- return system('ls -t '.shellescape(a:dir).'*'.a:extension.' | head -1')
+ return system('ls -t '.shellescape(a:dir).'*'.a:extension.' | head -2 | tail -1')
endf
Do we agreed?
Actual result: zettel-2 is last zettel Expected result: zettel-1 is last zettel
Probably "Last zettel" is confusing, because I expect the Zettel before the last Zettel.
Yes, looks like,
We need penultimate edited zettel.
But in that case, when user edits a zettel-1 and saves it, opens another file other than zettelkästen and presses gzu to last edited zettel then returning zettel-1 is expected. Getting penultimate zettel would be irrelevant.
I think we can solve this problem by checking whether or not the current buffer is a zettel when the user hits gzu.
if gzu pressed
if current buffer is from zettelkästen; then
open penultimate (last but one) zettel
else if current buffer is not a zettel; then
open last modified file in zettelkästen
end
end
that makes sense!
The behavior of this command also confused me, I've implemented a way that felt more natural to me here: https://github.com/fiatjaf/neuron.vim/commit/220eb5cfbea08971a4e3185a354292d5a570090a