1
0
Fork 0
mirror of synced 2024-12-23 23:33:21 -05:00

Updated plugins

This commit is contained in:
amix 2017-03-14 16:16:07 +01:00
parent 7b7a056680
commit 395c077dcb
15 changed files with 170 additions and 67 deletions

View file

@ -33,7 +33,7 @@ function! s:get_color(group, attr)
endfunction
function! s:set_color(group, attr, color)
let gui = a:color =~ '^#'
let gui = has('gui_running') || has('termguicolors') && &termguicolors
execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color)
endfunction

View file

@ -96,7 +96,9 @@ if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
nmap gc <Plug>Commentary
omap gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine
nmap cgc <Plug>ChangeCommentary
if maparg('c','n') ==# ''
nmap cgc <Plug>ChangeCommentary
endif
nmap gcu <Plug>Commentary<Plug>Commentary
endif

View file

@ -4,6 +4,6 @@ Thanks for improving vim-go! Before you dive in please read the following:
[FAQ](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), it might
have answers for your problem
2. If you add a new feature please don't forget to update the documentation:
[doc/vim-go.txt](doc/vim-go.txt)
[doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt)
3. If it's a breaking change or exceed +100 lines please open an issue first
and describe the changes you want to make.

View file

@ -2,7 +2,11 @@
FEATURES:
* New `:GoAddTags` and `:GoRemoveTags` command based on the tool [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old bugs that were due prior regexp based implementation. For the usage please read the docs and checkout the demo at: https://github.com/fatih/vim-go/pull/1204 [gh-1204]
* New `:GoAddTags` and `:GoRemoveTags` command based on the tool
[gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old
bugs that were due prior regexp based implementation. For the usage please
read the docs and checkout the demo at:
https://github.com/fatih/vim-go/pull/1204 [gh-1204]
* Add new `errl` snippet that expands to [gh-1185]:
```
@ -10,12 +14,16 @@ if err != nil {
log.Fatal(err)
}
```
* New `:GoBuildTags` command to change build tags for tools such as `guru`,
`gorename`, etc ... There is also a new setting called `g:go_build_tags`
[gh-1232]
IMPROVEMENTS:
* Lowercase `<Leader>` in mappings examples for consisten documentation across the README [gh-1192]
* Lowercase `<Leader>` in mappings examples for consistent documentation across the README [gh-1192]
* All of files should be written in utf-8 if the file will be passed to external command. [gh-1184]
* `:GoAddTags` is now able to add options to existing tags with the syntax `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985]
* `:GoAddTags` is now able to add options to existing tags with the syntax
`:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985]
* Document 'noshowmode' requirement for echo_go_info [gh-1197]
* Improve godoc view for vertical splits [gh-1195]
* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193]
@ -23,7 +31,8 @@ IMPROVEMENTS:
BUG FIXES:
* Honor `g:go_echo_command_info` when dispatching builds in neovim [gh-1176]
* Fix `:GoBuild` error in neovim due to invalid jobcontrol handler function signatures (`s:on_stdout`, `s:on_stderr`)[gh-1176]
* Fix `:GoBuild` error in neovim due to invalid jobcontrol handler function
signatures (`s:on_stdout`, `s:on_stderr`)[gh-1176]
* Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176]
* Correctly report the value of the 'g:go_guru_tags' variable [gh-1177]
* Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194]
@ -36,12 +45,20 @@ BUG FIXES:
* Respect go_fmt_options when running goimports [gh-1211]
* Set the filename in the location-list when there is an error with :GoFmt [gh-1199]
BACKWARDS INCOMPATIBILITIES:
* The command `:GoGuruTags` is removed in favour of the new command
`:GoBuildTags`. This command will be used now not just for `guru`, also for
all new commands such as `guru` [gh-1232]
* The setting `g:go_guru_tags` is removed in favour of the new setting
`g:go_build_tags` [gh-1232]
## 1.11 - (January 9, 2017)
FEATURES:
* Travis test integration has been added. Now any file that is added as `<name>_test.vim` will be automatically tested in for every Pull Request (just like how we add tests to Go with `_test.go`). Going forward this will tremendously increase the stability and decrease the maintaince burden of vim-go. [gh-1157]
* Travis test integration has been added. Now any file that is added as `<name>_test.vim` will be automatically tested in for every Pull Request (just like how we add tests to Go with `_test.go`). Going forward this will tremendously increase the stability and decrease the maintenance burden of vim-go. [gh-1157]
* Add new `g:go_updatetime` setting to change the default updatetime (which was hardcoded previously) [gh-1055]
* Add new `g:go_template_use_pkg` setting to enable to use cwd as package name instead of basic template file [gh-1124]

View file

@ -76,6 +76,28 @@ function! go#cmd#Build(bang, ...) abort
endfunction
" BuildTags sets or shows the current build tags used for tools
function! go#cmd#BuildTags(bang, ...) abort
if a:0
if a:0 == 1 && a:1 == '""'
unlet g:go_build_tags
call go#util#EchoSuccess("build tags are cleared")
else
let g:go_build_tags = a:1
call go#util#EchoSuccess("build tags are changed to: ". a:1)
endif
return
endif
if !exists('g:go_build_tags')
call go#util#EchoSuccess("build tags are not set")
else
call go#util#EchoSuccess("current build tags: ". g:go_build_tags)
endif
endfunction
" Run runs the current file (and their dependencies if any) in a new terminal.
function! go#cmd#RunTerm(bang, mode, files) abort
if empty(a:files)

View file

@ -46,8 +46,8 @@ function! s:guru_cmd(args) range abort
endif
" check for any tags
if exists('g:go_guru_tags')
let tags = get(g:, 'go_guru_tags')
if exists('g:go_build_tags')
let tags = get(g:, 'go_build_tags')
call extend(cmd, ["-tags", tags])
let result.tags = tags
endif
@ -619,24 +619,4 @@ function! go#guru#Scope(...) abort
endif
endfunction
function! go#guru#Tags(...) abort
if a:0
if a:0 == 1 && a:1 == '""'
unlet g:go_guru_tags
call go#util#EchoSuccess("guru tags is cleared")
else
let g:go_guru_tags = a:1
call go#util#EchoSuccess("guru tags changed to: ". a:1)
endif
return
endif
if !exists('g:go_guru_tags')
call go#util#EchoSuccess("guru tags is not set")
else
call go#util#EchoSuccess("current guru tags: ". g:go_guru_tags)
endif
endfunction
" vim: sw=2 ts=2 et

View file

@ -41,6 +41,12 @@ function! go#rename#Rename(bang, ...) abort
let cmd = [bin_path, "-offset", offset, "-to", to_identifier]
" check for any tags
if exists('g:go_build_tags')
let tags = get(g:, 'go_build_tags')
call extend(cmd, ["-tags", tags])
endif
if go#util#has_job()
call go#util#EchoProgress(printf("renaming to '%s' ...", to_identifier))
call s:rename_job({

View file

@ -598,15 +598,16 @@ CTRL-t
use the variable |'g:go_metalinter_command'|. To override the maximum
linters execution time use |'g:go_metalinter_deadline'| variable.
*:GoGuruTags*
:GoGuruTags [tags]
*:GoBuildTags*
:GoBuildTags [tags]
Changes the custom |'g:go_guru_tags'| setting and overrides it with the
given build tags. This command cooperate with GoReferrers command when
there exist mulitiple build tags in your project, then you can set one of
the build tags for GoReferrers to find more accurate.
The custom build tags is cleared (unset) if `""` is given. If no arguments
is given it prints the current custom build tags.
Changes the build tags for various commands. If you have any file that
uses a custom build tag, such as `//+build integration` , this command can
be used to pass it to all tools that accepts tags, such as guru, gorenate,
etc..
The build tags is cleared (unset) if `""` is given. If no arguments is
given it prints the current custom build tags.
*:AsmFmt*
:AsmFmt
@ -1208,15 +1209,15 @@ set, so the relevant commands defaults are being used.
>
let g:go_guru_scope = []
<
*'g:go_guru_tags'*
*'g:go_build_tags'*
These options that will be automatically passed to the `-tags` option of
`go guru` when it's invoked with |:GoDef|. You can use |:GoGuruTags| to set
this. By default it's not set.
various tools, such as `guru`, `gorename`, etc... This is a permanatent
setting. A more useful way is to use |:GoBuildTags| to dynamically change or
remove build tags. By default it's not set.
>
let g:go_guru_tags = ''
let g:go_build_tags = ''
<
*'g:go_highlight_array_whitespace_error'*
Highlights white space after "[]". >

View file

@ -12,7 +12,6 @@ command! -range=% GoCallstack call go#guru#Callstack(<count>)
command! -range=% GoFreevars call go#guru#Freevars(<count>)
command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
command! -range=% GoReferrers call go#guru#Referrers(<count>)
command! -nargs=? GoGuruTags call go#guru#Tags(<f-args>)
command! -range=0 GoSameIds call go#guru#SameIds()
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
@ -31,6 +30,7 @@ command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo()
" -- cmd
command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>)
command! -nargs=? -bang GoBuildTags call go#cmd#BuildTags(<bang>0, <f-args>)
command! -nargs=* -bang GoGenerate call go#cmd#Generate(<bang>0,<f-args>)
command! -nargs=* -bang -complete=file GoRun call go#cmd#Run(<bang>0,<f-args>)
command! -nargs=* -bang GoInstall call go#cmd#Install(<bang>0, <f-args>)

View file

@ -33,9 +33,9 @@ syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,p
syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
syntax keyword pugCommentTodo contained TODO FIXME XXX TBD
syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo keepend
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo
syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell
syn region pugAngular2 start="(" end=")" contains=htmlEvent
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
@ -52,10 +52,10 @@ syn keyword pugHtmlArg contained href title
syn match pugPlainChar "\\" contained
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug
syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug,@Spell
syn region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugPipedText skipnl
syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug,@Spell nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
syn region pugTextInlinePug matchgroup=pugInlineDelimiter start="#\[" end="]" contains=pugTag keepend

View file

@ -6,7 +6,7 @@ endif
try
call tlib#input#List('mi', '', [])
catch /.*/
echoe "you're missing tlib. See install instructions at ".expand('<sfile>:h:h').'/README.md'
echoe "tlib is missing. See install instructions at ".expand('<sfile>:h:h').'/README.md'
endtry
fun! Filename(...) abort
@ -117,7 +117,14 @@ function! snipMate#sniplist_str(snippet, stops) abort
if type(item) == type('')
let str .= item
elseif type(item) == type([])
let str .= snipMate#placeholder_str(item[0], a:stops)
let placeholder = snipMate#placeholder_str(item[0], a:stops)
if len(item) > 1 && type(item[1]) == type({})
let placeholder = substitute(placeholder,
\ get(item[1], 'pat', ''),
\ get(item[1], 'sub', ''),
\ get(item[1], 'flags', ''))
endif
let str .= placeholder
endif
let pos += 1

View file

@ -171,6 +171,7 @@ endfunction
function! s:parser_text(till) dict abort
let ret = []
let target = ret
while self.pos < self.len
let lines = []
@ -180,8 +181,12 @@ function! s:parser_text(till) dict abort
if !empty(var)
if var[0] is# 'VISUAL'
let lines = s:visual_placeholder(var, self.indent)
" Remove trailing newline. See #245
if lines[-1] == '' && self.next == "\n"
call remove(lines, -1)
endif
elseif var[0] >= 0
call add(ret, var)
call add(target, var)
call self.add_var(var)
endif
endif
@ -192,8 +197,12 @@ function! s:parser_text(till) dict abort
endif
if !empty(lines)
call add(ret, lines[0])
call extend(self.stored_lines, lines[1:])
call add(target, lines[0])
call extend(self.stored_lines, lines[1:-2])
" Don't change targets if there's only one line
if exists("lines[1]")
let target = [lines[-1]]
endif
endif
" Empty lines are ignored if this is tested at the start of an iteration
@ -203,6 +212,11 @@ function! s:parser_text(till) dict abort
endwhile
call s:join_consecutive_strings(ret)
if target isnot ret
call s:join_consecutive_strings(target)
call extend(self.stored_lines, target)
endif
return ret
endfunction

View file

@ -118,6 +118,16 @@ describe 'snippet parser'
\ ["\t baz"], ["x"]]
end
it 'removes newlines from the end of VISUALs if before an end of line'
let b:snipmate_visual = "1\n2\n"
Expect Parse("x\n$VISUAL\nx") == [['x'], ['1'], ['2'], ['x']]
end
it 'splits the before and after a $VISUAL if it is multiline'
let b:snipmate_visual = "1\n2\n3"
Expect Parse("foo $VISUAL bar") == [['foo 1'], ['2'], ['3 bar']]
end
it 'determines which var with an id is the stop'
let [snip, stops] = Parse("$1$1$1", 0, 1)
Expect snip == [[[1, "", stops[1]], [1, {}], [1, {}]]]

View file

@ -16,7 +16,7 @@ namespace ${1:MyNamespace}
endsnippet
snippet class "class" w
class ${1:MyClass}
${1:public} class ${2:MyClass}
{
$0
}
@ -288,6 +288,10 @@ snippet cw "Console.WriteLine" b
Console.WriteLine("$1");
endsnippet
snippet cr "Console.ReadLine" b
Console.ReadLine();
endsnippet
# as you first type comma-separated parameters on the right, {n} values appear in the format string
snippet cwp "Console.WriteLine with parameters" b
Console.WriteLine("${2:`!p
@ -300,9 +304,9 @@ MessageBox.Show("${1:message}");
endsnippet
##################
# full methods #
##################
#############
# methods #
#############
snippet equals "Equals method" b
public override bool Equals(object obj)
@ -316,13 +320,53 @@ public override bool Equals(object obj)
}
endsnippet
snippet mth "Method" b
${1:public} ${2:void} ${3:MyMethod}(${4})
{
$0
}
endsnippet
snippet mths "Static method" b
${1:public} static ${2:void} ${3:MyMethod}(${4})
{
$0
}
endsnippet
###############
# constructor #
###############
snippet ctor "Constructor" b
${1:public} ${2:`!p snip.rv = snip.basename or "untitled"`}(${3})
{
$0
}
endsnippet
##############
# comments #
##############
snippet /// "XML comment" b
snippet /// "XML summary comment" b
/// <summary>
/// $1
/// $0
/// </summary>
endsnippet
snippet <p "XML pramameter comment" b
<param name="${1}">${2}</param>
endsnippet
snippet <ex "XML exception comment" b
<exception cref="${1:System.Exception}">${2}</exception>
endsnippet
snippet <r "XML returns comment" b
<returns>$0</returns>
endsnippet
snippet <c "XML code comment" b
<code>$0</code>
endsnippet

View file

@ -56,7 +56,7 @@
#
# Feedback is welcome!
#
# Main
# Main
snippet sim
${1:public }static int Main(string[] args) {
${0}
@ -358,7 +358,7 @@ snippet enum
enum ${1} {
${0}
}
snippet enum+
public enum ${1} {
${0}
@ -378,7 +378,7 @@ snippet <p
snippet <ex
<exception cref="${1:System.Exception}">${2}</exception>
snippet <r
<returns>${1}</returns>{
<returns>${1}</returns>
snippet <s
<see cref="${1}"/>
snippet <rem
@ -398,7 +398,7 @@ snippet eq
${0:throw new NotImplementedException();}
return base.Equals(obj);
}
# exception
# exception
snippet exc
public class ${1:MyException} : ${2:Exception} {
public $1() { }
@ -409,13 +409,13 @@ snippet exc
System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
}
# indexer
# indexer
snippet index
public ${1:object} this[${2:int} index] {
get { ${0} }
set { ${0} }
}
# eventhandler
# eventhandler
snippet inv
EventHandler temp = ${1:MyEvent};
if (${2:temp} != null) {
@ -442,7 +442,7 @@ snippet propf
}
snippet propg
public ${1:int} ${2:MyProperty} { get; private set; }
# switch
# switch
snippet switch
switch (${1:switch_on}) {
${0}