Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Notes files open as txt, will not save #16

Closed
eater opened this Issue · 4 comments

2 participants

@eater

I have let g:notes_suffix = '.txt' in my .vimrc.

When I go to :RecentNotes and open a note, the filetype is set to "txt" rather than "notes". More problematic, hitting :w does nothing at all! Unless I manually :set ft=notes first, and then it allows me to save.

  • Shouldn't all notes open with filetype of "notes" automatically?

  • And what is silently blocking the normal save functionality?

@xolox
Owner

I have let g:notes_suffix = '.txt' in my .vimrc.

When I go to :RecentNotes and open a note, the filetype is set to "txt" rather than "notes". More problematic, hitting :w does nothing at all! Unless I manually :set ft=notes first, and then it allows me to save.

Strange, I cannot reproduce this. What platform are you using (Windows/UNIX/?) and how did you install the plug-in (ZIP archive, git clone)? I assume you go from the :RecentNotes buffer to a note using the gf mapping? And are you using version 0.16.12 or later?

Shouldn't all notes open with filetype of "notes" automatically?

Yes they should. I guess I broke this functionality when I moved the file type detection to ftdetect/notes.vim.

And what is silently blocking the normal save functionality?

As you already realized this is a consequence of the first issue. The notes plug-in defines the BufWriteCmd automatic command to be able to automatically rename notes when you change the title (to keep the title and filename in sync).

The plug-in defines this automatic command for all files in the directory g:notes_directory, but the automatic command refuses to act on files that don't have the notes file type set. There is an asymmetry here, but I'm not sure whether to fix it after the original issue is resolved (after the bug is fixed the asymmetry shouldn't manifest anymore).

@eater

What platform are you using (Windows/UNIX/?) and how did you install the plug-in (ZIP archive, git clone)?

Both Windows and Linux, with synchronized .vim directories. I installed via git clone.

I assume you go from the :RecentNotes buffer to a note using the gf mapping? And are you using version 0.16.12 or later?

Yes, I use gf (although before this works on Windows I have to manually source ftplugin/notes.vim because of what I believe is a Vundle quirk). I've got 0.16.14.

@xolox xolox referenced this issue from a commit
@xolox Move file type detection back to plugin script (issues #16 & #17)
Since I published the notes.vim plug-in I cannot remember ever
getting a single complaint about the file type not loading,
however since I introduced "ftdetect/notes.vim" I've gotten
several complaints. I'm hoping this commit will resolve the
issues some users have been experiencing.

Still it's strange that I'm not experiencing the issue myself.

Oh well.
9933c4f
@xolox
Owner

I hope either of the changes I made in the last two days resolves your issue with the notes plug-in and file type detection. If the issue is indeed resolved I would appreciate it if you can confirm this by closing the issue on GitHub. Thanks for your feedback!

@eater

Yes, thanks!

@eater eater closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.