File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,36 +190,35 @@ function! jsonpath#goto(...) "{{{
190190 let search_for = get (a: , 1 )
191191 if empty (search_for)
192192 let search_for = input (' Path (using dot notation): ' )
193+ if empty (search_for)
194+ echo ' Search aborted'
195+ return
196+ endif
193197 endif
194198
195- echo ' Searching buffer...' | redraw
196-
197199 let pos = jsonpath#scan_buffer (search_for)
198200
199- if ! empty (pos)
200- call setpos (' .' , pos)
201- else
201+ if empty (pos)
202202 echo ' Path not found: ' . search_for
203+ else
204+ call setpos (' .' , pos)
205+ echo ' Found on line ' . pos[1 ]
203206 endif
204-
205- return ' '
206207endfunction " }}}
207208
208209" Echoes the path of the identifier under the cursor
209210function ! jsonpath#echo () " {{{
210211 echo ' Parsing buffer...' | redraw
211212 let path = jsonpath#scan_buffer ([], line (' .' ), col (' .' ))
212213 echo len (path ) ? ' Path: ' . join (path , g: jsonpath_delimeter ) : ' Empty path'
213-
214- return ' '
215214endfunction " }}}
216215
217216" Entry point for the :JsonPath command
218217function ! jsonpath#command (input ) " {{{
219218 if empty (a: input )
220- return jsonpath#echo ()
219+ jsonpath#echo ()
221220 else
222- return jsonpath#goto (a: input )
221+ jsonpath#goto (a: input )
223222 endif
224223endfunction " }}}
225224
You can’t perform that action at this time.
0 commit comments