Permalink
Browse files

1.0.2 can turn off display of database, fix default for showing duration

Can now turn off database display in query output
Added toggle command for turnning of display of databased queried
All output can now be turned off
Corrected so that duration is shown in query output by default as
intended
Update help file to reflect changes
  • Loading branch information...
1 parent ca15220 commit c04f23956ae488c5f73286e374c35e10bf28d32f @coledarr committed Oct 9, 2012
Showing with 38 additions and 10 deletions.
  1. +11 −3 doc/xqmarklogic.txt
  2. +27 −7 ftplugin/xquery.vim
View
@@ -125,6 +125,9 @@ XQtoggleShowCurlCmd toggles showing curl command used in the output
XQtoggleShowDuration toggle showing the duration of the query. On by
default.
+XQtoggleShowDb toggle showing the Database used by the query. On by
+ default.
+
XQtoggleOutCleanup toggle if xml output is cleaned up or not. (insert
newlines between empty adjacent tags, reindent XML,
set foldlevel=10)
@@ -174,11 +177,16 @@ g:xqmarklogic_defaultNoOutCleanup - Turns on (1) or off (0) Output
space, reindent XML, and set foldlevel=10
g:xqmarklogic_defaultShowDuration - Turns on (1) or off (0) query
duration in output. Default true (1). Is
- included in output in xml comment
+ included in output in xml comment. Shown in
+ same comment that database used is output in.
+g:xqmarklogic_defaultshowDb - Turns on (1) or off (0) showing the Database
+ in query output. Default to True (1). Shown
+ in same comment that duration output is in.
g:xqmarklogic_defaultCurlCmd - turns on (1) or off (0) query curl
command used in query output. Defaults to off
- since command contains "--" which is valid in
- the XML comment information is included in
+ since command contains "--" which is invalid
+ in the XML comments. Shown in comment
+ separate from other above settings.
g:xqmarklogic_noMappings - if true (set to 1) then \B and <C-CR> wont be mapped
Examples: >
let g:xqmarklogic_defaultUser='labarbara_conrad'
View
@@ -1,6 +1,6 @@
" xquery.vim - <Leader>B or <C-CR> run buffer against marklogic as an xquery
" Maintainer: Darren Cole <http://github.com/coledarr/vim-xqmarklogic>
-" Version: 1.0.1
+" Version: 1.0.2
" TODO: Add support for: GetLatestVimScripts: ### ### :AutoInstall: xqmarklogic
" TODO: see *glvs-plugins* might not work, but should at least try
"
@@ -53,6 +53,14 @@ function! s:toggleShowDuration()
let b:xqmarklogic_showDuration=1
endif
endfunction
+command -buffer XQtoggleShowDb :execute s:toggleShowDb()
+function! s:toggleShowDb()
+ if (b:xqmarklogic_showDb)
+ let b:xqmarklogic_showDb=0
+ else
+ let b:xqmarklogic_showDb=1
+ endif
+endfunction
command -buffer XQtoggleOutCleanup :execute s:toggleOutCleanup()
function! s:toggleOutCleanup()
if (b:xqmarklogic_noOutCleanup)
@@ -103,9 +111,13 @@ function! s:initSettings()
endif
let b:xqmarklogic_showCurlCmd=g:xqmarklogic_defaultShowCurlCmd
if !exists('g:xqmarklogic_defaultshowDuration')
- let g:xqmarklogic_defaultShowDuration=0
+ let g:xqmarklogic_defaultShowDuration=1
endif
let b:xqmarklogic_showDuration=g:xqmarklogic_defaultShowDuration
+ if !exists('g:xqmarklogic_defaultshowDb')
+ let g:xqmarklogic_defaultShowDb=1
+ endif
+ let b:xqmarklogic_showDb=g:xqmarklogic_defaultShowDb
if !exists('g:xqmarklogic_defaultNoOutCleanup')
let g:xqmarklogic_defaultNoOutCleanup=0
@@ -166,8 +178,9 @@ function! s:DisplaySettings()
echo 'b:xqmarklogic_db = ' . b:xqmarklogic_db
echo ' --- options --- '
echo 'b:xqmarklogic_noOutCleanup = ' . b:xqmarklogic_noOutCleanup
- echo 'b:showCurlCmd = ' . b:showCurlCmd
- echo 'b:showDuration = ' . b:showDuration
+ echo 'b:xqmarklogic_showCurlCmd = ' . b:xqmarklogic_showCurlCmd
+ echo 'b:xqmarklogic_showDuration = ' . b:xqmarklogic_showDuration
+ echo 'b:xqmarklogic_showDb = ' . b:xqmarklogic_showDb
echo ' --- global ---'
echo 'g:xqmarklogic_noMappings = ' . g:xqmarklogic_noMappings
endfunction
@@ -192,6 +205,8 @@ function! s:QueryMarkLogic(fname)
let l:noOutClean = b:xqmarklogic_noOutCleanup
let l:showCurlCmd = b:xqmarklogic_showCurlCmd
let l:showDuration = b:xqmarklogic_showDuration
+ let l:showDb = b:xqmarklogic_showDb
+ let l:info=""
" Could use preview window
"let s:out = tempname()
@@ -201,8 +216,11 @@ function! s:QueryMarkLogic(fname)
" Use a 'nofile' window
"botright new
belowright new
+
- let info .= ' db="' . l:db . '"'
+ if (l:showDb)
+ let l:info .= ' db="' . l:db . '"'
+ endif
setlocal buftype=nofile
setlocal filetype=xml
@@ -217,9 +235,11 @@ function! s:QueryMarkLogic(fname)
if (l:showDuration)
let end=reltimestr(reltime(start))
- let info .= ' query_duration="' . end . '"'
+ let l:info .= ' query_duration="' . end . '"'
+ endif
+ if (l:info != "" )
+ call append(0, '<!-- ' . l:info .'" -->')
endif
- call append(0, '<!-- ' . info .'" -->')
" cleanup output
if (!l:noOutClean)

0 comments on commit c04f239

Please sign in to comment.