Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
45b830ed
Commit
45b830ed
authored
Oct 03, 2013
by
Yasuhiro Matsumoto
Committed by
David Symonds
Oct 03, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc/vim: Autocompletion for :Godoc command
R=golang-dev, dsymonds CC=golang-dev
https://golang.org/cl/14259043
parent
94a6511b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
complete.vim
misc/vim/autoload/go/complete.vim
+20
-2
No files found.
misc/vim/autoload/go/complete.vim
View file @
45b830ed
...
...
@@ -28,13 +28,31 @@ if len(s:goarch) == 0
endif
endif
function
!
go
#complete#PackageMembers
(
package
,
member
)
silent
!
let
content
=
system
(
'godoc '
.
a:package
)
if
v
:
shell_error
||
!
len
(
content
)
return
[]
endif
let
lines
=
filter
(
split
(
content
,
"\n"
),
"v:val !~ '^\\s\\+$'"
)
try
let
mx1
=
'^\s\+\(\S+\)\s\+=\s\+.*'
let
mx2
=
'^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*'
let
candidates
=
\
map
(
filter
(
copy
(
lines
),
'v:val =~ mx1'
),
'substitute(v:val, mx1, "\\1", "")'
)
\
+
map
(
filter
(
copy
(
lines
),
'v:val =~ mx2'
),
'substitute(v:val, mx2, "\\1", "")'
)
return
filter
(
candidates
,
'!stridx(v:val, a:member)'
)
catch
return
[]
endtry
endfunction
function
!
go
#complete#Package
(
ArgLead
,
CmdLine
,
CursorPos
)
let
dirs
=
[]
let
words
=
split
(
a:CmdLine
,
'\s\+'
,
1
)
if
len
(
words
)
>
2
"
TODO
Complete package members
return
[]
" Complete package members
return
go
#complete#PackageMembers
(
words
[
1
],
words
[
2
])
endif
if
executable
(
'go'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment