diff --git a/.bash_profile b/.bash_profile index 4c1b758..7cdc599 100644 --- a/.bash_profile +++ b/.bash_profile @@ -8,7 +8,7 @@ # for ssh logins, install and configure the libpam-umask package. #umask 022 -PATH=/$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/$HOME/.gem/ruby/1.9.1/bin:$PATH; export PATH +PATH=/$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/$HOME/.gem/ruby/1.9.1/bin:/$HOME/.cabal/bin:/usr/lib/go/bin:$PATH; export PATH case `uname` in SunOS) UCB_PATH=/usr/sww/lang/acl:/usr/sww/lang/jdk-1.5.0/bin:/usr/openwin/bin:/usr/dt/bin:/usr/sww/opt/java/bin:/usr/sww/bin:/share/b/grading/bin:/share/b/grading/sbin:/share/b/runas/sun4u:/share/b/bin:/home/aa/projects/scheme/bin:/usr/ucb:/usr/ccs/bin:/usr/sfw/bin; export UCB_PATH diff --git a/.puppet/go.pp b/.puppet/go.pp new file mode 100644 index 0000000..85eff8a --- /dev/null +++ b/.puppet/go.pp @@ -0,0 +1,10 @@ +package { + "golang": + ensure => "installed" +} + +exec { + "go": + command => "go get -u github.com/nsf/gocode", + path => "/usr/bin", +} diff --git a/.vim/bundle/gocode/autoload/gocomplete.vim b/.vim/bundle/gocode/autoload/gocomplete.vim new file mode 100644 index 0000000..997b53a --- /dev/null +++ b/.vim/bundle/gocode/autoload/gocomplete.vim @@ -0,0 +1,73 @@ +if exists('g:loaded_gocode') + finish +endif +let g:loaded_gocode = 1 + +fu! s:gocodeCurrentBuffer() + let buf = getline(1, '$') + if &l:fileformat == 'dos' + " XXX: line2byte() depend on 'fileformat' option. + " so if fileformat is 'dos', 'buf' must include '\r'. + let buf = map(buf, 'v:val."\r"') + endif + let file = tempname() + call writefile(buf, file) + return file +endf + +fu! s:system(str, ...) + return (a:0 == 0 ? system(a:str) : system(a:str, join(a:000))) +endf + +fu! s:gocodeShellescape(arg) + try + let ssl_save = &shellslash + set noshellslash + return shellescape(a:arg) + finally + let &shellslash = ssl_save + endtry +endf + +fu! s:gocodeCommand(cmd, preargs, args) + for i in range(0, len(a:args) - 1) + let a:args[i] = s:gocodeShellescape(a:args[i]) + endfor + for i in range(0, len(a:preargs) - 1) + let a:preargs[i] = s:gocodeShellescape(a:preargs[i]) + endfor + let result = s:system(printf('gocode %s %s %s', join(a:preargs), a:cmd, join(a:args))) + if v:shell_error != 0 + return "[\"0\", []]" + else + return result + endif +endf + +fu! s:gocodeCurrentBufferOpt(filename) + return '-in=' . a:filename +endf + +fu! s:gocodeCursor() + return printf('%d', line2byte(line('.')) + (col('.')-2)) +endf + +fu! s:gocodeAutocomplete() + let filename = s:gocodeCurrentBuffer() + let result = s:gocodeCommand('autocomplete', + \ [s:gocodeCurrentBufferOpt(filename), '-f=vim'], + \ [expand('%:p'), s:gocodeCursor()]) + call delete(filename) + return result +endf + +fu! gocomplete#Complete(findstart, base) + "findstart = 1 when we need to get the text length + if a:findstart == 1 + execute "silent let g:gocomplete_completions = " . s:gocodeAutocomplete() + return col('.') - g:gocomplete_completions[0] - 1 + "findstart = 0 when we need to return the list of completions + else + return g:gocomplete_completions[1] + endif +endf diff --git a/.vim/bundle/gocode/ftplugin/go.vim b/.vim/bundle/gocode/ftplugin/go.vim new file mode 100644 index 0000000..ffe2b48 --- /dev/null +++ b/.vim/bundle/gocode/ftplugin/go.vim @@ -0,0 +1 @@ +setlocal omnifunc=gocomplete#Complete diff --git a/.vim/bundle/vim-fugitive b/.vim/bundle/vim-fugitive index 618d884..4c7e649 160000 --- a/.vim/bundle/vim-fugitive +++ b/.vim/bundle/vim-fugitive @@ -1 +1 @@ -Subproject commit 618d884562f2b99fa62e3fb90e3531bf17396efa +Subproject commit 4c7e649efba289df0e7e8bb9abfa37f95b28f8ed diff --git a/.zprofile b/.zprofile index adb8ebf..c281576 100644 --- a/.zprofile +++ b/.zprofile @@ -6,7 +6,7 @@ # # remove /usr/games and /usr/X11R6/bin if you want -PATH=$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/$HOME/.gem/ruby/1.9.1/bin:$HOME/.cabal/bin:$PATH; export PATH +PATH=$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/games:/usr/X11R6/bin:/$HOME/.gem/ruby/1.9.1/bin:$HOME/.cabal/bin:/usr/lib/go/bin:$PATH; export PATH case `uname` in SunOS) UCB_PATH=/usr/sww/lang/acl:/usr/sww/lang/jdk-1.5.0/bin:/usr/openwin/bin:/usr/dt/bin:/usr/sww/opt/java/bin:/usr/sww/bin:/share/b/grading/bin:/share/b/grading/sbin:/share/b/runas/sun4u:/share/b/bin:/home/aa/projects/scheme/bin:/usr/ucb:/usr/ccs/bin:/usr/sfw/bin; export UCB_PATH