1
0
Fork 0
mirror of synced 2024-11-15 21:48:57 -05:00

Merge pull request #6 from amix/master

merge to origin fork
This commit is contained in:
Tiande 2016-07-17 15:00:11 +08:00 committed by GitHub
commit 37bfe17157
36 changed files with 700 additions and 291 deletions

View file

@ -122,6 +122,19 @@ nice code clean-up (which ack.vim is now hopefully getting), and ack.vim picked
up a few features that haven't made their way to ag.vim, like `:AckWindow`,
optional background search execution with [vim-dispatch], and auto-previewing.
#### I don't want to jump to the first result automatically. ####
Use `:Ack!`, with bang. If you want this behavior most of the time, you might
like an abbreviation or mapping in your personal config, something like these:
```vim
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space>
```
Most of the `:[L]Ack*` commands support this. Note that this behavior follows
the convention of Vim's built-in `:grep` and `:make` commands.
[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher
[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145

View file

@ -275,7 +275,19 @@ If you're using this plugin with ag, The Silver Searcher, bear in mind that:
==============================================================================
ISSUES AND FAQ *ack-issues-and-faq*
I use NERDTree and opening ack.vim results in a vertical split displaces it.~
I don't want to jump to the first result automatically.~
Use `:Ack!`, with bang. If you want this behavior most of the time, you
might like an abbreviation or mapping in your personal config, something
like these:
>
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space>
<
Most of the `:[L]Ack*` commands support this. Note that this behavior
follows the convention of Vim's built-in |:grep| and |:make| commands.
I use NERDTree and opening ack.vim results in a vertical split displacing it.~
You are probably using NERDTree with its default alignment at the left
side of the window. Set these custom mappings in your vimrc to work around

View file

@ -149,6 +149,7 @@ let [s:lcmap, s:prtmaps] = ['nn <buffer> <silent>', {
\ 'CreateNewFile()': ['<c-y>'],
\ 'MarkToOpen()': ['<c-z>'],
\ 'OpenMulti()': ['<c-o>'],
\ 'YankLine()': [],
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
\ }]
@ -1325,6 +1326,18 @@ fu! s:OpenMulti(...)
unl! s:tabct
endf
fu! s:YankLine(...)
let @" = s:getinput()
let has_marked = exists('s:marked')
if !has_marked
let line = ctrlp#getcline()
if line == '' | retu | en
let marked = { 1 : fnamemodify(line, ':p') }
en
let @" = join(values(has_marked ? s:marked : marked), "\n")
cal s:PrtExit()
endf
fu! s:OpenNoMarks(md, line)
if a:md == 'a'
let [s:marked, key] = [{}, 1]

View file

@ -59,6 +59,7 @@ let s:types = {
\ 'erlang' : '%serlang%serlang%sdrmf',
\ 'expect' : '%stcl%stcl%scfp',
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
\ 'go' : '%sgo%sgo%sfctv',
\ 'html' : '%shtml%shtml%saf',
\ 'java' : '%sjava%sjava%spcifm',
\ 'javascript': '%sjavascript%sjavascript%sf',

View file

@ -25,19 +25,21 @@
3. [Recommended settings](#settings)
4. [FAQ](#faq)
4.1. [I installed syntastic but it isn't reporting any errors...](#faqinfo)
4.2. [The `python` checker complains about syntactically valid Python 3 constructs...](#faqpython3)
4.3. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
4.4. [The `perl` checker has stopped working...](#faqperl)
4.5. [What happened to the `rustc` checker?](#faqrust)
4.6. [What happened to the `xcrun` checker?](#faqxcrun)
4.7. [I run a checker and the location list is not updated...](#faqloclist)
4.7. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.8. [How can I pass additional arguments to a checker?](#faqargs)
4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.11. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.12. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.13. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
4.2. [How can I check scripts written for different versions of Python?](#faqpython)
4.3. [How can I check scripts written for different versions of Ruby?](#faqruby)
4.4. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
4.5. [The `perl` checker has stopped working...](#faqperl)
4.6. [What happened to the `rustc` checker?](#faqrust)
4.7. [What happened to the `xcrun` checker?](#faqxcrun)
4.8. [I run a checker and the location list is not updated...](#faqloclist)
4.8. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.9. [How can I pass additional arguments to a checker?](#faqargs)
4.10. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.11. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.12. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.13. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.14. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
4.15. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
5. [Resources](#otherresources)
- - -
@ -150,7 +152,7 @@ You now have pathogen installed and can put syntastic into `~/.vim/bundle` like
this:
```sh
cd ~/.vim/bundle && \
git clone https://github.com/scrooloose/syntastic.git
git clone --depth=1 https://github.com/scrooloose/syntastic.git
```
Quit vim and start it back up to reload it, then type:
```vim
@ -227,19 +229,40 @@ or the error output for a syntax checker may have changed. In this case, make
sure you have the latest version of the syntax checker installed. If it still
fails then post an [issue][bug_tracker] - or better yet, create a pull request.
<a name="faqpython3"></a>
<a name="faqpython"></a>
__4.2. Q. The `python` checker complains about syntactically valid Python 3 constructs...__
__4.2. Q. How can I check scripts written for different versions of Python?__
A. Configure the `python` checker to call a Python 3 interpreter rather than
Python 2, e.g:
```vim
let g:syntastic_python_python_exec = '/path/to/python3'
```
A. Install a Python version manager such as [virtualenv][virtualenv]
or [pyenv][pyenv], activate the environment for the relevant version
of Python, and install in it the checkers you want to use. Set
`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim]
from the virtual environment.
If you're starting Vim from a desktop manager rather than from a terminal you
might need to write wrapper scripts around your checkers, to activate the
virtual environment before running the actual checks. Then you'll need to
point the relevant `g:syntastic_python_<checker>_exec` variables to the wrapper
scripts.
<a name="faqruby"></a>
__4.3. Q. How can I check scripts written for different versions of Ruby?__
A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv],
activate the environment for the relevant version of Ruby, and install in it
the checkers you want to use. Set `g:syntastic_ruby_checkers` accordingly in
your `vimrc`, and run [Vim][vim] from the virtual environment.
If you're starting Vim from a desktop manager rather than from a terminal you
might need to write wrapper scripts around your checkers, to activate the
virtual environment before running the actual checks. Then you'll need to
point the relevant `g:syntastic_ruby_<checker>_exec` variables to the wrapper
scripts.
<a name="faqhtml5"></a>
__4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
__4.4. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
[HTML Tidy][tidy_old] has a fork named [HTML Tidy for HTML5][tidy]. It's a drop
in replacement, and syntastic can use it without changes. Just install it
@ -259,7 +282,7 @@ let g:syntastic_html_validator_api = 'http://localhost:8888/'
<a name="faqperl"></a>
__4.4. Q. The `perl` checker has stopped working...__
__4.5. Q. The `perl` checker has stopped working...__
A. The `perl` checker runs `perl -c` against your file, which in turn
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
@ -275,14 +298,14 @@ let g:syntastic_enable_perl_checker = 1
<a name="faqrust"></a>
__4.5. Q. What happened to the `rustc` checker?__
__4.6. Q. What happened to the `rustc` checker?__
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
checker should be picked up automatically by syntastic.
<a name="faqxcrun"></a>
__4.6. Q. What happened to the `xcrun` checker?__
__4.7. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
@ -290,8 +313,8 @@ install this plugin the checker should be picked up automatically by syntastic.
<a name="faqloclist"></a>
__4.7. Q. I run a checker and the location list is not updated...__
__4.7. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
__4.8. Q. I run a checker and the location list is not updated...__
__4.8. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
A. By default the location list is changed only when you run the `:Errors`
command, in order to minimise conflicts with other plugins. If you want the
@ -303,7 +326,7 @@ let g:syntastic_always_populate_loc_list = 1
<a name="faqargs"></a>
__4.8. Q. How can I pass additional arguments to a checker?__
__4.9. Q. How can I pass additional arguments to a checker?__
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
that do can be configured using global variables. The general form of the
@ -319,7 +342,7 @@ See `:help syntastic-checker-options` for more information.
<a name="faqcheckers"></a>
__4.9. Q. Syntastic supports several checkers for my filetype - how do I tell it
__4.10. Q. Syntastic supports several checkers for my filetype - how do I tell it
which one(s) to use?__
A. Stick a line like this in your `vimrc`:
@ -360,7 +383,7 @@ filetype of the current file is `php`).
<a name="faqstyle"></a>
__4.10. Q. What is the difference between syntax checkers and style checkers?__
__4.11. Q. What is the difference between syntax checkers and style checkers?__
A. The errors and warnings they produce are highlighted differently and can
be filtered by different rules, but otherwise the distinction is pretty much
@ -390,7 +413,7 @@ See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a>
__4.11. Q. I have enabled multiple checkers for the current filetype. How can I
__4.12. Q. I have enabled multiple checkers for the current filetype. How can I
display all errors from all checkers together?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
@ -402,7 +425,7 @@ See `:help syntastic-aggregating-errors` for more details.
<a name="faqlnext"></a>
__4.12. Q. How can I jump between the different errors without using the location
__4.13. Q. How can I jump between the different errors without using the location
list at the bottom of the window?__
A. Vim provides several built-in commands for this. See `:help :lnext` and
@ -412,9 +435,28 @@ If you use these commands a lot then you may want to add shortcut mappings to
your `vimrc`, or install something like [unimpaired][unimpaired], which provides such
mappings (among other things).
<a name="faqconfig"></a>
__4.14. My favourite checker needs to load a configuration file from the
project's root rather than the current directory...__
A. You can set up an `autocmd` to search for the configuration file in the
current directory and upwards, and add it to the checker's options when found.
For example for `jscs`:
```vim
function! FindConfig(prefix, what, where)
let cfg = findfile(a:what, escape(a:where, ' ') . ';')
return cfg !=# '' ? ' ' . a:prefix . ' ' . cfg : ''
endfunction
autocmd FileType javascript let b:syntastic_javascript_jscs_args =
\ get(g:, 'syntastic_javascript_jscs_args', '') .
\ FindConfig('-c', '.jscsrc', expand('<amatch>:p:h', 1))
```
<a name="faqbdelete"></a>
__4.13. Q. The error window is closed automatically when I :quit the current buffer
__4.15. Q. The error window is closed automatically when I :quit the current buffer
but not when I :bdelete it?__
A. There is no safe way to handle that situation automatically, but you can
@ -458,9 +500,12 @@ a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [v
[pathogen]: https://github.com/tpope/vim-pathogen
[perlrun]: http://perldoc.perl.org/perlrun.html#*-c*
[plug]: https://github.com/junegunn/vim-plug/
[pyenv]: https://github.com/yyuu/pyenv
[python_mode]: https://github.com/klen/python-mode
[rbenv]: https://github.com/rbenv/rbenv
[roktas]: https://github.com/roktas/syntastic-more
[rust]: https://github.com/rust-lang/rust.vim
[rvm]: https://rvm.io/
[stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic
[swift]: https://github.com/kballard/vim-swift
[tidy]: http://www.htacg.org/tidy-html5/
@ -469,6 +514,7 @@ a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [v
[vam]: https://github.com/MarcWeber/vim-addon-manager
[vim]: http://www.vim.org/
[vimgo]: https://github.com/fatih/vim-go
[virtualenv]: https://virtualenv.pypa.io/en/stable/
[vnu]: http://about.validator.nu/
[vnu_jar]: https://github.com/validator/validator/releases/latest
[vnu_server]: http://validator.github.io/validator/#standalone

View file

@ -4398,9 +4398,9 @@ The following checkers are available for Python (filetype "python"):
1. flake8...................|syntastic-python-flake8|
2. Frosted..................|syntastic-python-frosted|
3. mypy.....................|syntastic-python-mypy|
4. pep8.....................|syntastic-python-pep8|
5. Prospector...............|syntastic-python-prospector|
6. py3kwarn.................|syntastic-python-py3kwarn|
4. Prospector...............|syntastic-python-prospector|
5. py3kwarn.................|syntastic-python-py3kwarn|
6. pycodestyle..............|syntastic-python-pycodestyle|
7. pydocstyle...............|syntastic-python-pydocstyle|
8. Pyflakes.................|syntastic-python-pyflakes|
9. Pylama...................|syntastic-python-pylama|
@ -4460,24 +4460,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
4. pep8 *syntastic-python-pep8*
Name: pep8
Maintainer: LCD 47 <lcd047@gmail.com>
"Pep8" is a style checker for Python, derived from the conventions in PEP 8
(http://www.python.org/dev/peps/pep-0008/). See the project's page for
details:
https://github.com/jcrocholl/pep8
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
5. Prospector *syntastic-python-prospector*
4. Prospector *syntastic-python-prospector*
Name: prospector
Maintainer: LCD 47 <lcd047@gmail.com>
@ -4500,7 +4483,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
6. py3kwarn *syntastic-python-py3kwarn*
5. py3kwarn *syntastic-python-py3kwarn*
Name: py3kwarn
Author: Liam Curry <liam@curry.name>
@ -4515,6 +4498,23 @@ Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
6. pycodestyle *syntastic-python-pycodestyle*
Name: pycodestyle
Maintainer: LCD 47 <lcd047@gmail.com>
"pycodestyle" (formerly "pep8") is a style checker for Python, derived from
the conventions in PEP 8 (http://www.python.org/dev/peps/pep-0008/). See the
project's page for details:
https://github.com/PyCQA/pycodestyle
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
7. pydocstyle *syntastic-python-pydocstyle*

View file

@ -44,6 +44,7 @@ CONTENTS *syntastic-contents*
6.2.Editing files over network.............|syntastic-netrw|
6.3.The 'shellslash' option................|syntastic-shellslash|
6.4.Saving Vim sessions....................|syntastic-sessions|
6.5.The location list callback.............|syntastic-loclist-callback|
7.Compatibility with other software............|syntastic-compatibility|
7.1.The csh and tcsh shells................|syntastic-csh|
7.2.Eclim..................................|syntastic-eclim|
@ -882,6 +883,7 @@ The syntax is of course identical to that of |syntastic_quiet_messages|.
------------------------------------------------------------------------------
5.6 Debugging *syntastic-config-debug*
*syntastic-debug*
Syntastic can log a trace of its working to Vim's |message-history|. To verify
the command line constructed by syntastic to run a checker, set the variable
@ -958,6 +960,29 @@ remove option "blank" from 'sessionoptions': >
This will prevent `:mksession` from saving |syntastic-error-window| as empty
quickfix windows.
------------------------------------------------------------------------------
6.5 The location list callback *syntastic-loclist-callback*
*SyntasticCheckHook()*
Syntastic also gives you direct access to the list of errors. A function
named |SyntasticCheckHook()| is called by syntastic (if it exists) right
before populating the |location-list| and enabling the notifiers. The function
takes exactly one argument, the list of errors in |location-list| format (see
|getqflist()| for details). format. You can do essentially anything with this
list, as long as you don't change its format, and you don't add or remove
elements.
For example the following function will make the error window smaller if fewer
than 10 errors are found: >
function! SyntasticCheckHook(errors)
if !empty(a:errors)
let g:syntastic_loc_list_height = min([len(a:errors), 10])
endif
endfunction
<
(Please keep in mind however that Vim options |winheight| and |winminheight|
also affect window sizes.)
==============================================================================
7. Compatibility with other software *syntastic-compatibility*

View file

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.7.0-153'
let g:_SYNTASTIC_VERSION = '3.7.0-162'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1

View file

@ -19,7 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_matlab_mlint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-id $*' })
let makeprg = self.makeprgBuild({ 'args_after': '-id' })
let errorformat =
\ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'.

View file

@ -1,6 +1,6 @@
"============================================================================
"File: pep8.vim
"Description: Syntax checking plugin for syntastic.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
@ -15,34 +15,9 @@ if exists('g:loaded_syntastic_python_pep8_checker')
endif
let g:loaded_syntastic_python_pep8_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_pep8_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l:%c: %m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'subtype': 'Style' })
for e in loclist
let e['type'] = e['text'] =~? '^W' ? 'W' : 'E'
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'python',
\ 'name': 'pep8'})
let &cpo = s:save_cpo
unlet s:save_cpo
\ 'name': 'pep8',
\ 'redirect': 'python/pycodestyle'})
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -0,0 +1,48 @@
"============================================================================
"File: pycodestyle.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_python_pycodestyle_checker')
finish
endif
let g:loaded_syntastic_python_pycodestyle_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_pycodestyle_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l:%c: %m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'subtype': 'Style' })
for e in loclist
let e['type'] = e['text'] =~? '^W' ? 'W' : 'E'
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'python',
\ 'name': 'pycodestyle'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -13,7 +13,7 @@ call coffee#CoffeeSetUpVariables()
setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:# commentstring=#\ %s
setlocal omnifunc=javascriptcomplete#CompleteJS
setlocal suffixesadd+=coffee
setlocal suffixesadd+=.coffee
" Create custom augroups.
augroup CoffeeBufUpdate | augroup END

View file

@ -2840,7 +2840,7 @@ function! s:cfile() abort
elseif getline('.') =~# '^#\trenamed:.* -> '
let file = '/'.matchstr(getline('.'),' -> \zs.*')
return [file]
elseif getline('.') =~# '^#\t\(\k\| \)\+: *.'
elseif getline('.') =~# '^#\t\(\k\| \)\+\p\?: *.'
let file = '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
return [file]
elseif getline('.') =~# '^#\t.'

View file

@ -1,10 +1,17 @@
## 1.8 (unplanned)
IMPROVEMENTS:
FEATURES:
* If you open a new buffer with a Go filename it get automatically populated based on the directory. If there are no Go files a simple main package is created, otherwise the file will include the package declaration line based on the package in the current directory. Checkout the demo to see it in action: https://twitter.com/fatih/status/748333086643994624. This is enabled by default. Can be disabled with `let g:go_template_autocreate = 0`. You can use your own template with `let g:go_template_file = "foo.go"` and putting the file under the `templates/` folder. [gh-918]
* The snippet expansion `json` is now much more smarter. It pre populates the placeholder according to the first word and it also applies `snake_case` or `camelCase` conversion. Checkout the demo to see it in action: https://github.com/fatih/vim-go/pull/927 [gh-927]
* **`:GoSameIds`** support. When called highlights all same identifiers in the current file. Can be also enabled to highlight identifiers automatically. Checkout the demo to see it in action: https://twitter.com/fatih/status/753673709278339072. [gh-936]
* Add new `errp` snippet to expand an `if err != nil { panic() }` clause [gh-926]
IMPROVEMENTS:
* `:GoDoc` accepts arguments now which are passed directly to `godoc`. So usages like `:GoDoc flag` works again (it was changed in previous versions [gh-894]
* `:GoDef` works now for modified files as well [gh-910]
* Internal: fix indentations on all files to **2-spaces/no tabs**. This is now the default vim-go style across all VimL files [gh-915]
* Syntax: improved syntax highglighting performance for methods, fields, structs and interface type declarations [gh-917]
BUG FIXES:
@ -13,6 +20,12 @@ BUG FIXES:
* Fix `:GoCoverage` not running for Neovim [gh-899]
* Fix `:GoFmt` not picking up `-srcdir` if the command was set to use `goimports` [gh-904]
* Fix `:GoTestCompile` to not leave behind artifacts if the cwd and the test files's directory do not match [gh-909]
* Fix `:GoDocBrowser` to not fail if godoc doesn't exist [gh-920]
BACKWARDS INCOMPATIBILITIES:
* `g:go_highlight_structs` and `g:go_highlight_interface` are removed in favor of `g:go_highlight_types` [gh-917]
## 1.7.1 (June 7, 2016)

View file

@ -181,8 +181,7 @@ To change it:
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
```

View file

@ -19,7 +19,7 @@ function! s:godocWord(args)
if !executable('godoc')
let msg = "godoc command not found."
let msg .= " install with: go get golang.org/x/tools/cmd/godoc"
call go#util#echoWarning(msg)
call go#util#EchoWarning(msg)
return []
endif

View file

@ -7,7 +7,18 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
return {'err': "bin path not found"}
endif
let filename = expand('%:p')
let filename = fnamemodify(expand("%"), ':p:gs?\\?/?')
if !filereadable(filename)
" this might happen for new buffers which are not written yet
return {'err': "file does not exist"}
endif
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
let filename = l:tmpname
endif
let dirname = expand('%:p:h')
let pkg = go#package#ImportPath(dirname)
@ -80,12 +91,18 @@ func! s:RunGuru(mode, format, selected, needs_scope) range abort
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
" the query might take time, let us give some feedback
call go#util#EchoProgress("analysing ...")
if a:mode !=# 'what'
" the query might take time, let us give some feedback
call go#util#EchoProgress("analysing ...")
endif
" run, forrest run!!!
let out = go#util#System(command)
if exists("l:tmpname")
call delete(l:tmpname)
endif
let $GOPATH = old_gopath
if go#util#ShellError() != 0
" the output contains the error message
@ -268,37 +285,65 @@ function! go#guru#What(selected)
let out = s:RunGuru('what', 'json', a:selected, 0)
if has_key(out, 'err')
return out.err
return {'err': out.err}
endif
call s:loclistSecond(out.out)
let result = json_decode(out.out)
if type(result) != type({})
return {'err': "malformed output from guru"}
endif
if !has_key(result, 'what')
return {'err': "no what query found for the given identifier"}
endif
return {'out': result.what}
return result
endfunction
function! go#guru#SameIds(selected)
call go#guru#ClearSameIds()
let result = go#guru#What(a:selected)
if has_key(out, 'err')
call go#util#EchoError(out.err)
if has_key(result, 'err') && !get(g:, 'go_auto_sameids', 0)
" only echo if it's called via `:GoSameIds, but not if it's in automode
call go#util#EchoError(result.err)
return
endif
if !has_key(result.out, 'sameids')
call go#util#EchoError("no same_ids founds for the given identifier")
return -1
if !has_key(result, 'sameids')
if !get(g:, 'go_auto_sameids', 0)
call go#util#EchoError("no same_ids founds for the given identifier")
endif
return
endif
let same_ids = result.what.sameids
echo same_ids
let poslen = 0
for enclosing in result['enclosing']
if enclosing['desc'] == 'identifier'
let poslen = enclosing['end'] - enclosing['start']
break
endif
endfor
" return when there's no identifier to highlight.
if poslen == 0
return
endif
hi goSameId term=bold cterm=bold ctermbg=white ctermfg=black
let same_ids = result['sameids']
" highlight the lines
for item in same_ids
let pos = split(item, ':')
call matchaddpos('goSameId', [[str2nr(pos[-2]), str2nr(pos[-1]), str2nr(poslen)]])
endfor
endfunction
function! go#guru#ClearSameIds()
let m = getmatches()
for item in m
if item['group'] == 'goSameId'
call matchdelete(item['id'])
endif
endfor
endfunction
" vim: sw=2 ts=2 et

View file

@ -0,0 +1,31 @@
let s:current_file = expand("<sfile>")
function! go#template#create()
let l:root_dir = fnamemodify(s:current_file, ':h:h:h')
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
execute cd . fnameescape(expand("%:p:h"))
let l:package_name = go#tool#PackageName()
" if we can't figure out any package name(no Go files or non Go package
" files) from the directory create the template
if l:package_name == -1
let l:template_file = get(g:, 'go_template_file', "hello_world.go")
let l:template_path = go#util#Join(l:root_dir, "templates", l:template_file)
exe '0r ' . l:template_path
$delete _
else
let l:content = printf("package %s", l:package_name)
call append(0, l:content)
$delete _
endif
" Remove the '... [New File]' message line from the command line
echon
execute cd . fnameescape(dir)
endfunction
" vim: sw=2 ts=2 et

View file

@ -43,6 +43,16 @@ function! go#tool#Imports()
return imports
endfunction
function! go#tool#PackageName()
let command = "go list -f '{{.Name}}'"
let out = go#tool#ExecuteInDir(command)
if go#util#ShellError() != 0
return -1
endif
return split(out, '\n')[0]
endfunction
function! go#tool#ParseErrors(lines)
let errors = []

View file

@ -25,6 +25,12 @@ function! go#util#LineEnding()
return "\n"
endfunction
" Join joins any number of path elements into a single path, adding a
" Separator if necessary and returns the result
function! go#util#Join(...)
return join(a:000, go#util#PathSep())
endfunction
" IsWin returns 1 if current OS is Windows or 0 otherwise
function! go#util#IsWin()
let win = ['win16', 'win32', 'win64', 'win95']
@ -125,85 +131,121 @@ function! go#util#Shelljoin(arglist, ...)
return join(map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')'), ' ')
endif
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
finally
let &shellslash = ssl_save
endtry
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
finally
let &shellslash = ssl_save
endtry
endfunction
fu! go#util#Shellescape(arg)
if s:has_vimproc()
return vimproc#shellescape(a:arg)
endif
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
if s:has_vimproc()
return vimproc#shellescape(a:arg)
endif
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
endf
" Shelllist returns a shell-safe representation of the items in the given
" arglist. The {special} argument of shellescape() may optionally be passed.
function! go#util#Shelllist(arglist, ...)
try
let ssl_save = &shellslash
set noshellslash
if a:0
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
endif
return map(copy(a:arglist), 'shellescape(v:val)')
finally
let &shellslash = ssl_save
endtry
try
let ssl_save = &shellslash
set noshellslash
if a:0
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
endif
return map(copy(a:arglist), 'shellescape(v:val)')
finally
let &shellslash = ssl_save
endtry
endfunction
" Returns the byte offset for line and column
function! go#util#Offset(line, col)
if &encoding != 'utf-8'
let sep = go#util#LineEnding()
let buf = a:line == 1 ? '' : (join(getline(1, a:line-1), sep) . sep)
let buf .= a:col == 1 ? '' : getline('.')[:a:col-2]
return len(iconv(buf, &encoding, 'utf-8'))
endif
return line2byte(a:line) + (a:col-2)
if &encoding != 'utf-8'
let sep = go#util#LineEnding()
let buf = a:line == 1 ? '' : (join(getline(1, a:line-1), sep) . sep)
let buf .= a:col == 1 ? '' : getline('.')[:a:col-2]
return len(iconv(buf, &encoding, 'utf-8'))
endif
return line2byte(a:line) + (a:col-2)
endfunction
"
" Returns the byte offset for the cursor
function! go#util#OffsetCursor()
return go#util#Offset(line('.'), col('.'))
return go#util#Offset(line('.'), col('.'))
endfunction
" Windo is like the built-in :windo, only it returns to the window the command
" was issued from
function! go#util#Windo(command)
let s:currentWindow = winnr()
try
execute "windo " . a:command
finally
execute s:currentWindow. "wincmd w"
unlet s:currentWindow
endtry
let s:currentWindow = winnr()
try
execute "windo " . a:command
finally
execute s:currentWindow. "wincmd w"
unlet s:currentWindow
endtry
endfunction
" snippetcase converts the given word to given preferred snippet setting type
" case.
function! go#util#snippetcase(word)
let l:snippet_case = get(g:, 'go_snippet_case_type', "snakecase")
if l:snippet_case == "snakecase"
return go#util#snakecase(a:word)
elseif l:snippet_case == "camelcase"
return go#util#camelcase(a:word)
else
return a:word " do nothing
endif
endfunction
" snakecase converts a string to snake case. i.e: FooBar -> foo_bar
" Copied from tpope/vim-abolish
function! go#util#snakecase(word)
let word = substitute(a:word,'::','/','g')
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
let word = substitute(word,'[.-]','_','g')
let word = tolower(word)
return word
endfunction
" camelcase converts a string to camel case. i.e: FooBar -> fooBar
" Copied from tpope/vim-abolish
function! go#util#camelcase(word)
let word = substitute(a:word, '-', '_', 'g')
if word !~# '_' && word =~# '\l'
return substitute(word,'^.','\l&','')
else
return substitute(word,'\C\(_\)\=\(.\)','\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g')
endif
endfunction
" TODO(arslan): I couldn't parameterize the highlight types. Check if we can
" simplify the following functions
function! go#util#EchoSuccess(msg)
redraws! | echon "vim-go: " | echohl Function | echon a:msg | echohl None
redraws! | echon "vim-go: " | echohl Function | echon a:msg | echohl None
endfunction
function! go#util#EchoError(msg)
redraws! | echon "vim-go: " | echohl ErrorMsg | echon a:msg | echohl None
redraws! | echon "vim-go: " | echohl ErrorMsg | echon a:msg | echohl None
endfunction
function! go#util#EchoWarning(msg)
redraws! | echon "vim-go: " | echohl WarningMsg | echon a:msg | echohl None
redraws! | echon "vim-go: " | echohl WarningMsg | echon a:msg | echohl None
endfunction
function! go#util#EchoProgress(msg)
redraws! | echon "vim-go: " | echohl Identifier | echon a:msg | echohl None
redraws! | echon "vim-go: " | echohl Identifier | echon a:msg | echohl None
endfunction
" vim: sw=2 ts=2 et

View file

@ -552,6 +552,17 @@ CTRL-t
object as does the selected identifier, within any package in the analysis
scope.
*:GoSameIds*
:GoSameIds
Highlights all identifiers that are equivalent to the identifier under the
cursor.
*:GoSameIdsClear*
:GoSameIdsClear
Clears all SameIds highlights from a |:GoSameIds| call.
*:GoMetaLinter*
:GoMetaLinter [path]
@ -778,7 +789,7 @@ Shows the godef tag stack
*(go-def-stack-clear)*
Resets and clers the tasg stack
Resets and clears the tag stack
*(go-def-pop)*
@ -920,11 +931,17 @@ with |:GoPlay|. By default it's enabled. >
Use this option to show the type info (|:GoInfo|) for the word under the cursor
automatically. Whenever the cursor changes the type info will be updated.
By default it's disabled >
By default it's disabled.
>
let g:go_auto_type_info = 0
<
*'g:go_auto_sameids'*
Use this option to highlight all uses of the identifier under the cursor
(:GoSameIds) automatically. By default it's disabled.
>
let g:go_auto_sameids = 0
<
*'g:go_jump_to_error'*
Use this option to enable/disable passing the bang attribute to the mappings
@ -1044,6 +1061,28 @@ is used. Use "neosnippet" for neosnippet.vim: >
let g:go_snippet_engine = "ultisnips"
<
*'g:go_snippet_case_type'*
Use this option to define the default conversion type of snippet expansion for
field tags. For the following case, if `snakecase` is used the `json` snippet
will expand to:
>
type T struct {
FooBarQuz string `json:"foo_bar_quz"
}
<
If "camelcase" is used:
>
type T struct {
FooBarQuz string `json:"fooBarQuz"
}
<
By default "snakecase" is used. Current values are: ["snakecase", "camelcase"].
>
let g:go_snippet_case_type = "snakecase"
<
*'g:go_get_update'*
Use this option to disable updating dependencies with |GoInstallBinaries|. By
@ -1118,23 +1157,17 @@ Highlights method names. By default it's disabled. >
let g:go_highlight_methods = 0
<
*'g:go_highlight_structs'*
*'g:go_highlight_types'*
Highlights struct names. By default it's disabled. >
Highlights struct and interface names. By default it's disabled. >
let g:go_highlight_structs = 0
let g:go_highlight_types = 0
<
*'g:go_highlight_fields'*
Highlights field names. By default it's disabled. >
let g:go_highlight_fields = 0
<
*'g:go_highlight_interfaces'*
Highlights interface names. By default it's disabled. >
let g:go_highlight_interfaces = 0
<
*'g:go_highlight_build_constraints'*
@ -1291,8 +1324,30 @@ Specifies whether `gocode` should add built-in types, functions and constants
to an autocompletion proposals. By default it is enabled.
>
let g:go_gocode_propose_builtins = 1
<
*g:go_template_autocreate*
When a new Go file is created, vim-go automatically fills the buffer content
with a Go code template. By default the template under
`templates/hello_world.go` is used. This can be changed with the
|g:go_template_file| setting.
If the new file is created in an already prepopulated package (with other Go
files), in this case a Go code template with only the Go package declaration
(which is automatically determined according to the current package) is added.
By default it is enabled.
>
let g:go_template_autocreate = 1
<
*g:go_template_file*
Specifies the file under the `templates` folder that is used if a new Go file
is created. Checkout |g:go_template_autocreate| for more info. By default the
`hello_world.go` file is used.
>
let g:go_template_file = "hello_world.go"
<
===============================================================================
TROUBLESHOOTING *go-troubleshooting*

View file

@ -12,9 +12,8 @@ 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>)
" TODO(arslan): enable this once the function is implemented
" command! -range=% GoSameIds call go#guru#SameIds(<count>)
command! -range=% GoSameIds call go#guru#SameIds(<count>)
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
" -- tool
command! -nargs=0 GoFiles echo go#tool#Files()

View file

@ -43,9 +43,7 @@ nnoremap <silent> <Plug>(go-callstack) :<C-u>call go#guru#Callstack(-1)<CR>
xnoremap <silent> <Plug>(go-freevars) :<C-u>call go#guru#Freevars(0)<CR>
nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#guru#ChannelPeers(-1)<CR>
nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#guru#Referrers(-1)<CR>
" TODO(arslan): enable this once the function is implemented
" nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds(-1)<CR>
nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds(-1)<CR>
nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR>

View file

@ -151,14 +151,7 @@ if err != nil {
${0}
endsnippet
# error snippet
snippet errt "Error test fatal " !b
if err != nil {
t.Fatal(err)
}
${0}
endsnippet
# error multiple return
snippet errn, "Error return with two return values" !b
if err != nil {
return ${1:nil}, err
@ -166,6 +159,23 @@ if err != nil {
${0}
endsnippet
# error panic
snippet errp "Error panic" !b
if err != nil {
panic(${1})
}
${0}
endsnippet
# error test
snippet errt "Error test fatal " !b
if err != nil {
t.Fatal(err)
}
${0}
endsnippet
# error handle
snippet errh "Error handle and return" !b
if err != nil {
${1}
@ -174,8 +184,9 @@ if err != nil {
${0}
endsnippet
# json field tag
snippet json "\`json:key\`"
\`json:"${1:keyName}"\`
\`json:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\`
endsnippet
# fallthrough

View file

@ -149,6 +149,14 @@ abbr if err != nil { return }
}
${0}
# error snippet with panic
snippet errp
abbr if err != nil { ... }
if err != nil {
panic(${1})
}
${0}
# json snippet
snippet json
abbr \`json:key\`

View file

@ -151,6 +151,11 @@ augroup vim-go
autocmd CursorHold *.go nested call go#complete#Info(1)
endif
" GoSameId automatic update
if get(g:, "go_auto_sameids", 0)
autocmd CursorMoved *.go nested call go#guru#SameIds(-1)
endif
" Echo the identifier information when completion is done. Useful to see
" the signature of a function, etc...
if exists('##CompleteDone')
@ -171,6 +176,11 @@ augroup vim-go
if get(g:, "go_metalinter_autosave", 0)
autocmd BufWritePost *.go call go#lint#Gometa(1)
endif
" create new template from scratch
if get(g:, "go_template_autocreate", 1)
autocmd BufNewFile *.go call go#template#create()
endif
augroup END
" vim: sw=2 ts=2 et

View file

@ -71,12 +71,8 @@ if !exists("g:go_highlight_fields")
let g:go_highlight_fields = 0
endif
if !exists("g:go_highlight_structs")
let g:go_highlight_structs = 0
endif
if !exists("g:go_highlight_interfaces")
let g:go_highlight_interfaces = 0
if !exists("g:go_highlight_types")
let g:go_highlight_types = 0
endif
if !exists("g:go_highlight_build_constraints")
@ -98,12 +94,10 @@ endif
syn case match
syn keyword goDirective package import
syn keyword goDeclaration var const type
syn keyword goDeclType struct interface
syn keyword goDeclaration var const
hi def link goDirective Statement
hi def link goDeclaration Keyword
hi def link goDeclType Keyword
" Keywords within functions
syn keyword goStatement defer go goto return break continue fallthrough
@ -129,10 +123,6 @@ hi def link goUnsignedInts Type
hi def link goFloats Type
hi def link goComplexes Type
" Treat func specially: it's a declaration at the start of a line, but a type
" elsewhere. Order matters here.
syn match goDeclaration /\<func\>/
" Predefined functions and values
syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
@ -296,43 +286,52 @@ if g:go_highlight_operators != 0
syn match goOperator /:=\|||\|<-\|++\|--/
" match ...
syn match goOperator /\.\.\./
hi def link goPointerOperator Operator
endif
hi def link goOperator Operator
" Functions;
if g:go_highlight_functions != 0
syn match goFunction /\(func\s\+\)\@<=\w\+\((\)\@=/
syn match goFunction /\()\s\+\)\@<=\w\+\((\)\@=/
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction skipwhite skipnl
syn match goReceiver /(\(\w\|[ *]\)\+)/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
syn match goReceiverVar /\w\+/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
syn match goReceiverType /\w\+/ contained
syn match goFunction /\w\+/ contained
else
syn keyword goDeclaration func
endif
hi def link goFunction Function
" Methods;
if g:go_highlight_methods != 0
syn match goMethod /\(\.\)\@<=\w\+\((\)\@=/
syn match goMethod /\.\w\+(/hs=s+1,he=e-1
endif
hi def link goMethod Type
" Fields;
if g:go_highlight_fields != 0
syn match goField /\(\.\)\@<=\a\+\([\ \n\r\:\)]\)\@=/
syn match goVarArgs /\.\.\.\w\+\>/
syn match goField /\.\a\+\([\ \n\r\:\)\[]\)\@=/hs=s+1
endif
hi def link goField Type
hi def link goField Identifier
" Structs;
if g:go_highlight_structs != 0
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
syn match goStructDef /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/
" Structs & Interfaces;
if g:go_highlight_types != 0
syn match goTypeConstructor /\<\w\+{/he=e-1
syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
syn match goDeclType /\<interface\|struct\>/ contained skipwhite skipnl
hi def link goReceiverType Type
else
syn keyword goDeclType struct interface
syn keyword goDeclaration type
endif
hi def link goStruct Function
hi def link goStructDef Function
" Interfaces;
if g:go_highlight_interfaces != 0
syn match goInterface /\(.\)\@<=\w\+\({\)\@=/
syn match goInterfaceDef /\(type\s\+\)\@<=\w\+\(\s\+interface\s\+{\)\@=/
endif
hi def link goInterface Function
hi def link goInterfaceDef Function
hi def link goTypeConstructor Type
hi def link goTypeName Type
hi def link goTypeDecl Keyword
hi def link goDeclType Keyword
" Build Constraints
if g:go_highlight_build_constraints != 0
@ -367,6 +366,7 @@ if g:go_highlight_build_constraints != 0
hi def link goPackageComment Comment
endif
hi def link goSameId IncSearch
" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/

View file

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View file

@ -85,12 +85,12 @@ let s:concealends = ''
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
let s:concealends = ' concealends'
endif
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart,@Spell' . s:concealends
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart,@Spell' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart,@Spell' . s:concealends
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart,@Spell' . s:concealends
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart

View file

@ -32,8 +32,8 @@ syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript
syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText
syn match pugTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
syn match pugComment '\s*\/\/.*$'
syn region pugCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend
syn match pugComment '\(\s\+\|^\)\/\/.*$'
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
syn match pugClassChar "\." contained nextgroup=pugClass

View file

@ -1,5 +1,27 @@
priority -50
global !p
def create_table(snip):
# retrieving single line from current string and treat it like tabstops count
placeholders_string = snip.buffer[snip.line].strip().split("x",1)
rows_amount = int(placeholders_string[0])
columns_amount = int(placeholders_string[1])
# erase current line
snip.buffer[snip.line] = ''
# create anonymous snippet with expected content and number of tabstops
anon_snippet_title = ' | '.join(['$' + str(col) for col in range(1,columns_amount+1)]) + "\n"
anon_snippet_delimiter = ':-|' * (columns_amount-1) + ":-\n"
anon_snippet_body = ""
for row in range(1,rows_amount+1):
anon_snippet_body += ' | '.join(['$' + str(row*columns_amount+col) for col in range(1,columns_amount+1)]) + "\n"
anon_snippet_table = anon_snippet_title + anon_snippet_delimiter + anon_snippet_body
# expand anonymous snippet
snip.expand_anon(anon_snippet_table)
endglobal
###########################
# Sections and Paragraphs #
###########################
@ -50,4 +72,21 @@ $1
$0
endsnippet
snippet refl "Reference Link"
[${1:${VISUAL:Text}}][${2:id}]$0
[$2]:${4:http://${3:www.url.com}} "${5:$4}"
endsnippet
snippet fnt "Footnote"
[^${1:${VISUAL:Footnote}}]$0
[^$1]:${2:Text}
endsnippet
post_jump "create_table(snip)"
snippet "tb(\d+x\d+)" "Customizable table" br
`!p snip.rv = match.group(1)`
endsnippet
# vim:ft=snippets:

View file

@ -1,5 +1,14 @@
priority -50
global !p
import vim
# Set g:ultisnips_php_scalar_types to 1 if you'd like to enable PHP 7's scalar types for return values
def isPHPScalarTypesEnabled():
isEnabled = vim.eval("get(g:, 'ultisnips_php_scalar_types', 0)") == "1"
return isEnabled or re.match('<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer))
endglobal
## Snippets from SnipMate, taken from
## https://github.com/scrooloose/snipmate-snippets.git
@ -9,7 +18,7 @@ snippet gm "PHP Class Getter" b
*
* @return ${2:string}
*/
public function get${1/\w+\s*/\u$0/}()
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
{
return $this->$1;
}
@ -36,7 +45,7 @@ snippet gs "PHP Class Getter Setter" b
*
* @return ${2:string}
*/
public function get${1/\w+\s*/\u$0/}()
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
{
return $this->$1;
}

View file

@ -159,18 +159,18 @@ snippet address
${0}
</address>
snippet area
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}">
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}" />
snippet area+
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}">
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
area+
snippet area:c
<area shape="circle" coords="${1}" href="${2}" alt="${0}">
<area shape="circle" coords="${1}" href="${2}" alt="${0}" />
snippet area:d
<area shape="default" coords="${1}" href="${2}" alt="${0}">
<area shape="default" coords="${1}" href="${2}" alt="${0}" />
snippet area:p
<area shape="poly" coords="${1}" href="${2}" alt="${0}">
<area shape="poly" coords="${1}" href="${2}" alt="${0}" />
snippet area:r
<area shape="rect" coords="${1}" href="${2}" alt="${0}">
<area shape="rect" coords="${1}" href="${2}" alt="${0}" />
snippet article
<article>
${0}
@ -200,7 +200,7 @@ snippet audio
snippet b
<b>${0}</b>
snippet base
<base href="${1}" target="${0}">
<base href="${1}" target="${0}" />
snippet bdi
<bdi>${0}</bdo>
snippet bdo
@ -218,7 +218,7 @@ snippet body
${0}
</body>
snippet br
<br>
<br />
snippet button
<button type="${1:submit}">${0}</button>
snippet button.
@ -240,9 +240,9 @@ snippet cite
snippet code
<code>${0}</code>
snippet col
<col>
<col />
snippet col+
<col>
<col />
col+
snippet colgroup
<colgroup>
@ -330,7 +330,7 @@ snippet dt+
snippet em
<em>${0}</em>
snippet embed
<embed src="${1}" type="${0}">
<embed src="${1}" type="${0}" />
snippet fieldset
<fieldset>
${0}
@ -423,7 +423,7 @@ snippet h6#
<h6 id="${1}">${0}</h6>
snippet head
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${0}
@ -449,7 +449,7 @@ snippet hgroup.
${0}
</hgroup>
snippet hr
<hr>
<hr />
snippet html
<html>
${0}
@ -462,8 +462,8 @@ snippet html5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2:link}
</head>
@ -475,8 +475,8 @@ snippet html5l
<!DOCTYPE html>
<html lang="${1:es}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${3:link}
</head>
@ -493,65 +493,63 @@ snippet iframe.
snippet iframe#
<iframe id="${1}" src="${2}" frameborder="0"></iframe>
snippet img
<img src="${1}" alt="${2}">
<img src="${1}" alt="${2}" />
snippet img.
<img class="${1}" src="${2}" alt="${3}">
<img class="${1}" src="${2}" alt="${3}" />
snippet img#
<img id="${1}" src="${2}" alt="${3}">
<img id="${1}" src="${2}" alt="${3}" />
snippet input
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}">
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" />
snippet input.
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}">
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" />
snippet input:text
<input type="text" name="${1}" id="${2:$1}" value="${3}">
<input type="text" name="${1}" id="${2:$1}" value="${3}" />
snippet input:submit
<input type="submit" name="${1}" id="${2:$1}" value="${3}">
<input type="submit" name="${1}" id="${2:$1}" value="${3}" />
snippet input:hidden
<input type="hidden" name="${1}" id="${2:$1}" value="${3}">
<input type="hidden" name="${1}" id="${2:$1}" value="${3}" />
snippet input:button
<input type="button" name="${1}" id="${2:$1}" value="${3}">
<input type="button" name="${1}" id="${2:$1}" value="${3}" />
snippet input:image
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}">
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" />
snippet input:checkbox
<input type="checkbox" name="${1}" id="${2:$1}">
<input type="checkbox" name="${1}" id="${2:$1}" />
snippet input:radio
<input type="radio" name="${1}" id="${2:$1}">
<input type="radio" name="${1}" id="${2:$1}" />
snippet input:color
<input type="color" name="${1}" id="${2:$1}" value="${3}">
<input type="color" name="${1}" id="${2:$1}" value="${3}" />
snippet input:date
<input type="date" name="${1}" id="${2:$1}" value="${3}">
<input type="date" name="${1}" id="${2:$1}" value="${3}" />
snippet input:datetime
<input type="datetime" name="${1}" id="${2:$1}" value="${3}">
<input type="datetime" name="${1}" id="${2:$1}" value="${3}" />
snippet input:datetime-local
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}">
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" />
snippet input:email
<input type="email" name="${1}" id="${2:$1}" value="${3}">
<input type="email" name="${1}" id="${2:$1}" value="${3}" />
snippet input:file
<input type="file" name="${1}" id="${2:$1}" value="${3}">
<input type="file" name="${1}" id="${2:$1}" value="${3}" />
snippet input:month
<input type="month" name="${1}" id="${2:$1}" value="${3}">
<input type="month" name="${1}" id="${2:$1}" value="${3}" />
snippet input:number
<input type="number" name="${1}" id="${2:$1}" value="${3}">
<input type="number" name="${1}" id="${2:$1}" value="${3}" />
snippet input:password
<input type="password" name="${1}" id="${2:$1}" value="${3}">
<input type="password" name="${1}" id="${2:$1}" value="${3}" />
snippet input:range
<input type="range" name="${1}" id="${2:$1}" value="${3}">
<input type="range" name="${1}" id="${2:$1}" value="${3}" />
snippet input:reset
<input type="reset" name="${1}" id="${2:$1}" value="${3}">
<input type="reset" name="${1}" id="${2:$1}" value="${3}" />
snippet input:search
<input type="search" name="${1}" id="${2:$1}" value="${3}">
<input type="search" name="${1}" id="${2:$1}" value="${3}" />
snippet input:time
<input type="time" name="${1}" id="${2:$1}" value="${3}">
<input type="time" name="${1}" id="${2:$1}" value="${3}" />
snippet input:url
<input type="url" name="${1}" id="${2:$1}" value="${3}">
<input type="url" name="${1}" id="${2:$1}" value="${3}" />
snippet input:week
<input type="week" name="${1}" id="${2:$1}" value="${3}">
<input type="week" name="${1}" id="${2:$1}" value="${3}" />
snippet ins
<ins>${0}</ins>
snippet kbd
<kbd>${0}</kbd>
snippet keygen
<keygen>${0}</keygen>
snippet label
<label for="${0:$1}">${1}</label>
snippet label:i
@ -579,19 +577,19 @@ snippet lia+
<li><a href="${2:#}">${1}</a></li>
lia+
snippet link
<link rel="${1}" href="${2}" title="${3}" type="${4}">
<link rel="${1}" href="${2}" title="${3}" type="${4}" />
snippet link:atom
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml">
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />
snippet link:s
<link rel="stylesheet" href="${1:style.css}">
<link rel="stylesheet" href="${1:style.css}" />
snippet link:css
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />
snippet link:favicon
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon">
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" />
snippet link:rss
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml">
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />
snippet link:touch
<link rel="apple-touch-icon" href="${1:favicon.png}">
<link rel="apple-touch-icon" href="${1:favicon.png}" />
snippet main
<main role="main">
${0}
@ -610,7 +608,7 @@ snippet map#
</map>
snippet map+
<map name="${1}">
<area shape="${2}" coords="${3}" href="${4}" alt="${5}">${6}
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
</map>
snippet mark
<mark>${0}</mark>
@ -627,17 +625,17 @@ snippet menu:t
${0}
</menu>
snippet meta
<meta http-equiv="${1}" content="${2}">
<meta http-equiv="${1}" content="${2}" />
snippet meta:s
<meta ${0}>
<meta ${0} />
snippet meta:d
<meta name="description" content="${0}">
<meta name="description" content="${0}" />
snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}">
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />
snippet meta:refresh
<meta http-equiv="refresh" content="text/html;charset=UTF-8">
<meta http-equiv="refresh" content="text/html;charset=UTF-8" />
snippet meta:utf
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
snippet meter
<meter>${0}</meter>
snippet nav
@ -665,13 +663,13 @@ snippet movie
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="$1" />
<param name="controller" value="$4">
<param name="autoplay" value="$5">
<param name="controller" value="$4" />
<param name="autoplay" value="$5" />
<embed src="${1:movie.mov}"
width="${2:320}" height="${3:240}"
controller="${4:true}" autoplay="${5:true}"
scale="tofit" cache="true"
pluginspage="http://www.apple.com/quicktime/download/">
pluginspage="http://www.apple.com/quicktime/download/" />
</object>
snippet ol
<ol>
@ -711,7 +709,7 @@ snippet p.
snippet p#
<p id="${1}">${0}</p>
snippet param
<param name="${1}" value="${2}">
<param name="${1}" value="${2}" />
snippet pre
<pre>
${0}
@ -774,7 +772,7 @@ snippet select+
snippet small
<small>${0}</small>
snippet source
<source src="${1}" type="${2}" media="${0}">
<source src="${1}" type="${2}" media="${0}" />
snippet span
<span>${0}</span>
snippet span.
@ -853,7 +851,7 @@ snippet tr+
td+${0}
</tr>
snippet track
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}</track>
<track src="${1}" srclang="${2}" label="${3}" default="${4:default} />${5}
snippet ul
<ul>
${0}
@ -876,4 +874,4 @@ snippet var
snippet video
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>
snippet wbr
<wbr>
<wbr />

View file

@ -2,6 +2,8 @@ snippet <?
<?php
${0}
snippet dst "declare(strict_types=1)"
declare(strict_types=${1:1});
snippet ec
echo ${0};
snippet <?e

View file

@ -84,9 +84,9 @@ set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
else
set wildignore+=.git\*,.hg\*,.svn\*
else
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif
"Always show current position

View file

@ -159,7 +159,7 @@ func! SyntasticCheckCoffeescript()
execute "SyntasticCheck"
execute "Errors"
endfunc
nnoremap <silent> <leader>l :call SyntasticCheckCoffeescript()<cr>
nnoremap <silent> <leader>c :call SyntasticCheckCoffeescript()<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""