Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
d7eacee6
Commit
d7eacee6
authored
Mar 08, 2011
by
Ross Light
Committed by
Andrew Gerrand
Mar 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc/vim: Add indent script for Vim
R=adg CC=golang-dev
https://golang.org/cl/4258041
parent
2a36f9df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
misc/vim/indent/go.vim
misc/vim/indent/go.vim
+30
-0
misc/vim/readme.txt
misc/vim/readme.txt
+13
-0
No files found.
misc/vim/indent/go.vim
0 → 100644
View file @
d7eacee6
" 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.
"
if
exists
(
"b:did_indent"
)
finish
endif
let
b:did_indent
=
1
" C indentation is mostly correct
setlocal
cindent
" Options set:
" +0 -- Don't indent continuation lines (because Go doesn't use semicolons
" much)
" L0 -- Don't move jump labels (NOTE: this isn't correct when working with
" gofmt, but it does keep struct literals properly indented.)
" :0 -- Align case labels with switch statement
" l1 -- Always align case body relative to case labels
" J1 -- Indent JSON-style objects (properly indents struct-literals)
" (0, Ws -- Indent lines inside of unclosed parentheses by one shiftwidth
" m1 -- Align closing parenthesis line with first non-blank of matching
" parenthesis line
"
" Known issue: Trying to do a multi-line struct literal in a short variable
" declaration will not indent properly.
setlocal
cinoptions
+=+
0
,
L0
,:
0
,
l1
,
J1
,(
0
,
Ws
,
m1
misc/vim/readme.txt
View file @
d7eacee6
...
...
@@ -35,3 +35,16 @@ To install one of the available filetype plugins for Go:
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
filetype plugin on
Vim indentation plugin for Go
=============================
To install automatic indentation for Go:
1. Same as 1 above.
2. Copy or link indent/go.vim to the indent directory underneath your vim
runtime directory (normally $HOME/.vim/indent).
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
filetype indent on
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment