Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit c04f23956ae488c5f73286e374c35e10bf28d32f 1 parent ca15220
Darren Cole authored October 09, 2012
14  doc/xqmarklogic.txt
@@ -125,6 +125,9 @@ XQtoggleShowCurlCmd	toggles showing curl command used in the output
125 125
 XQtoggleShowDuration	toggle showing the duration of the query.  On by
126 126
 			default.
127 127
 
  128
+XQtoggleShowDb		toggle showing the Database used by the query.  On by
  129
+			default.
  130
+
128 131
 XQtoggleOutCleanup	toggle if xml output is cleaned up or not. (insert
129 132
 			newlines between empty adjacent tags, reindent XML,
130 133
 			set foldlevel=10)
@@ -174,11 +177,16 @@ g:xqmarklogic_defaultNoOutCleanup	- Turns on (1) or off (0) Output
174 177
 				space, reindent XML, and set foldlevel=10
175 178
 g:xqmarklogic_defaultShowDuration	- Turns on (1) or off (0) query
176 179
 				duration in output. Default true (1).  Is
177  
-				included in output in xml comment
  180
+				included in output in xml comment.  Shown in
  181
+				same comment that database used is output in.
  182
+g:xqmarklogic_defaultshowDb	- Turns on (1) or off (0) showing the Database
  183
+				in query output.  Default to True (1).  Shown
  184
+				in same comment that duration output is in.
178 185
 g:xqmarklogic_defaultCurlCmd		- turns on (1) or off (0) query curl
179 186
 				command used in query output.  Defaults to off
180  
-				since command contains "--" which is valid in
181  
-				the XML comment information is included in
  187
+				since command contains "--" which is invalid
  188
+				in the XML comments.  Shown in comment
  189
+				separate from other above settings.
182 190
 g:xqmarklogic_noMappings	- if true (set to 1) then \B and <C-CR> wont be mapped
183 191
 	Examples: >
184 192
 		let g:xqmarklogic_defaultUser='labarbara_conrad'
34  ftplugin/xquery.vim
... ...
@@ -1,6 +1,6 @@
1 1
 " xquery.vim - <Leader>B or <C-CR> run buffer against marklogic as an xquery
2 2
 " Maintainer:   Darren Cole <http://github.com/coledarr/vim-xqmarklogic>
3  
-" Version:      1.0.1
  3
+" Version:      1.0.2
4 4
 " TODO: Add support for: GetLatestVimScripts: ### ### :AutoInstall: xqmarklogic
5 5
 " TODO: see *glvs-plugins* might not work, but should at least try
6 6
 " 
@@ -53,6 +53,14 @@ function! s:toggleShowDuration()
53 53
         let b:xqmarklogic_showDuration=1
54 54
     endif
55 55
 endfunction
  56
+command -buffer XQtoggleShowDb :execute s:toggleShowDb()
  57
+function! s:toggleShowDb()
  58
+    if (b:xqmarklogic_showDb)
  59
+        let b:xqmarklogic_showDb=0
  60
+    else
  61
+        let b:xqmarklogic_showDb=1
  62
+    endif
  63
+endfunction
56 64
 command -buffer XQtoggleOutCleanup :execute s:toggleOutCleanup()
57 65
 function! s:toggleOutCleanup()
58 66
     if (b:xqmarklogic_noOutCleanup)
@@ -103,9 +111,13 @@ function! s:initSettings()
103 111
     endif
104 112
     let b:xqmarklogic_showCurlCmd=g:xqmarklogic_defaultShowCurlCmd
105 113
     if !exists('g:xqmarklogic_defaultshowDuration')
106  
-        let g:xqmarklogic_defaultShowDuration=0
  114
+        let g:xqmarklogic_defaultShowDuration=1
107 115
     endif
108 116
     let b:xqmarklogic_showDuration=g:xqmarklogic_defaultShowDuration
  117
+    if !exists('g:xqmarklogic_defaultshowDb')
  118
+        let g:xqmarklogic_defaultShowDb=1
  119
+    endif
  120
+    let b:xqmarklogic_showDb=g:xqmarklogic_defaultShowDb
109 121
 
110 122
     if !exists('g:xqmarklogic_defaultNoOutCleanup')
111 123
         let g:xqmarklogic_defaultNoOutCleanup=0
@@ -166,8 +178,9 @@ function! s:DisplaySettings()
166 178
     echo 'b:xqmarklogic_db	= ' . b:xqmarklogic_db
167 179
     echo ' --- options --- '
168 180
     echo 'b:xqmarklogic_noOutCleanup	= ' . b:xqmarklogic_noOutCleanup
169  
-    echo 'b:showCurlCmd	        = ' . b:showCurlCmd
170  
-    echo 'b:showDuration	= ' . b:showDuration
  181
+    echo 'b:xqmarklogic_showCurlCmd	= ' . b:xqmarklogic_showCurlCmd
  182
+    echo 'b:xqmarklogic_showDuration	= ' . b:xqmarklogic_showDuration
  183
+    echo 'b:xqmarklogic_showDb		= ' . b:xqmarklogic_showDb
171 184
     echo ' --- global ---'
172 185
     echo 'g:xqmarklogic_noMappings	= ' . g:xqmarklogic_noMappings
173 186
 endfunction
@@ -192,6 +205,8 @@ function! s:QueryMarkLogic(fname)
192 205
     let l:noOutClean = b:xqmarklogic_noOutCleanup
193 206
     let l:showCurlCmd = b:xqmarklogic_showCurlCmd
194 207
     let l:showDuration = b:xqmarklogic_showDuration
  208
+    let l:showDb    = b:xqmarklogic_showDb
  209
+    let l:info=""
195 210
 
196 211
     " Could use preview window
197 212
     "let s:out = tempname()
@@ -201,8 +216,11 @@ function! s:QueryMarkLogic(fname)
201 216
     " Use a 'nofile' window
202 217
     "botright new
203 218
     belowright new
  219
+    
204 220
 
205  
-    let info .= ' db="' . l:db . '"'
  221
+    if (l:showDb)
  222
+        let l:info .= ' db="' . l:db . '"'
  223
+    endif
206 224
 
207 225
     setlocal buftype=nofile
208 226
     setlocal filetype=xml
@@ -217,9 +235,11 @@ function! s:QueryMarkLogic(fname)
217 235
 
218 236
     if (l:showDuration)
219 237
         let end=reltimestr(reltime(start))
220  
-        let info .= ' query_duration="' . end . '"'
  238
+        let l:info .= ' query_duration="' . end . '"'
  239
+    endif
  240
+    if (l:info != "" )
  241
+        call append(0, '<!-- ' . l:info .'" -->')
221 242
     endif
222  
-    call append(0, '<!-- ' . info .'" -->')
223 243
 
224 244
     " cleanup output
225 245
     if (!l:noOutClean)

0 notes on commit c04f239

Please sign in to comment.
Something went wrong with that request. Please try again.