mirror of
https://github.com/amix/vimrc
synced 2025-06-29 02:55:01 +08:00
Updated plugins
This commit is contained in:
@ -58,7 +58,7 @@ function! go#complete#Package(ArgLead, CmdLine, CursorPos)
|
||||
if executable('go')
|
||||
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
|
||||
if v:shell_error
|
||||
echomsg '\'go env GOROOT\' failed'
|
||||
echomsg '''go env GOROOT'' failed'
|
||||
endif
|
||||
else
|
||||
let goroot = $GOROOT
|
||||
|
@ -9,9 +9,11 @@ if exists("b:did_ftplugin")
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal formatoptions-=t
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||
setlocal commentstring=//\ %s
|
||||
|
||||
let b:undo_ftplugin = "setl com< cms<"
|
||||
let b:undo_ftplugin = "setl fo< com< cms<"
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
|
@ -24,6 +24,18 @@ if exists("*GoIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" The shiftwidth() function is relatively new.
|
||||
" Don't require it to exist.
|
||||
if exists('*shiftwidth')
|
||||
func s:sw()
|
||||
return shiftwidth()
|
||||
endfunc
|
||||
else
|
||||
func s:sw()
|
||||
return &shiftwidth
|
||||
endfunc
|
||||
endif
|
||||
|
||||
function! GoIndent(lnum)
|
||||
let prevlnum = prevnonblank(a:lnum-1)
|
||||
if prevlnum == 0
|
||||
@ -40,17 +52,17 @@ function! GoIndent(lnum)
|
||||
|
||||
if prevl =~ '[({]\s*$'
|
||||
" previous line opened a block
|
||||
let ind += &sw
|
||||
let ind += s:sw()
|
||||
endif
|
||||
if prevl =~# '^\s*\(case .*\|default\):$'
|
||||
" previous line is part of a switch statement
|
||||
let ind += &sw
|
||||
let ind += s:sw()
|
||||
endif
|
||||
" TODO: handle if the previous line is a label.
|
||||
|
||||
if thisl =~ '^\s*[)}]'
|
||||
" this line closed a block
|
||||
let ind -= &sw
|
||||
let ind -= s:sw()
|
||||
endif
|
||||
|
||||
" Colons are tricky.
|
||||
@ -58,7 +70,7 @@ function! GoIndent(lnum)
|
||||
" 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
|
||||
let ind -= s:sw()
|
||||
endif
|
||||
|
||||
return ind
|
||||
|
@ -5,9 +5,11 @@ To use all the Vim plugins, add these lines to your $HOME/.vimrc.
|
||||
|
||||
" Some Linux distributions set filetype in /etc/vimrc.
|
||||
" Clear filetype flags before changing runtimepath to force Vim to reload them.
|
||||
filetype off
|
||||
filetype plugin indent off
|
||||
set runtimepath+=$GOROOT/misc/vim
|
||||
if exists("g:did_load_filetypes")
|
||||
filetype off
|
||||
filetype plugin indent off
|
||||
endif
|
||||
set runtimepath+=$GOROOT/misc/vim " replace $GOROOT with the output of: go env GOROOT
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
|
||||
|
Reference in New Issue
Block a user