Skip to content

Instantly share code, notes, and snippets.

@robinedwards
Last active December 14, 2015 11:59
Show Gist options
  • Save robinedwards/5083532 to your computer and use it in GitHub Desktop.
Save robinedwards/5083532 to your computer and use it in GitHub Desktop.
Create binding for execute neo4j cypher and show results in separate vim window. Make sure you have installed py2neo first: pip install py2neo You can change the format of the results with the -f flag
" Run cypher query and return result
function! EvalCypher()
let src = expand("%")
let dst = tempname()
execute ":silent !cat " . src . " | cypher -f json -H localhost &> " . dst
execute ":pedit! " . dst
execute ":redraw!"
wincmd P
setlocal syntax=javascript
retab
endfunction
augroup filetype
autocmd BufNewFile,BufRead *.cypher map <F7> <Esc>:call EvalCypher()<CR>
autocmd BufNewFile,BufRead *.cypher set syntax=cypher
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment