Using macOS, you may have had experiences of handling plist files. For example, ~/Library/Preferences/.GlobalPreferences.plist
file holds some configurations of macOS. When you type defaults write -g ApplePressAndHoldEnabled -bool false
on terminal, the following lines are added to .GlobalPreferences.plist
:
<key>ApplePressAndHoldEnabled</key>
<false/>
So when you dig down the preferences or resources of macOS system, you’ll meet plist files.
vim-plist
darfink’s vim-plist plugin handles *.plist files quite well. A plist file is in one of three formats; json, binary, xml. macOS is bundled with the plutil
command that can convert a plist file from one format to another. The plugin also uses plutil
to handle read and write of plist files.
The plugin registers autocmd for BufReadCmd
and FileReadCmd
to read *.plist files, BufWriteCmd
and FileWriteCmd
to write *.plist files. BufRead
and BufWrite
events are triggered after reading the file into the buffer, but BufReadCmd
and BufWriteCmd
events are triggered before reading the file, and that autocmd should handle actual read and write operation of that file. These differences make handling plist files more complex.