xaizek / vim-qthelp (License: Unspecified) (since 2018-12-07)
This plugin opens Qt help pages in browser from C++ source code.
Commit 9f16b09eb7af01b6b96adf04ed7bf714b96b1853

Use `empty(foo)` instead of `len(foo) == 0`
Author: xaizek
Author date (UTC): 2013-03-09 14:09
Committer name: xaizek
Committer date (UTC): 2013-03-09 14:09
Parent(s): c47898f04a734406048de4dbd9b1af8b5fb0ae03
Signing key:
Tree: 13dbea502f390b7e63abe80159ebf245824eca55
File Lines added Lines deleted
plugin/qthelp.vim 11 11
File plugin/qthelp.vim changed (mode: 100644) (index 8599f2e..3643e9a)
... ... function! QHHelp(query)
98 98 let l:lst = s:QHGetTagsListUC() let l:lst = s:QHGetTagsListUC()
99 99 endif endif
100 100
101 if len(l:lst) == 0
101 if empty(l:lst)
102 102 call s:QHTellUser("Nothing was found") call s:QHTellUser("Nothing was found")
103 103 else else
104 104 call s:QHDebug('QHDBG: QHHelp, filename="'.l:lst[0]['filename'].'"') call s:QHDebug('QHDBG: QHHelp, filename="'.l:lst[0]['filename'].'"')
 
... ... function! s:QHGetTagsListUC()
112 112 " wuc is for Word Underneath the Cursor " wuc is for Word Underneath the Cursor
113 113 let l:wuc = expand('<cword>') let l:wuc = expand('<cword>')
114 114 let l:lst = taglist('//apple_ref/cpp/cl//'.l:wuc.'$') let l:lst = taglist('//apple_ref/cpp/cl//'.l:wuc.'$')
115 if len(l:lst) == 0 " if WUC is var_name
115 if empty(l:lst) " if WUC is var_name
116 116 let [l:class, b:membername] = QHGetVUCInfo() let [l:class, b:membername] = QHGetVUCInfo()
117 if b:membername == ''
117 if empty(b:membername)
118 118 let l:lst = taglist('//apple_ref/cpp/cl//'.l:class.'$') let l:lst = taglist('//apple_ref/cpp/cl//'.l:class.'$')
119 119 else else
120 120 let l:lst = s:QHGetTagsListOnMember(l:class, b:membername) let l:lst = s:QHGetTagsListOnMember(l:class, b:membername)
121 if len(l:lst) == 0
121 if empty(l:lst)
122 122 let b:membername = '' let b:membername = ''
123 123 let l:lst = taglist('//apple_ref/cpp/cl//'.l:class.'$') let l:lst = taglist('//apple_ref/cpp/cl//'.l:class.'$')
124 124 endif endif
 
... ... function! s:QHGetTagsListOnMember(class, member)
143 143 return l:lst return l:lst
144 144 endif endif
145 145
146 if len(l:lst) == 0
146 if empty(l:lst)
147 147 let l:lst = taglist('//apple_ref/cpp/clm/'.a:class.'/'.a:member.'$') let l:lst = taglist('//apple_ref/cpp/clm/'.a:class.'/'.a:member.'$')
148 148 endif endif
149 if len(l:lst) == 0
149 if empty(l:lst)
150 150 let l:lst = taglist('//apple_ref/cpp/instm/'.a:class.'/'.a:member.'$') let l:lst = taglist('//apple_ref/cpp/instm/'.a:class.'/'.a:member.'$')
151 151 endif endif
152 if len(l:lst) == 0
152 if empty(l:lst)
153 153 let l:lst = taglist('//apple_ref/cpp/econst/'.a:class.'/'.a:member.'$') let l:lst = taglist('//apple_ref/cpp/econst/'.a:class.'/'.a:member.'$')
154 154 endif endif
155 if len(l:lst) == 0
155 if empty(l:lst)
156 156 let l:lst = taglist('//apple_ref/cpp/tag/'.a:class.'/'.a:member.'$') let l:lst = taglist('//apple_ref/cpp/tag/'.a:class.'/'.a:member.'$')
157 157 endif endif
158 158 return l:lst return l:lst
 
... ... function! s:QHGetTagsList(query)
170 170 let l:member = substitute(a:query, l:regex, '\2', '') let l:member = substitute(a:query, l:regex, '\2', '')
171 171 call s:QHDebug('QHDBG: QHGetTagsList, member="'.l:member.'"') call s:QHDebug('QHDBG: QHGetTagsList, member="'.l:member.'"')
172 172 let l:lst = taglist('//apple_ref/cpp/clm/'.l:class.'/'.l:member.'$') let l:lst = taglist('//apple_ref/cpp/clm/'.l:class.'/'.l:member.'$')
173 if len(l:lst) == 0
173 if empty(l:lst)
174 174 let l:lst = taglist('//apple_ref/cpp/instm/' let l:lst = taglist('//apple_ref/cpp/instm/'
175 175 \.l:class.'/'.l:member.'$') \.l:class.'/'.l:member.'$')
176 176 endif endif
177 if len(l:lst) == 0
177 if empty(l:lst)
178 178 let l:lst = taglist('//apple_ref/cpp/tag/' let l:lst = taglist('//apple_ref/cpp/tag/'
179 179 \.l:class.'/'.l:member.'$') \.l:class.'/'.l:member.'$')
180 180 endif endif
 
... ... function! QHGetVUCInfo()
247 247 let l:wuctype = s:QHGetWUCType(wuc) let l:wuctype = s:QHGetWUCType(wuc)
248 248 if l:wuctype == 0 " we're assuming that this is varname if l:wuctype == 0 " we're assuming that this is varname
249 249 let l:varname = s:QHGetVarType(l:wuc) let l:varname = s:QHGetVarType(l:wuc)
250 if l:varname == ''
250 if empty(l:varname)
251 251 return [l:wuc, ''] return [l:wuc, '']
252 252 else else
253 253 return [l:varname, ''] return [l:varname, '']
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vim-qthelp

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vim-qthelp

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master