Updated plugins
This commit is contained in:
parent
7b7a056680
commit
395c077dcb
15 changed files with 170 additions and 67 deletions
|
@ -33,7 +33,7 @@ function! s:get_color(group, attr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:set_color(group, attr, color)
|
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)
|
execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,9 @@ if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
|
||||||
nmap gc <Plug>Commentary
|
nmap gc <Plug>Commentary
|
||||||
omap gc <Plug>Commentary
|
omap gc <Plug>Commentary
|
||||||
nmap gcc <Plug>CommentaryLine
|
nmap gcc <Plug>CommentaryLine
|
||||||
|
if maparg('c','n') ==# ''
|
||||||
nmap cgc <Plug>ChangeCommentary
|
nmap cgc <Plug>ChangeCommentary
|
||||||
|
endif
|
||||||
nmap gcu <Plug>Commentary<Plug>Commentary
|
nmap gcu <Plug>Commentary<Plug>Commentary
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -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
|
[FAQ](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), it might
|
||||||
have answers for your problem
|
have answers for your problem
|
||||||
2. If you add a new feature please don't forget to update the documentation:
|
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
|
3. If it's a breaking change or exceed +100 lines please open an issue first
|
||||||
and describe the changes you want to make.
|
and describe the changes you want to make.
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
FEATURES:
|
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]:
|
* Add new `errl` snippet that expands to [gh-1185]:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -10,12 +14,16 @@ if err != nil {
|
||||||
log.Fatal(err)
|
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:
|
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]
|
* 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]
|
* Document 'noshowmode' requirement for echo_go_info [gh-1197]
|
||||||
* Improve godoc view for vertical splits [gh-1195]
|
* Improve godoc view for vertical splits [gh-1195]
|
||||||
* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193]
|
* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193]
|
||||||
|
@ -23,7 +31,8 @@ IMPROVEMENTS:
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
* Honor `g:go_echo_command_info` when dispatching builds in neovim [gh-1176]
|
* 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]
|
* 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]
|
* 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]
|
* 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]
|
* 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]
|
* 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)
|
## 1.11 - (January 9, 2017)
|
||||||
|
|
||||||
FEATURES:
|
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_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]
|
* Add new `g:go_template_use_pkg` setting to enable to use cwd as package name instead of basic template file [gh-1124]
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,28 @@ function! go#cmd#Build(bang, ...) abort
|
||||||
endfunction
|
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.
|
" Run runs the current file (and their dependencies if any) in a new terminal.
|
||||||
function! go#cmd#RunTerm(bang, mode, files) abort
|
function! go#cmd#RunTerm(bang, mode, files) abort
|
||||||
if empty(a:files)
|
if empty(a:files)
|
||||||
|
|
|
@ -46,8 +46,8 @@ function! s:guru_cmd(args) range abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" check for any tags
|
" check for any tags
|
||||||
if exists('g:go_guru_tags')
|
if exists('g:go_build_tags')
|
||||||
let tags = get(g:, 'go_guru_tags')
|
let tags = get(g:, 'go_build_tags')
|
||||||
call extend(cmd, ["-tags", tags])
|
call extend(cmd, ["-tags", tags])
|
||||||
let result.tags = tags
|
let result.tags = tags
|
||||||
endif
|
endif
|
||||||
|
@ -619,24 +619,4 @@ function! go#guru#Scope(...) abort
|
||||||
endif
|
endif
|
||||||
endfunction
|
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
|
" vim: sw=2 ts=2 et
|
||||||
|
|
|
@ -41,6 +41,12 @@ function! go#rename#Rename(bang, ...) abort
|
||||||
|
|
||||||
let cmd = [bin_path, "-offset", offset, "-to", to_identifier]
|
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()
|
if go#util#has_job()
|
||||||
call go#util#EchoProgress(printf("renaming to '%s' ...", to_identifier))
|
call go#util#EchoProgress(printf("renaming to '%s' ...", to_identifier))
|
||||||
call s:rename_job({
|
call s:rename_job({
|
||||||
|
|
|
@ -598,15 +598,16 @@ CTRL-t
|
||||||
use the variable |'g:go_metalinter_command'|. To override the maximum
|
use the variable |'g:go_metalinter_command'|. To override the maximum
|
||||||
linters execution time use |'g:go_metalinter_deadline'| variable.
|
linters execution time use |'g:go_metalinter_deadline'| variable.
|
||||||
|
|
||||||
*:GoGuruTags*
|
*:GoBuildTags*
|
||||||
:GoGuruTags [tags]
|
:GoBuildTags [tags]
|
||||||
|
|
||||||
Changes the custom |'g:go_guru_tags'| setting and overrides it with the
|
Changes the build tags for various commands. If you have any file that
|
||||||
given build tags. This command cooperate with GoReferrers command when
|
uses a custom build tag, such as `//+build integration` , this command can
|
||||||
there exist mulitiple build tags in your project, then you can set one of
|
be used to pass it to all tools that accepts tags, such as guru, gorenate,
|
||||||
the build tags for GoReferrers to find more accurate.
|
etc..
|
||||||
The custom build tags is cleared (unset) if `""` is given. If no arguments
|
|
||||||
is given it prints the current custom build tags.
|
The build tags is cleared (unset) if `""` is given. If no arguments is
|
||||||
|
given it prints the current custom build tags.
|
||||||
|
|
||||||
*:AsmFmt*
|
*:AsmFmt*
|
||||||
:AsmFmt
|
:AsmFmt
|
||||||
|
@ -1208,15 +1209,15 @@ set, so the relevant commands defaults are being used.
|
||||||
>
|
>
|
||||||
let g:go_guru_scope = []
|
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
|
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
|
various tools, such as `guru`, `gorename`, etc... This is a permanatent
|
||||||
this. By default it's not set.
|
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'*
|
*'g:go_highlight_array_whitespace_error'*
|
||||||
|
|
||||||
Highlights white space after "[]". >
|
Highlights white space after "[]". >
|
||||||
|
|
|
@ -12,7 +12,6 @@ command! -range=% GoCallstack call go#guru#Callstack(<count>)
|
||||||
command! -range=% GoFreevars call go#guru#Freevars(<count>)
|
command! -range=% GoFreevars call go#guru#Freevars(<count>)
|
||||||
command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
|
command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
|
||||||
command! -range=% GoReferrers call go#guru#Referrers(<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 GoSameIds call go#guru#SameIds()
|
||||||
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
|
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
|
||||||
|
@ -31,6 +30,7 @@ command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo()
|
||||||
|
|
||||||
" -- cmd
|
" -- cmd
|
||||||
command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>)
|
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 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 -complete=file GoRun call go#cmd#Run(<bang>0,<f-args>)
|
||||||
command! -nargs=* -bang GoInstall call go#cmd#Install(<bang>0, <f-args>)
|
command! -nargs=* -bang GoInstall call go#cmd#Install(<bang>0, <f-args>)
|
||||||
|
|
|
@ -33,9 +33,9 @@ syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,p
|
||||||
syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
|
syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
|
||||||
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
|
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
|
||||||
syntax keyword pugCommentTodo contained TODO FIXME XXX TBD
|
syntax keyword pugCommentTodo contained TODO FIXME XXX TBD
|
||||||
syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo
|
syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell
|
||||||
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo keepend
|
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend
|
||||||
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo
|
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell
|
||||||
syn region pugAngular2 start="(" end=")" contains=htmlEvent
|
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 region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
|
||||||
syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
|
syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
|
||||||
|
@ -52,10 +52,10 @@ syn keyword pugHtmlArg contained href title
|
||||||
syn match pugPlainChar "\\" contained
|
syn match pugPlainChar "\\" contained
|
||||||
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
|
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
|
||||||
syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
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 region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugPipedText skipnl
|
||||||
syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd 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 pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
|
||||||
syn region pugTextInlinePug matchgroup=pugInlineDelimiter start="#\[" end="]" contains=pugTag keepend
|
syn region pugTextInlinePug matchgroup=pugInlineDelimiter start="#\[" end="]" contains=pugTag keepend
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ endif
|
||||||
try
|
try
|
||||||
call tlib#input#List('mi', '', [])
|
call tlib#input#List('mi', '', [])
|
||||||
catch /.*/
|
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
|
endtry
|
||||||
|
|
||||||
fun! Filename(...) abort
|
fun! Filename(...) abort
|
||||||
|
@ -117,7 +117,14 @@ function! snipMate#sniplist_str(snippet, stops) abort
|
||||||
if type(item) == type('')
|
if type(item) == type('')
|
||||||
let str .= item
|
let str .= item
|
||||||
elseif type(item) == type([])
|
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
|
endif
|
||||||
|
|
||||||
let pos += 1
|
let pos += 1
|
||||||
|
|
|
@ -171,6 +171,7 @@ endfunction
|
||||||
|
|
||||||
function! s:parser_text(till) dict abort
|
function! s:parser_text(till) dict abort
|
||||||
let ret = []
|
let ret = []
|
||||||
|
let target = ret
|
||||||
|
|
||||||
while self.pos < self.len
|
while self.pos < self.len
|
||||||
let lines = []
|
let lines = []
|
||||||
|
@ -180,8 +181,12 @@ function! s:parser_text(till) dict abort
|
||||||
if !empty(var)
|
if !empty(var)
|
||||||
if var[0] is# 'VISUAL'
|
if var[0] is# 'VISUAL'
|
||||||
let lines = s:visual_placeholder(var, self.indent)
|
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
|
elseif var[0] >= 0
|
||||||
call add(ret, var)
|
call add(target, var)
|
||||||
call self.add_var(var)
|
call self.add_var(var)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -192,8 +197,12 @@ function! s:parser_text(till) dict abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(lines)
|
if !empty(lines)
|
||||||
call add(ret, lines[0])
|
call add(target, lines[0])
|
||||||
call extend(self.stored_lines, lines[1:])
|
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
|
endif
|
||||||
|
|
||||||
" Empty lines are ignored if this is tested at the start of an iteration
|
" 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
|
endwhile
|
||||||
|
|
||||||
call s:join_consecutive_strings(ret)
|
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
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,16 @@ describe 'snippet parser'
|
||||||
\ ["\t baz"], ["x"]]
|
\ ["\t baz"], ["x"]]
|
||||||
end
|
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'
|
it 'determines which var with an id is the stop'
|
||||||
let [snip, stops] = Parse("$1$1$1", 0, 1)
|
let [snip, stops] = Parse("$1$1$1", 0, 1)
|
||||||
Expect snip == [[[1, "", stops[1]], [1, {}], [1, {}]]]
|
Expect snip == [[[1, "", stops[1]], [1, {}], [1, {}]]]
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ${1:MyNamespace}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet class "class" w
|
snippet class "class" w
|
||||||
class ${1:MyClass}
|
${1:public} class ${2:MyClass}
|
||||||
{
|
{
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
|
@ -288,6 +288,10 @@ snippet cw "Console.WriteLine" b
|
||||||
Console.WriteLine("$1");
|
Console.WriteLine("$1");
|
||||||
endsnippet
|
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
|
# as you first type comma-separated parameters on the right, {n} values appear in the format string
|
||||||
snippet cwp "Console.WriteLine with parameters" b
|
snippet cwp "Console.WriteLine with parameters" b
|
||||||
Console.WriteLine("${2:`!p
|
Console.WriteLine("${2:`!p
|
||||||
|
@ -300,9 +304,9 @@ MessageBox.Show("${1:message}");
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
##################
|
#############
|
||||||
# full methods #
|
# methods #
|
||||||
##################
|
#############
|
||||||
|
|
||||||
snippet equals "Equals method" b
|
snippet equals "Equals method" b
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
|
@ -316,13 +320,53 @@ public override bool Equals(object obj)
|
||||||
}
|
}
|
||||||
endsnippet
|
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 #
|
# comments #
|
||||||
##############
|
##############
|
||||||
|
|
||||||
snippet /// "XML comment" b
|
snippet /// "XML summary comment" b
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// $1
|
/// $0
|
||||||
/// </summary>
|
/// </summary>
|
||||||
endsnippet
|
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
|
||||||
|
|
|
@ -378,7 +378,7 @@ snippet <p
|
||||||
snippet <ex
|
snippet <ex
|
||||||
<exception cref="${1:System.Exception}">${2}</exception>
|
<exception cref="${1:System.Exception}">${2}</exception>
|
||||||
snippet <r
|
snippet <r
|
||||||
<returns>${1}</returns>{
|
<returns>${1}</returns>
|
||||||
snippet <s
|
snippet <s
|
||||||
<see cref="${1}"/>
|
<see cref="${1}"/>
|
||||||
snippet <rem
|
snippet <rem
|
||||||
|
|
Loading…
Reference in a new issue