Permalink
Browse files

added the vim helper

  • Loading branch information...
1 parent a548679 commit 9daeb59b9913127ba1a9a9ad2dd21cb83f0f08f9 @yangchenyun committed Mar 27, 2013
Showing with 24 additions and 0 deletions.
  1. +24 −0 xquery-helper.vim
View
@@ -0,0 +1,24 @@
+" Execute XQuery Blocks
+function! Xq_getVisualBlock() range
+ let save = @"
+ " Mark the current line to return to
+ let curline = line("'>")
+ let curcol = virtcol("'>")
+
+ silent normal gvy
+ let vis_cmd = @"
+ let @" = save
+
+ " Return to previous location
+ " Accounting for beginning of the line
+ call cursor(curline, curcol)
+
+ return vis_cmd
+endfunction
+
+function! Xq_execQuery(str)
+ exec '!echo -n '.shellescape(a:str).' | xquery -q:- '
+endfunction
+
+command! -nargs=0 -range XqExecQuery :call Xq_execQuery(Xq_getVisualBlock())
+map <leader>xe :XqExecQuery<cr>

0 comments on commit 9daeb59

Please sign in to comment.