Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAdd a minor fix for the b:plist_original_format; #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions autoload/plist.vim
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ endfunction
function! plist#Write()
" Cache the argument filename destination
let filename = resolve(expand('<afile>'))
let b:plist_original_format = plist#GetOriginalFormat()

" If the user has not specified his preferred format when saving, use the
" same format as the file had originally. Otherwise the user option takes
Expand Down Expand Up @@ -110,7 +111,14 @@ function! plist#ReadPost()
call plist#SetFiletype()
endfunction

function! plist#GetOriginalFormat()
let filename = expand('<afile>')
return plist#DetectFormat(filename)
endfunction


function! plist#SetFiletype()
let b:plist_original_format = plist#GetOriginalFormat()
if g:plist_display_format == 'json' && s:has_plist || b:plist_original_format == 'json' && !s:has_plist
execute 'set filetype=' . (len(getcompletion('json', 'filetype')) ? 'json' : 'javascript')
else
Expand Down