forked from ma6174/vim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ma6174
committed
Mar 17, 2013
1 parent
640abdb
commit 847bbde
Showing
39 changed files
with
1,258 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
" Copyright 2011 The Go Authors. All rights reserved. | ||
" Use of this source code is governed by a BSD-style | ||
" license that can be found in the LICENSE file. | ||
" | ||
" This file provides a utility function that performs auto-completion of | ||
" package names, for use by other commands. | ||
|
||
let s:goos = $GOOS | ||
let s:goarch = $GOARCH | ||
|
||
if len(s:goos) == 0 | ||
if exists('g:golang_goos') | ||
let s:goos = g:golang_goos | ||
elseif has('win32') || has('win64') | ||
let s:goos = 'windows' | ||
elseif has('macunix') | ||
let s:goos = 'darwin' | ||
else | ||
let s:goos = '*' | ||
endif | ||
endif | ||
|
||
if len(s:goarch) == 0 | ||
if exists('g:golang_goarch') | ||
let s:goarch = g:golang_goarch | ||
else | ||
let s:goarch = '*' | ||
endif | ||
endif | ||
|
||
function! go#complete#Package(ArgLead, CmdLine, CursorPos) | ||
let goroot = $GOROOT | ||
if len(goroot) == 0 | ||
" should not occur. | ||
return [] | ||
endif | ||
let ret = {} | ||
let root = expand(goroot.'/pkg/'.s:goos.'_'.s:goarch) | ||
for i in split(globpath(root, a:ArgLead.'*'), "\n") | ||
if isdirectory(i) | ||
let i .= '/' | ||
elseif i !~ '\.a$' | ||
continue | ||
endif | ||
let i = substitute(substitute(i[len(root)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g') | ||
let ret[i] = i | ||
endfor | ||
return sort(keys(ret)) | ||
endfunction |
Large diffs are not rendered by default.
Oops, something went wrong.
Submodule Auto-Pairs
added at
c5b4f9
Submodule CaptureClipboard
added at
f76094
Submodule FuzzyFinder
added at
b9f165
Submodule L9
added at
c822b0
Submodule PHP-correct-Indenting
added at
0b9c64
Submodule SQLComplete.vim
added at
f30188
Submodule command-t
added at
07087e
Submodule ctrlp-modified.vim
added at
175c0d
Submodule last_edit_marker.vim
added at
6e6b33
Submodule php.vim
added at
66a448
Submodule php.vim-for-php5
added at
59dced
Submodule php_funcinfo.vim
added at
f8229c
Submodule phpcomplete.vim
added at
616e13
Submodule phpcs.vim
added at
f34406
Submodule python-imports.vim
added at
aca7be
Submodule sparkup
added at
5041a1
Submodule vim-easymotion
added at
667a66
Submodule vim-fugitive
added at
6f380f
Submodule vundle
added at
c9d971
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
" We take care to preserve the user's fileencodings and fileformats, | ||
" because those settings are global (not buffer local), yet we want | ||
" to override them for loading Go files, which are defined to be UTF-8. | ||
let s:current_fileformats = '' | ||
let s:current_fileencodings = '' | ||
|
||
" define fileencodings to open as utf-8 encoding even if it's ascii. | ||
function! s:gofiletype_pre() | ||
let s:current_fileformats = &g:fileformats | ||
let s:current_fileencodings = &g:fileencodings | ||
set fileencodings=utf-8 fileformats=unix | ||
setlocal filetype=go | ||
endfunction | ||
|
||
" restore fileencodings as others | ||
function! s:gofiletype_post() | ||
let &g:fileformats = s:current_fileformats | ||
let &g:fileencodings = s:current_fileencodings | ||
endfunction | ||
|
||
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix | ||
au BufRead *.go call s:gofiletype_pre() | ||
au BufReadPost *.go call s:gofiletype_post() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
" Copyright 2011 The Go Authors. All rights reserved. | ||
" Use of this source code is governed by a BSD-style | ||
" license that can be found in the LICENSE file. | ||
" | ||
" fmt.vim: Vim command to format Go files with gofmt. | ||
" | ||
" This filetype plugin add a new commands for go buffers: | ||
" | ||
" :Fmt | ||
" | ||
" Filter the current Go buffer through gofmt. | ||
" It tries to preserve cursor position and avoids | ||
" replacing the buffer with stderr output. | ||
" | ||
|
||
command! -buffer Fmt call s:GoFormat() | ||
|
||
function! s:GoFormat() | ||
let view = winsaveview() | ||
silent %!gofmt | ||
if v:shell_error | ||
let errors = [] | ||
for line in getline(1, line('$')) | ||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') | ||
if !empty(tokens) | ||
call add(errors, {"filename": @%, | ||
\"lnum": tokens[2], | ||
\"col": tokens[3], | ||
\"text": tokens[4]}) | ||
endif | ||
endfor | ||
if empty(errors) | ||
% | " Couldn't detect gofmt error format, output errors | ||
endif | ||
undo | ||
if !empty(errors) | ||
call setloclist(0, errors, 'r') | ||
endif | ||
echohl Error | echomsg "Gofmt returned error" | echohl None | ||
endif | ||
call winrestview(view) | ||
endfunction | ||
|
||
" vim:ts=4:sw=4:et |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
" Copyright 2011 The Go Authors. All rights reserved. | ||
" Use of this source code is governed by a BSD-style | ||
" license that can be found in the LICENSE file. | ||
" | ||
" godoc.vim: Vim command to see godoc. | ||
|
||
if exists("b:did_ftplugin") | ||
finish | ||
endif | ||
|
||
silent! nmap <buffer> <silent> K <Plug>(godoc-keyword) | ||
" vim:ts=4:sw=4:et |
Oops, something went wrong.