Notes files open as txt, will not save #16

Closed
eater opened this Issue Dec 1, 2011 · 4 comments

Comments

Projects
None yet
2 participants
@eater

eater commented Dec 1, 2011

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

This comment has been minimized.

Show comment Hide comment
@xolox

xolox Dec 1, 2011

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).

Owner

xolox commented Dec 1, 2011

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

This comment has been minimized.

Show comment Hide comment
@eater

eater Dec 1, 2011

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.

eater commented Dec 1, 2011

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 added a commit that referenced this issue Dec 14, 2011

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.
@xolox

This comment has been minimized.

Show comment Hide comment
@xolox

xolox Dec 14, 2011

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!

Owner

xolox commented Dec 14, 2011

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

This comment has been minimized.

Show comment Hide comment
@eater

eater Dec 15, 2011

Yes, thanks!

eater commented Dec 15, 2011

Yes, thanks!

@eater eater closed this Dec 15, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment