-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
folding improvements #1428
folding improvements #1428
Changes from 4 commits
f3f3c07
726e530
07206dc
894fea8
5bcafad
18cd08e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,8 @@ let s:fold_block = 1 | |
let s:fold_import = 1 | ||
let s:fold_varconst = 1 | ||
let s:fold_package_comment = 1 | ||
let s:fold_comment = 1 | ||
|
||
if exists("g:go_fold_enable") | ||
if index(g:go_fold_enable, 'block') == -1 | ||
let s:fold_block = 0 | ||
|
@@ -103,6 +105,9 @@ if exists("g:go_fold_enable") | |
if index(g:go_fold_enable, 'varconst') == -1 | ||
let s:fold_varconst = 0 | ||
endif | ||
if index(g:go_fold_enable, 'comment') == -1 | ||
let s:fold_comment = 0 | ||
endif | ||
if index(g:go_fold_enable, 'package_comment') == -1 | ||
let s:fold_package_comment = 0 | ||
endif | ||
|
@@ -159,6 +164,7 @@ hi def link goPredefinedIdentifiers goBoolean | |
" Comments; their contents | ||
syn keyword goTodo contained TODO FIXME XXX BUG | ||
syn cluster goCommentGroup contains=goTodo | ||
|
||
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell | ||
syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell | ||
|
||
|
@@ -240,6 +246,13 @@ else | |
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar | ||
endif | ||
|
||
if s:fold_comment | ||
" changed this to comments instead of declaration_comment | ||
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell fold | ||
syn match goComment "\v(^\s*//.*\n)+" contains=goGenerate,@goCommentGroup,@Spell fold | ||
endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good and works well in my testing, but could you move this next to the regular Would also be nice if you could remove the extra blank lines you added :-) |
||
|
||
|
||
" Single-line var, const, and import. | ||
syn match goSingleDecl /\(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst | ||
|
||
|
@@ -452,4 +465,5 @@ syn sync minlines=500 | |
|
||
let b:current_syntax = "go" | ||
|
||
" vim: sw=2 ts=2 et | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want to keep the modeline; you you add this back please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, sry I guess I removed modeline within my tests down there and didn't realize, I was also trying to create a FoldText() function so in the cases we fold the declarations the text would contain the subject (func/type/const/var), I made the suggested changes |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment can be removed?