Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing go files all around

Adding as submodule

Removing autoclose from plugin folder
Adding as submodule
  • Loading branch information...
commit cabb65afc70c9b2f584133c0ccceff414893eecf 1 parent a0d7a5b
@akitaonrails authored
View
6 .gitmodules
@@ -158,3 +158,9 @@
[submodule "bundle/vim-capybara"]
path = bundle/vim-capybara
url = git://github.com/asux/vim-capybara.git
+[submodule "bundle/vim-autoclose"]
+ path = bundle/vim-autoclose
+ url = git://github.com/Townk/vim-autoclose.git
+[submodule "bundle/vim-golang"]
+ path = bundle/vim-golang
+ url = git://github.com/jnwhiteh/vim-golang.git
View
49 autoload/go/complete.vim
@@ -1,49 +0,0 @@
-" 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
1  bundle/vim-autoclose
@@ -0,0 +1 @@
+Subproject commit ac2ca9ba4de085b0c2849363affa81adc1a85f74
1  bundle/vim-golang
@@ -0,0 +1 @@
+Subproject commit b2f214ce412d95f50371406ac53b3a37f1789e9b
View
1  ftdetect/gofiletype.vim
@@ -1 +0,0 @@
-au BufRead,BufNewFile *.go set filetype=go fileencoding=utf-8 fileencodings=utf-8
View
44 ftplugin/go/fmt.vim
@@ -1,44 +0,0 @@
-" 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
View
13 ftplugin/go/godoc.vim
@@ -1,13 +0,0 @@
-" 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
View
201 ftplugin/go/import.vim
@@ -1,201 +0,0 @@
-" 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.
-"
-" import.vim: Vim commands to import/drop Go packages.
-"
-" This filetype plugin adds three new commands for go buffers:
-"
-" :Import {path}
-"
-" Import ensures that the provided package {path} is imported
-" in the current Go buffer, using proper style and ordering.
-" If {path} is already being imported, an error will be
-" displayed and the buffer will be untouched.
-"
-" :ImportAs {localname} {path}
-"
-" Same as Import, but uses a custom local name for the package.
-"
-" :Drop {path}
-"
-" Remove the import line for the provided package {path}, if
-" present in the current Go buffer. If {path} is not being
-" imported, an error will be displayed and the buffer will be
-" untouched.
-"
-" In addition to these commands, there are also two shortcuts mapped:
-"
-" \f - Runs :Import fmt
-" \F - Runs :Drop fmt
-"
-" The backslash is the default maplocalleader, so it is possible that
-" your vim is set to use a different character (:help maplocalleader).
-"
-if exists("b:did_ftplugin")
- finish
-endif
-
-command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
-command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
-command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
-map <buffer> <LocalLeader>f :Import fmt<CR>
-map <buffer> <LocalLeader>F :Drop fmt<CR>
-
-function! s:SwitchImport(enabled, localname, path)
- let view = winsaveview()
- let path = a:path
-
- " Quotes are not necessary, so remove them if provided.
- if path[0] == '"'
- let path = strpart(path, 1)
- endif
- if path[len(path)-1] == '"'
- let path = strpart(path, 0, len(path) - 1)
- endif
- if path == ''
- call s:Error('Import path not provided')
- return
- endif
-
- let qpath = '"' . path . '"'
- if a:localname != ''
- let qlocalpath = a:localname . ' ' . qpath
- else
- let qlocalpath = qpath
- endif
- let indentstr = 0
- let packageline = -1 " Position of package name statement
- let appendline = -1 " Position to introduce new import
- let deleteline = -1 " Position of line with existing import
- let linesdelta = 0 " Lines added/removed
-
- " Find proper place to add/remove import.
- let line = 0
- while line <= line('$')
- let linestr = getline(line)
-
- if linestr =~# '^package\s'
- let packageline = line
- let appendline = line
-
- elseif linestr =~# '^import\s\+('
- let appendstr = qlocalpath
- let indentstr = 1
- let appendline = line
- while line <= line("$")
- let line = line + 1
- let linestr = getline(line)
- let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)')
- if empty(m)
- continue
- endif
- if m[1] == ')'
- break
- endif
- if a:localname != '' && m[3] != ''
- let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath)
- endif
- let appendstr = m[2] . qlocalpath
- let indentstr = 0
- if m[4] == path
- let appendline = -1
- let deleteline = line
- break
- elseif m[4] < path
- let appendline = line
- endif
- endwhile
- break
-
- elseif linestr =~# '^import '
- if appendline == packageline
- let appendstr = 'import ' . qlocalpath
- let appendline = line - 1
- endif
- let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"')
- if !empty(m)
- if m[3] == path
- let appendline = -1
- let deleteline = line
- break
- endif
- if m[3] < path
- let appendline = line
- endif
- if a:localname != '' && m[2] != ''
- let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath)
- endif
- let appendstr = 'import' . m[1] . qlocalpath
- endif
-
- elseif linestr =~# '^\(var\|const\|type\|func\)\>'
- break
-
- endif
- let line = line + 1
- endwhile
-
- " Append or remove the package import, as requested.
- if a:enabled
- if deleteline != -1
- call s:Error(qpath . ' already being imported')
- elseif appendline == -1
- call s:Error('No package line found')
- else
- if appendline == packageline
- call append(appendline + 0, '')
- call append(appendline + 1, 'import (')
- call append(appendline + 2, ')')
- let appendline += 2
- let linesdelta += 3
- let appendstr = qlocalpath
- let indentstr = 1
- endif
- call append(appendline, appendstr)
- execute appendline + 1
- if indentstr
- execute 'normal >>'
- endif
- let linesdelta += 1
- endif
- else
- if deleteline == -1
- call s:Error(qpath . ' not being imported')
- else
- execute deleteline . 'd'
- let linesdelta -= 1
-
- if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)'
- " Delete empty import block
- let deleteline -= 1
- execute deleteline . "d"
- execute deleteline . "d"
- let linesdelta -= 2
- endif
-
- if getline(deleteline) == '' && getline(deleteline - 1) == ''
- " Delete spacing for removed line too.
- execute deleteline . "d"
- let linesdelta -= 1
- endif
- endif
- endif
-
- " Adjust view for any changes.
- let view.lnum += linesdelta
- let view.topline += linesdelta
- if view.topline < 0
- let view.topline = 0
- endif
-
- " Put buffer back where it was.
- call winrestview(view)
-
-endfunction
-
-function! s:Error(s)
- echohl Error | echo a:s | echohl None
-endfunction
-
-" vim:ts=4:sw=4:et
View
65 indent/go.vim
@@ -1,65 +0,0 @@
-" 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.
-"
-" indent/go.vim: Vim indent file for Go.
-"
-" TODO:
-" - function invocations split across lines
-" - general line splits (line ends in an operator)
-
-if exists("b:did_indent")
- finish
-endif
-let b:did_indent = 1
-
-" C indentation is too far off useful, mainly due to Go's := operator.
-" Let's just define our own.
-setlocal nolisp
-setlocal autoindent
-setlocal indentexpr=GoIndent(v:lnum)
-setlocal indentkeys+=<:>,0=},0=)
-
-if exists("*GoIndent")
- finish
-endif
-
-function! GoIndent(lnum)
- let prevlnum = prevnonblank(a:lnum-1)
- if prevlnum == 0
- " top of file
- return 0
- endif
-
- " grab the previous and current line, stripping comments.
- let prevl = substitute(getline(prevlnum), '//.*$', '', '')
- let thisl = substitute(getline(a:lnum), '//.*$', '', '')
- let previ = indent(prevlnum)
-
- let ind = previ
-
- if prevl =~ '[({]\s*$'
- " previous line opened a block
- let ind += &sw
- endif
- if prevl =~# '^\s*\(case .*\|default\):$'
- " previous line is part of a switch statement
- let ind += &sw
- endif
- " TODO: handle if the previous line is a label.
-
- if thisl =~ '^\s*[)}]'
- " this line closed a block
- let ind -= &sw
- endif
-
- " Colons are tricky.
- " We want to outdent if it's part of a switch ("case foo:" or "default:").
- " We ignore trying to deal with jump labels because (a) they're rare, and
- " (b) they're hard to disambiguate from a composite literal key.
- if thisl =~# '^\s*\(case .*\|default\):$'
- let ind -= &sw
- endif
-
- return ind
-endfunction
View
241 plugin/autoclose.vim
@@ -1,241 +0,0 @@
-" File: autoclose.vim
-" Author: Karl Guertin <grayrest@gr.ayre.st>
-" Version: 1.2
-" Last Modified: June 18, 2009
-" Description: AutoClose, closes what's opened.
-"
-" This plugin closes opened parenthesis, braces, brackets, quotes as you
-" type them. As of 1.1, if you type the open brace twice ({{), the closing
-" brace will be pushed down to a new line.
-"
-" You can enable or disable this plugin by typing \a (or <Leader>a if you
-" changed your Leader char). You can define your own mapping and will need
-" to do so if you have something else mapped to \a since this plugin won't
-" clobber your mapping. Here's how to map \x:
-"
-" nmap <Leader>x <Plug>ToggleAutoCloseMappings
-"
-" You'll also probably want to know you can type <C-V> (<C-Q> if mswin is
-" set) and the next character you type doesn't have mappings applied. This
-" is useful when you want to insert only an opening paren or something.
-"
-" NOTE: If you're using this on a terminal and your arrow keys are broken,
-" be sure to :set ttimeout and :set ttimeoutlen=100
-"
-" Version Changes: --------------------------------------------------{{{2
-" 1.2 -- Fixed some edge cases where double the closing characters are
-" entered when exiting insert mode.
-" Finally (!) reproduced the arrow keys problem other people were
-" running into and fixed.
-" Typing a closing character will now behave consistently (jump
-" out) regardless of the plugin's internal state.
-"
-" As a part of the close fix, I've opted to not try tracking the
-" position of the closing characters through all the things that
-" could be done with them, so arrowing/jumping around and not
-" winding up back where you started will cause the input to not be
-" repeatable.
-" June 18, 2009
-" 1.1.2 -- Fixed a mapping typo and caught a double brace problem,
-" September 20, 2007
-" 1.1.1 -- Missed a bug in 1.1, September 19, 2007
-" 1.1 -- When not inserting at the end, previous version would eat chars
-" at end of line, added double open->newline, September 19, 2007
-" 1.0.1 -- Cruft from other parts of the mapping, knew I shouldn't have
-" released the first as 1.0, April 3, 2007
-
-" Setup -----------------------------------------------------{{{2
-if exists('g:autoclose_loaded') || &cp
- finish
-endif
-
-
-let g:autoclose_loaded = 1
-let s:cotstate = &completeopt
-
-if !exists('g:autoclose_on')
- let g:autoclose_on = 1
-endif
-
-" (Toggle) Mappings -----------------------------{{{1
-"
-nmap <Plug>ToggleAutoCloseMappings :call <SID>ToggleAutoCloseMappings()<CR>
-if (!hasmapto( '<Plug>ToggleAutoCloseMappings', 'n' ))
- nmap <unique> <Leader>a <Plug>ToggleAutoCloseMappings
-endif
-fun <SID>ToggleAutoCloseMappings() " --- {{{2
- if g:autoclose_on
- iunmap "
- iunmap '
- iunmap (
- iunmap )
- iunmap [
- iunmap ]
- iunmap {
- iunmap }
- iunmap <BS>
- iunmap <C-h>
- iunmap <Esc>
- let g:autoclose_on = 0
- echo "AutoClose Off"
- else
- inoremap <silent> " <C-R>=<SID>QuoteDelim('"')<CR>
- inoremap <silent> ' <C-R>=match(getline('.')[col('.') - 2],'\w') == 0 && getline('.')[col('.')-1] != "'" ? "'" : <SID>QuoteDelim("'")<CR>
- inoremap <silent> ( (<C-R>=<SID>CloseStackPush(')')<CR>
- inoremap ) <C-R>=<SID>CloseStackPop(')')<CR>
- inoremap <silent> [ [<C-R>=<SID>CloseStackPush(']')<CR>
- inoremap <silent> ] <C-R>=<SID>CloseStackPop(']')<CR>
- "inoremap <silent> { {<C-R>=<SID>CloseStackPush('}')<CR>
- inoremap <silent> { <C-R>=<SID>OpenSpecial('{','}')<CR>
- inoremap <silent> } <C-R>=<SID>CloseStackPop('}')<CR>
- inoremap <silent> <BS> <C-R>=<SID>OpenCloseBackspace()<CR>
- inoremap <silent> <C-h> <C-R>=<SID>OpenCloseBackspace()<CR>
- inoremap <silent> <Esc> <C-R>=<SID>CloseStackPop('')<CR><Esc>
- inoremap <silent> <C-[> <C-R>=<SID>CloseStackPop('')<CR><C-[>
- "the following simply creates an ambiguous mapping so vim fully
- "processes the escape sequence for terminal keys, see 'ttimeout' for a
- "rough explanation, this just forces it to work
- if &term[:4] == "xterm"
- inoremap <silent> <C-[>OC <RIGHT>
- endif
- let g:autoclose_on = 1
- if a:0 == 0
- "this if is so this message doesn't show up at load
- echo "AutoClose On"
- endif
- endif
-endf
-let s:closeStack = []
-
-" AutoClose Utilities -----------------------------------------{{{1
-function <SID>OpenSpecial(ochar,cchar) " ---{{{2
- let line = getline('.')
- let col = col('.') - 2
- "echom string(col).':'.line[:(col)].'|'.line[(col+1):]
- if a:ochar == line[(col)] && a:cchar == line[(col+1)] "&& strlen(line) - (col) == 2
- "echom string(s:closeStack)
- while len(s:closeStack) > 0
- call remove(s:closeStack, 0)
- endwhile
- return "\<esc>a\<CR>;\<CR>".a:cchar."\<esc>\"_xk$\"_xa"
- endif
- return a:ochar.<SID>CloseStackPush(a:cchar)
-endfunction
-
-function <SID>CloseStackPush(char) " ---{{{2
- "echom "push"
- let line = getline('.')
- let col = col('.')-2
- if (col) < 0
- call setline('.',a:char.line)
- else
- "echom string(col).':'.line[:(col)].'|'.line[(col+1):]
- call setline('.',line[:(col)].a:char.line[(col+1):])
- endif
- call insert(s:closeStack, a:char)
- "echom join(s:closeStack,'').' -- '.a:char
- return ''
-endf
-
-function <SID>JumpOut(char) " ----------{{{2
- let column = col('.') - 1
- let line = getline('.')
- let mcol = match(line[column :], a:char)
- if a:char != '' && mcol >= 0
- "Yeah, this is ugly but vim actually requires each to be special
- "cased to avoid screen flashes/not doing the right thing.
- echom len(line).' '.(column+mcol)
- if line[column] == a:char
- return "\<Right>"
- elseif column+mcol == len(line)-1
- return "\<C-O>A"
- else
- return "\<C-O>f".a:char."\<Right>"
- endif
- else
- return a:char
- endif
-endf
-function <SID>CloseStackPop(char) " ---{{{2
- "echom "pop"
- if(a:char == '')
- pclose
- endif
- if len(s:closeStack) == 0
- return <SID>JumpOut(a:char)
- endif
- let column = col('.') - 1
- let line = getline('.')
- let popped = ''
- let lastpop = ''
- "echom join(s:closeStack,'').' || '.lastpop
- while len(s:closeStack) > 0 && ((lastpop == '' && popped == '') || lastpop != a:char)
- let lastpop = remove(s:closeStack,0)
- let popped .= lastpop
- "echom join(s:closeStack,'').' || '.lastpop.' || '.popped
- endwhile
- "echom ' --> '.popped
- if line[column : column+strlen(popped)-1] != popped
- return <SID>JumpOut('')
- endif
- if column > 0
- call setline('.',line[:column-1].line[(column+strlen(popped)):])
- else
- call setline('.','')
- endif
- return popped
-endf
-
-function <SID>QuoteDelim(char) " ---{{{2
- let line = getline('.')
- let col = col('.')
- if line[col - 2] == "\\"
- "Inserting a quoted quotation mark into the string
- return a:char
- elseif line[col - 1] == a:char
- "Escaping out of the string
- return "\<C-R>=".s:SID()."CloseStackPop(\"\\".a:char."\")\<CR>"
- else
- "Starting a string
- return a:char."\<C-R>=".s:SID()."CloseStackPush(\"\\".a:char."\")\<CR>"
- endif
-endf
-
-" The strings returned from QuoteDelim aren't in scope for <SID>, so I
-" have to fake it using this function (from the Vim help, but tweaked)
-function s:SID()
- return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID$')
-endfun
-
-function <SID>OpenCloseBackspace() " ---{{{2
- "if pumvisible()
- " pclose
- " call <SID>StopOmni()
- " return "\<C-E>"
- "else
- let curline = getline('.')
- let curpos = col('.')
- let curletter = curline[curpos-1]
- let prevletter = curline[curpos-2]
- if (prevletter == '"' && curletter == '"') ||
-\ (prevletter == "'" && curletter == "'") ||
-\ (prevletter == "(" && curletter == ")") ||
-\ (prevletter == "{" && curletter == "}") ||
-\ (prevletter == "[" && curletter == "]")
- if len(s:closeStack) > 0
- call remove(s:closeStack,0)
- endif
- return "\<Delete>\<BS>"
- else
- return "\<BS>"
- endif
- "endif
-endf
-
-" Initialization ----------------------------------------{{{1
-if g:autoclose_on
- let g:autoclose_on = 0
- silent call <SID>ToggleAutoCloseMappings()
-endif
-" vim: set ft=vim ff=unix et sw=4 ts=4 :
-" vim600: set foldmethod=marker foldmarker={{{,}}} foldlevel=1 :
View
85 plugin/godoc.vim
@@ -1,85 +0,0 @@
-" 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("g:loaded_godoc")
- finish
-endif
-let g:loaded_godoc = 1
-
-let s:buf_nr = -1
-let s:last_word = ''
-
-function! s:GodocView()
- if !bufexists(s:buf_nr)
- leftabove new
- file `="[Godoc]"`
- let s:buf_nr = bufnr('%')
- elseif bufwinnr(s:buf_nr) == -1
- leftabove split
- execute s:buf_nr . 'buffer'
- delete _
- elseif bufwinnr(s:buf_nr) != bufwinnr('%')
- execute bufwinnr(s:buf_nr) . 'wincmd w'
- endif
-
- setlocal filetype=godoc
- setlocal bufhidden=delete
- setlocal buftype=nofile
- setlocal noswapfile
- setlocal nobuflisted
- setlocal modifiable
- setlocal nocursorline
- setlocal nocursorcolumn
- setlocal iskeyword+=:
- setlocal iskeyword-=-
-
- nnoremap <buffer> <silent> K :Godoc<cr>
-
- au BufHidden <buffer> call let <SID>buf_nr = -1
-endfunction
-
-function! s:GodocWord(word)
- let word = a:word
- silent! let content = system('godoc ' . word)
- if v:shell_error || !len(content)
- if len(s:last_word)
- silent! let content = system('godoc ' . s:last_word.'/'.word)
- if v:shell_error || !len(content)
- echo 'No documentation found for "' . word . '".'
- return
- endif
- let word = s:last_word.'/'.word
- else
- echo 'No documentation found for "' . word . '".'
- return
- endif
- endif
- let s:last_word = word
- silent! call s:GodocView()
- setlocal modifiable
- silent! %d _
- silent! put! =content
- silent! normal gg
- setlocal nomodifiable
- setfiletype godoc
-endfunction
-
-function! s:Godoc(...)
- let word = join(a:000, ' ')
- if !len(word)
- let word = expand('<cword>')
- endif
- let word = substitute(word, '[^a-zA-Z0-9\/]', '', 'g')
- if !len(word)
- return
- endif
- call s:GodocWord(word)
-endfunction
-
-command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc(<q-args>)
-nnoremap <silent> <Plug>(godoc-keyword) :<C-u>call <SID>Godoc('')<CR>
-
-" vim:ts=4:sw=4:et
Please sign in to comment.
Something went wrong with that request. Please try again.