Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some useful commands #1

Closed
3 of 6 tasks
volgar1x opened this issue Aug 29, 2013 · 9 comments
Closed
3 of 6 tasks

Some useful commands #1

volgar1x opened this issue Aug 29, 2013 · 9 comments

Comments

@volgar1x
Copy link
Owner

Here is somme commands i'd like to implement :

  • GoInstall this command will install the current file's relative package
    example :GoInstall . -> will install current file's package
    example :GoInstall ./childpkg -> will install the current file's child package
    etc
  • GoTest this command will test the current file's relative package (same as above)
  • GoPlay this command will post current file on http://play.golang.org
  • NewGo this command will create a new golang file with a pre-inserted package depending on directory's name where the file is created
  • Edit Import to allow relatives imports
  • want some more ?
@volgar1x
Copy link
Owner Author

CurPkg, RelPkg and Install commands implemented in b814333

@volgar1x
Copy link
Owner Author

GoTest command implemented in 026060b

@volgar1x
Copy link
Owner Author

I'm trying to give completion to GoInstall and GoTest commands. It partially works, here is what I started :

function! GocodeCompletePkg(arg, cmd, index)
    let s:base=DirName(@%)
    let s:dirs=filter(split(globpath(s:base, a:arg.'*'), '\n'), 'isdirectory(v:val)')
    let s:ndirs=len(s:dirs)

    if s:ndirs <= 0
        return ''
    elseif s:ndirs == 1
        let s:matched=s:dirs[0]
    else
        let s:matched=s:dirs[0] " TODO select the next match
    endif

    return substitute(s:matched, s:base.'/', '', '').'/' " add a trailing / to quickly match a child
endfunction

I would like to select the next match, any help will be nicely accepted :)

@graycreate
Copy link

where is the go run?

@volgar1x
Copy link
Owner Author

volgar1x commented Sep 5, 2013

It is not implemented yet.

@graycreate
Copy link

first,your work is great,thx for your contribution.
here,i have a question :if this plugin will auto-install gocode in GOPATH/src/github.com/nsf/gocode. because i don't remember i have installed it there manually. the reason why i chose this plugin is that i can store all this in .vim fold and upload it to github.In this way, i can clone it back easily when i have a new machine.
thanks!

@volgar1x
Copy link
Owner Author

volgar1x commented Sep 5, 2013

It currently does not install automatically nsf/gocode and I do not think that is the plug-in job. You can add, for yourself, in your .vimrc :

system("go install github.com/nsf/gocode")

@graycreate
Copy link

yeah,thx

@volgar1x
Copy link
Owner Author

I don't think I will create new commands anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants