Skip to content

Instantly share code, notes, and snippets.

@tkrs
Created November 28, 2014 18:23
Show Gist options
  • Save tkrs/2599a2712e8ea748de5e to your computer and use it in GitHub Desktop.
Save tkrs/2599a2712e8ea748de5e to your computer and use it in GitHub Desktop.
This scripts load yaml on the VIM using the if_python.
function! s:load_yaml(filename)
python << EOS
import vim, yaml
with open(vim.eval('a:filename'), 'r') as f:
obj = yaml.load(f)
obj_hash = str(obj).replace('None', '{}')
vim.command('let l:ret = %s' % obj_hash)
EOS
return l:ret
endfunction
@tkrs
Copy link
Author

tkrs commented Nov 28, 2014

Require PyYAML.

pip install PyYAML

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