Updated plugins. Added vim-golang as a mode
This commit is contained in:
parent
2b82c75631
commit
8f0740e307
125 changed files with 4121 additions and 2440 deletions
|
@ -99,6 +99,7 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ
|
||||||
* [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako)
|
* [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako)
|
||||||
* [vim-markdown](https://github.com/tpope/vim-markdown)
|
* [vim-markdown](https://github.com/tpope/vim-markdown)
|
||||||
* [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx
|
* [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx
|
||||||
|
* [vim-golang](https://github.com/jnwhiteh/vim-golang)
|
||||||
|
|
||||||
|
|
||||||
## How to include your own stuff?
|
## How to include your own stuff?
|
||||||
|
|
|
@ -44,7 +44,7 @@ function! s:Ack(cmd, args)
|
||||||
if a:cmd =~# '-g$'
|
if a:cmd =~# '-g$'
|
||||||
let g:ackformat="%f"
|
let g:ackformat="%f"
|
||||||
else
|
else
|
||||||
let g:ackformat="%f:%l:%c:%m"
|
let g:ackformat="%f:%l:%c:%m,%f:%l:%m"
|
||||||
end
|
end
|
||||||
|
|
||||||
let grepprg_bak=&grepprg
|
let grepprg_bak=&grepprg
|
||||||
|
@ -61,13 +61,15 @@ function! s:Ack(cmd, args)
|
||||||
if a:cmd =~# '^l'
|
if a:cmd =~# '^l'
|
||||||
exe g:ack_lhandler
|
exe g:ack_lhandler
|
||||||
let l:apply_mappings = g:ack_apply_lmappings
|
let l:apply_mappings = g:ack_apply_lmappings
|
||||||
|
let l:close_cmd = ':lclose<CR>'
|
||||||
else
|
else
|
||||||
exe g:ack_qhandler
|
exe g:ack_qhandler
|
||||||
let l:apply_mappings = g:ack_apply_qmappings
|
let l:apply_mappings = g:ack_apply_qmappings
|
||||||
|
let l:close_cmd = ':cclose<CR>'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:apply_mappings
|
if l:apply_mappings
|
||||||
exec "nnoremap <silent> <buffer> q :ccl<CR>"
|
exec "nnoremap <silent> <buffer> q " . l:close_cmd
|
||||||
exec "nnoremap <silent> <buffer> t <C-W><CR><C-W>T"
|
exec "nnoremap <silent> <buffer> t <C-W><CR><C-W>T"
|
||||||
exec "nnoremap <silent> <buffer> T <C-W><CR><C-W>TgT<C-W><C-W>"
|
exec "nnoremap <silent> <buffer> T <C-W><CR><C-W>TgT<C-W><C-W>"
|
||||||
exec "nnoremap <silent> <buffer> o <CR>"
|
exec "nnoremap <silent> <buffer> o <CR>"
|
||||||
|
@ -80,7 +82,7 @@ function! s:Ack(cmd, args)
|
||||||
|
|
||||||
" If highlighting is on, highlight the search keyword.
|
" If highlighting is on, highlight the search keyword.
|
||||||
if exists("g:ackhighlight")
|
if exists("g:ackhighlight")
|
||||||
let @/=a:args
|
let @/ = substitute(l:grepargs,'["'']','','g')
|
||||||
set hlsearch
|
set hlsearch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++,
|
||||||
OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket,
|
OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket,
|
||||||
reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig,
|
reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig,
|
||||||
TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope
|
TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope
|
||||||
page templates, zsh.
|
page templates, and zsh.
|
||||||
|
|
||||||
Below is a screenshot showing the methods that Syntastic uses to display syntax
|
Below is a screenshot showing the methods that Syntastic uses to display syntax
|
||||||
errors. Note that, in practise, you will only have a subset of these methods
|
errors. Note that, in practise, you will only have a subset of these methods
|
||||||
|
@ -62,45 +62,48 @@ enabled.
|
||||||
|
|
||||||
## 2\. Installation
|
## 2\. Installation
|
||||||
|
|
||||||
Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already
|
Installing syntastic is easy but first you need to have the [pathogen][1]
|
||||||
have pathogen working then skip Step 1 and go to Step 2.
|
plugin installed. If you already have [pathogen][1] working then skip
|
||||||
|
[Step 1](#step1) and go to [Step 2](#step2).
|
||||||
|
|
||||||
|
|
||||||
<a name="step1"></a>
|
<a name="step1"></a>
|
||||||
|
|
||||||
### 2.1\. Step 1: Install pathogen.vim
|
### 2.1\. Step 1: Install pathogen.vim
|
||||||
|
|
||||||
First I'll show you how to install tpope's [pathogen.vim][1] so that it's
|
First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to
|
||||||
easy to install syntastic. Do this in your Terminal so that you get the
|
install syntastic. Do this in your terminal so that you get the `pathogen.vim`
|
||||||
pathogen.vim file and the directories it needs:
|
file and the directories it needs:
|
||||||
|
```sh
|
||||||
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
|
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
|
||||||
curl -so ~/.vim/autoload/pathogen.vim \
|
curl -so ~/.vim/autoload/pathogen.vim \
|
||||||
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
|
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
|
||||||
|
```
|
||||||
Next you *need to add this* to your ~/.vimrc:
|
Next you *need* to add this to your `~/.vimrc`:
|
||||||
|
```vim
|
||||||
execute pathogen#infect()
|
execute pathogen#infect()
|
||||||
|
```
|
||||||
|
|
||||||
<a name="step2"></a>
|
<a name="step2"></a>
|
||||||
|
|
||||||
### 2.2\. Step 2: Install syntastic as a pathogen bundle
|
### 2.2\. Step 2: Install syntastic as a pathogen bundle
|
||||||
|
|
||||||
You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:
|
You now have pathogen installed and can put syntastic into `~/.vim/bundle` like
|
||||||
|
this:
|
||||||
|
```sh
|
||||||
cd ~/.vim/bundle
|
cd ~/.vim/bundle
|
||||||
git clone https://github.com/scrooloose/syntastic.git
|
git clone https://github.com/scrooloose/syntastic.git
|
||||||
|
```
|
||||||
Quit vim and start it back up to reload it, then type:
|
Quit vim and start it back up to reload it, then type:
|
||||||
|
```vim
|
||||||
|
:Helptags
|
||||||
|
```
|
||||||
|
If you get an error when you do this, then you probably didn't install
|
||||||
|
[pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the following:
|
||||||
|
|
||||||
:Helptags
|
1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories.
|
||||||
|
2. Added the `call pathogen#infect()` line to your `~/.vimrc` file
|
||||||
If you get an error when you do this, then you probably didn't install pathogen right. Go back to
|
3. Did the `git clone` of syntastic inside `~/.vim/bundle`
|
||||||
step 1 and make sure you did the following:
|
|
||||||
|
|
||||||
1. Created both the ~/.vim/autoload and ~/.vim/bundle directories.
|
|
||||||
2. Added the "call pathogen#infect()" line to your ~/.vimrc file
|
|
||||||
3. Did the git clone of syntastic inside ~/.vim/bundle
|
|
||||||
4. Have permissions to access all of these directories.
|
4. Have permissions to access all of these directories.
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,56 +114,50 @@ step 1 and make sure you did the following:
|
||||||
__Q. I installed syntastic but it isn't reporting any errors...__
|
__Q. I installed syntastic but it isn't reporting any errors...__
|
||||||
|
|
||||||
A. The most likely reason is that none of the syntax checkers that it requires
|
A. The most likely reason is that none of the syntax checkers that it requires
|
||||||
is installed. For example: python requires either `flake8`, `pyflakes`
|
is installed. For example: by default, python requires either `flake8` or
|
||||||
or `pylint` to be installed and in `$PATH`. To see which executables are
|
`pylint` to be installed and in your `$PATH`. To see which executables are
|
||||||
supported, just look in `syntax_checkers/<filetype>/*.vim`. Note that aliases
|
supported, look at the [wiki][3]. Note that aliases do not work; the actual
|
||||||
do not work; the actual executable must be available in your `$PATH`. Symbolic
|
executables must be available in your `$PATH`. Symbolic links are okay though.
|
||||||
links are okay. You can see syntastic's idea of available checkers by running
|
You can see syntastic's idea of available checkers by running `:SyntasticInfo`.
|
||||||
`:SyntasticInfo`.
|
|
||||||
|
|
||||||
Another reason it could fail is that either the command line options or the
|
Another reason it could fail is that either the command line options or the
|
||||||
error output for a syntax checker may have changed. In this case, make sure you
|
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
|
have the latest version of the syntax checker installed. If it still fails then
|
||||||
create an issue - or better yet, create a pull request.
|
create an issue - or better yet, create a pull request.
|
||||||
|
|
||||||
__Q. Recently some of my syntax checker options have stopped working...__
|
__Q. The `perl` checker has stopped working...__
|
||||||
|
|
||||||
A. The options are still there, they have just been renamed. Recently,
|
A. The `perl` checker runs `perl -c` against your file, which in turn
|
||||||
almost all syntax checkers were refactored to use the new `makeprgBuild()`
|
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
|
||||||
function. This made a lot of the old explicit options redundant - as they are
|
statements in your file (cf. [perlrun][10]). This is probably fine if you
|
||||||
now implied. The new implied options usually have slightly different names to
|
wrote the file yourself, but it's a security problem if you're checking third
|
||||||
the old options.
|
party files. Since there is currently no way to disable this behaviour while
|
||||||
|
still producing useful results, the checker is now disabled by default. To
|
||||||
e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use
|
(re-)enable it, set `g:syntastic_enable_perl_checker` to 1 in your vimrc:
|
||||||
`g:syntastic_php_phpcs_args`. This completely overrides the arguments of
|
```vim
|
||||||
the checker, including any defaults, so you may need to look up the default
|
let g:syntastic_enable_perl_checker = 1
|
||||||
arguments of the checker and add these in.
|
```
|
||||||
|
|
||||||
See `:help syntastic-checker-options` for more information.
|
|
||||||
|
|
||||||
__Q. I run a checker and the location list is not updated...__
|
__Q. I run a checker and the location list is not updated...__
|
||||||
|
|
||||||
A. By default, the location list is changed only when you run the `:Errors`
|
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
|
command, in order to minimise conflicts with other plugins. If you want the
|
||||||
location list to always be updated when you run the checkers, add this line to
|
location list to always be updated when you run the checkers, add this line to
|
||||||
your vimrc:
|
your vimrc:
|
||||||
```vim
|
```vim
|
||||||
let g:syntastic_always_populate_loc_list=1
|
let g:syntastic_always_populate_loc_list = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
__Q. How can I pass additional arguments to a checker?__
|
__Q. How can I pass additional arguments to a checker?__
|
||||||
|
|
||||||
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
|
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
|
||||||
that do can be configured using global variables. The general form of the
|
that do can be configured using global variables. The general form of the
|
||||||
global args variables are:
|
global `args` variables is `syntastic_<filetype>_<checker>_args`.
|
||||||
```vim
|
|
||||||
syntastic_<filetype>_<subchecker>_args
|
|
||||||
```
|
|
||||||
|
|
||||||
So, If you wanted to pass "--my --args --here" to the ruby mri checker you
|
So, If you wanted to pass "--my --args --here" to the ruby mri checker you
|
||||||
would add this line to your vimrc:
|
would add this line to your vimrc:
|
||||||
```vim
|
```vim
|
||||||
let g:syntastic_ruby_mri_args="--my --args --here"
|
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||||
```
|
```
|
||||||
|
|
||||||
See `:help syntastic-checker-options` for more information.
|
See `:help syntastic-checker-options` for more information.
|
||||||
|
@ -170,24 +167,24 @@ which one(s) to use?__
|
||||||
|
|
||||||
A. Stick a line like this in your vimrc:
|
A. Stick a line like this in your vimrc:
|
||||||
```vim
|
```vim
|
||||||
let g:syntastic_<filetype>_checkers=['<checker-name>']
|
let g:syntastic_<filetype>_checkers = ['<checker-name>']
|
||||||
```
|
```
|
||||||
|
|
||||||
To see the list of checkers for your filetype, look in
|
To see the list of supported checkers for your filetype look at the
|
||||||
`syntax_checkers/<filetype>/`.
|
[wiki][3].
|
||||||
|
|
||||||
e.g. Python has the following checkers: `flake8`, `pyflakes`, `pylint` and a
|
e.g. Python has the following checkers, among others: `flake8`, `pyflakes`,
|
||||||
native `python` checker.
|
`pylint` and a native `python` checker.
|
||||||
|
|
||||||
To tell syntastic to use `pylint`, you would use this setting:
|
To tell syntastic to use `pylint`, you would use this setting:
|
||||||
```vim
|
```vim
|
||||||
let g:syntastic_python_checkers=['pylint']
|
let g:syntastic_python_checkers = ['pylint']
|
||||||
```
|
```
|
||||||
|
|
||||||
Some filetypes, like PHP, have style checkers as well as syntax checkers. These
|
Some filetypes, like PHP, have style checkers as well as syntax checkers. These
|
||||||
can be chained together like this:
|
can be chained together like this:
|
||||||
```vim
|
```vim
|
||||||
let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']
|
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
|
||||||
```
|
```
|
||||||
|
|
||||||
This is telling syntastic to run the `php` checker first, and if no errors are
|
This is telling syntastic to run the `php` checker first, and if no errors are
|
||||||
|
@ -210,6 +207,13 @@ checkers. You can usually configure the options that are passed to the style
|
||||||
checkers, or just disable them. Take a look at the [wiki][3] to see what
|
checkers, or just disable them. Take a look at the [wiki][3] to see what
|
||||||
options are available.
|
options are available.
|
||||||
|
|
||||||
|
Alternatively, you can use `g:syntastic_quiet_messages` to filter out the
|
||||||
|
messages you don't want to see. e.g. To turn off all style messages:
|
||||||
|
```vim
|
||||||
|
let g:syntastic_quiet_messages = { "type": "style" }
|
||||||
|
```
|
||||||
|
See `:help syntastic_quiet_messages` for details.
|
||||||
|
|
||||||
__Q. The error window is closed automatically when I :quit the current buffer
|
__Q. The error window is closed automatically when I :quit the current buffer
|
||||||
but not when I :bdelete it?__
|
but not when I :bdelete it?__
|
||||||
|
|
||||||
|
@ -245,3 +249,4 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
|
||||||
[7]: https://github.com/davidhalter/jedi-vim
|
[7]: https://github.com/davidhalter/jedi-vim
|
||||||
[8]: https://github.com/klen/python-mode
|
[8]: https://github.com/klen/python-mode
|
||||||
[9]: https://github.com/Valloric/YouCompleteMe
|
[9]: https://github.com/Valloric/YouCompleteMe
|
||||||
|
[10]: http://perldoc.perl.org/perlrun.html#*-c*
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"============================================================================
|
"============================================================================
|
||||||
"File: syntastic.vim
|
"File: syntastic.vim
|
||||||
"Description: Vim plugin for on the fly syntax checking.
|
"Description: Vim plugin for on the fly syntax checking.
|
||||||
"Version: 3.4.0-pre
|
|
||||||
"License: This program is free software. It comes without any warranty,
|
"License: This program is free software. It comes without any warranty,
|
||||||
" to the extent permitted by applicable law. You can redistribute
|
" 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
|
" it and/or modify it under the terms of the Do What The Fuck You
|
||||||
|
@ -19,6 +18,8 @@ if has('reltime')
|
||||||
let g:syntastic_start = reltime()
|
let g:syntastic_start = reltime()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let g:syntastic_version = '3.4.0'
|
||||||
|
|
||||||
" Sanity checks {{{1
|
" Sanity checks {{{1
|
||||||
|
|
||||||
for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands']
|
for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands']
|
||||||
|
@ -286,6 +287,7 @@ function! s:CacheErrors(checker_names) " {{{2
|
||||||
|
|
||||||
if !s:skipFile()
|
if !s:skipFile()
|
||||||
" debug logging {{{3
|
" debug logging {{{3
|
||||||
|
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'version')
|
||||||
call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options)
|
call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options)
|
||||||
call syntastic#log#debugDump(g:SyntasticDebugVariables)
|
call syntastic#log#debugDump(g:SyntasticDebugVariables)
|
||||||
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'aggregate_errors')
|
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'aggregate_errors')
|
||||||
|
@ -303,17 +305,16 @@ function! s:CacheErrors(checker_names) " {{{2
|
||||||
|
|
||||||
let names = []
|
let names = []
|
||||||
for checker in clist
|
for checker in clist
|
||||||
let type = checker.getFiletype()
|
let cname = checker.getFiletype() . '/' . checker.getName()
|
||||||
let name = checker.getName()
|
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Invoking checker: ' . cname)
|
||||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Invoking checker: ' . type . '/' . name)
|
|
||||||
|
|
||||||
let loclist = checker.getLocList()
|
let loclist = checker.getLocList()
|
||||||
|
|
||||||
if !loclist.isEmpty()
|
if !loclist.isEmpty()
|
||||||
if decorate_errors
|
if decorate_errors
|
||||||
call loclist.decorate(type, name)
|
call loclist.decorate(cname)
|
||||||
endif
|
endif
|
||||||
call add(names, [type, name])
|
call add(names, cname)
|
||||||
|
|
||||||
let newLoclist = newLoclist.extend(loclist)
|
let newLoclist = newLoclist.extend(loclist)
|
||||||
|
|
||||||
|
@ -325,13 +326,13 @@ function! s:CacheErrors(checker_names) " {{{2
|
||||||
|
|
||||||
" set names {{{3
|
" set names {{{3
|
||||||
if !empty(names)
|
if !empty(names)
|
||||||
if len(syntastic#util#unique(map( copy(names), 'v:val[0]' ))) == 1
|
if len(syntastic#util#unique(map( copy(names), 'substitute(v:val, "\\m/.*", "", "")' ))) == 1
|
||||||
let type = names[0][0]
|
let type = substitute(names[0], '\m/.*', '', '')
|
||||||
let name = join(map(names, 'v:val[1]'), ', ')
|
let name = join(map( names, 'substitute(v:val, "\\m.\\{-}/", "", "")' ), ', ')
|
||||||
call newLoclist.setName( name . ' ('. type . ')' )
|
call newLoclist.setName( name . ' ('. type . ')' )
|
||||||
else
|
else
|
||||||
" checkers from mixed types
|
" checkers from mixed types
|
||||||
call newLoclist.setName(join(map(names, 'v:val[0] . "/" . v:val[1]'), ', '))
|
call newLoclist.setName(join(names, ', '))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
" }}}3
|
" }}}3
|
||||||
|
@ -416,13 +417,16 @@ function! SyntasticMake(options) " {{{2
|
||||||
|
|
||||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'checker output:', err_lines)
|
call syntastic#log#debug(g:SyntasticDebugLoclist, 'checker output:', err_lines)
|
||||||
|
|
||||||
if has_key(a:options, 'preprocess')
|
if has_key(a:options, 'Preprocess')
|
||||||
|
let err_lines = call(a:options['Preprocess'], [err_lines])
|
||||||
|
call syntastic#log#debug(g:SyntasticDebugLoclist, 'preprocess (external):', err_lines)
|
||||||
|
elseif has_key(a:options, 'preprocess')
|
||||||
let err_lines = call('syntastic#preprocess#' . a:options['preprocess'], [err_lines])
|
let err_lines = call('syntastic#preprocess#' . a:options['preprocess'], [err_lines])
|
||||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'preprocess:', err_lines)
|
call syntastic#log#debug(g:SyntasticDebugLoclist, 'preprocess:', err_lines)
|
||||||
endif
|
endif
|
||||||
lgetexpr err_lines
|
lgetexpr err_lines
|
||||||
|
|
||||||
let errors = copy(getloclist(0))
|
let errors = deepcopy(getloclist(0))
|
||||||
|
|
||||||
if has_key(a:options, 'cwd')
|
if has_key(a:options, 'cwd')
|
||||||
execute 'lcd ' . fnameescape(old_cwd)
|
execute 'lcd ' . fnameescape(old_cwd)
|
||||||
|
@ -456,7 +460,12 @@ function! SyntasticMake(options) " {{{2
|
||||||
call s:addToErrors(errors, { 'subtype': a:options['subtype'] })
|
call s:addToErrors(errors, { 'subtype': a:options['subtype'] })
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has_key(a:options, 'postprocess') && !empty(a:options['postprocess'])
|
if has_key(a:options, 'Postprocess') && !empty(a:options['Postprocess'])
|
||||||
|
for rule in a:options['Postprocess']
|
||||||
|
let errors = call(rule, [errors])
|
||||||
|
endfor
|
||||||
|
call syntastic#log#debug(g:SyntasticDebugLoclist, 'postprocess (external):', errors)
|
||||||
|
elseif has_key(a:options, 'postprocess') && !empty(a:options['postprocess'])
|
||||||
for rule in a:options['postprocess']
|
for rule in a:options['postprocess']
|
||||||
let errors = call('syntastic#postprocess#' . rule, [errors])
|
let errors = call('syntastic#postprocess#' . rule, [errors])
|
||||||
endfor
|
endfor
|
||||||
|
|
|
@ -114,9 +114,9 @@ function! g:SyntasticLoclist.setName(name) " {{{2
|
||||||
let self._name = a:name
|
let self._name = a:name
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! g:SyntasticLoclist.decorate(filetype, name) " {{{2
|
function! g:SyntasticLoclist.decorate(tag) " {{{2
|
||||||
for e in self._rawLoclist
|
for e in self._rawLoclist
|
||||||
let e['text'] .= ' [' . a:filetype . '/' . a:name . ']'
|
let e['text'] .= ' [' . a:tag . ']'
|
||||||
endfor
|
endfor
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ let s:defaultCheckers = {
|
||||||
\ 'coq': ['coqtop'],
|
\ 'coq': ['coqtop'],
|
||||||
\ 'cpp': ['gcc'],
|
\ 'cpp': ['gcc'],
|
||||||
\ 'cs': ['mcs'],
|
\ 'cs': ['mcs'],
|
||||||
\ 'css': ['csslint', 'phpcs'],
|
\ 'css': ['csslint'],
|
||||||
\ 'cucumber': ['cucumber'],
|
\ 'cucumber': ['cucumber'],
|
||||||
\ 'cuda': ['nvcc'],
|
\ 'cuda': ['nvcc'],
|
||||||
\ 'd': ['dmd'],
|
\ 'd': ['dmd'],
|
||||||
|
@ -54,7 +54,7 @@ let s:defaultCheckers = {
|
||||||
\ 'objc': ['gcc'],
|
\ 'objc': ['gcc'],
|
||||||
\ 'objcpp': ['gcc'],
|
\ 'objcpp': ['gcc'],
|
||||||
\ 'ocaml': ['camlp4o'],
|
\ 'ocaml': ['camlp4o'],
|
||||||
\ 'perl': ['perl', 'perlcritic'],
|
\ 'perl': ['perlcritic'],
|
||||||
\ 'php': ['php', 'phpcs', 'phpmd'],
|
\ 'php': ['php', 'phpcs', 'phpmd'],
|
||||||
\ 'po': ['msgfmt'],
|
\ 'po': ['msgfmt'],
|
||||||
\ 'pod': ['podchecker'],
|
\ 'pod': ['podchecker'],
|
||||||
|
@ -142,14 +142,14 @@ function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2
|
||||||
let ft = s:normaliseFiletype(a:ftalias)
|
let ft = s:normaliseFiletype(a:ftalias)
|
||||||
call self._checkDeprecation(ft)
|
call self._checkDeprecation(ft)
|
||||||
|
|
||||||
let ft_list =
|
let names =
|
||||||
\ !empty(a:list) ? a:list :
|
\ !empty(a:list) ? a:list :
|
||||||
\ exists('b:syntastic_checkers') ? b:syntastic_checkers :
|
\ exists('b:syntastic_checkers') ? b:syntastic_checkers :
|
||||||
\ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers :
|
\ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers :
|
||||||
\ get(s:defaultCheckers, ft, [])
|
\ get(s:defaultCheckers, ft, 0)
|
||||||
|
|
||||||
return !empty(ft_list) ?
|
return type(names) == type([]) ?
|
||||||
\ self._filterCheckersByName(checkers_map, ft_list) : [checkers_map[keys(checkers_map)[0]]]
|
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
|
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
|
||||||
|
|
|
@ -41,7 +41,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return term != '' ? '\V\<' . term . '\>' : ''
|
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
|
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
|
||||||
|
|
|
@ -26,7 +26,7 @@ set cpo&vim
|
||||||
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
|
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
|
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
|
||||||
if term != ''
|
if term != ''
|
||||||
let term = '\V' . term
|
let term = '\V' . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
return term
|
return term
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
-export([main/1]).
|
-export([main/1]).
|
||||||
|
|
||||||
main([FileName]) ->
|
main([FileName]) ->
|
||||||
LibDirs = filelib:wildcard("{lib,deps}/*/ebin"),
|
LibDirs = (["ebin", "include", "src", "test"] ++
|
||||||
|
filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")),
|
||||||
compile(FileName, LibDirs);
|
compile(FileName, LibDirs);
|
||||||
|
|
||||||
main([FileName | ["-rebar" | [Path | LibDirs]]]) ->
|
main([FileName, "-rebar", Path, LibDirs]) ->
|
||||||
{ok, L} = file:consult(Path),
|
{ok, L} = file:consult(Path),
|
||||||
P = dict:from_list(L),
|
P = dict:from_list(L),
|
||||||
Root = filename:dirname(Path),
|
Root = filename:dirname(Path),
|
||||||
|
@ -31,23 +32,20 @@ main([FileName | ["-rebar" | [Path | LibDirs]]]) ->
|
||||||
%io:format("~p~n", [LibDirs1]),
|
%io:format("~p~n", [LibDirs1]),
|
||||||
compile(FileName, LibDirs1);
|
compile(FileName, LibDirs1);
|
||||||
|
|
||||||
main([FileName | LibDirs]) ->
|
main([FileName, LibDirs]) ->
|
||||||
compile(FileName, LibDirs).
|
compile(FileName, LibDirs).
|
||||||
|
|
||||||
compile(FileName, LibDirs) ->
|
compile(FileName, LibDirs) ->
|
||||||
Root = get_root(filename:dirname(FileName)),
|
Root = get_root(filename:dirname(FileName)),
|
||||||
ok = code:add_pathsa(LibDirs),
|
ok = code:add_pathsa(LibDirs),
|
||||||
compile:file(FileName, [warn_obsolete_guard,
|
compile:file(FileName,
|
||||||
warn_unused_import,
|
[warn_obsolete_guard,
|
||||||
warn_shadow_vars,
|
warn_unused_import,
|
||||||
warn_export_vars,
|
warn_shadow_vars,
|
||||||
strong_validation,
|
warn_export_vars,
|
||||||
report,
|
strong_validation,
|
||||||
{i, filename:join(Root, "include")},
|
report] ++
|
||||||
{i, filename:join(Root, "deps")},
|
[{i, filename:join(Root, I)} || I <- LibDirs]).
|
||||||
{i, filename:join(Root, "apps")},
|
|
||||||
{i, filename:join(Root, "lib")}
|
|
||||||
]).
|
|
||||||
|
|
||||||
get_root(Dir) ->
|
get_root(Dir) ->
|
||||||
Path = filename:split(filename:absname(Dir)),
|
Path = filename:split(filename:absname(Dir)),
|
||||||
|
|
|
@ -22,7 +22,7 @@ set cpo&vim
|
||||||
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
|
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
|
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
|
||||||
if term != ''
|
if term != ''
|
||||||
let term = '\V' . term
|
let term = '\V' . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
return term
|
return term
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -26,7 +26,7 @@ function! SyntaxCheckers_lex_flex_GetHighlightRegex(item)
|
||||||
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
|
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_lex_flex_GetLocList() dict
|
function! SyntaxCheckers_lex_flex_GetLocList() dict
|
||||||
|
|
|
@ -28,7 +28,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||||
let a:pos['col'] = p[2]
|
let a:pos['col'] = p[2]
|
||||||
let result = '\%' . p[2] . 'c'
|
let result = '\%' . p[2] . 'c'
|
||||||
else
|
else
|
||||||
let result = '\V' . near
|
let result = '\V' . escape(near, '\')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" XXX the following piece of code is evil, and is likely to break
|
" XXX the following piece of code is evil, and is likely to break
|
||||||
|
@ -38,7 +38,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||||
"if open != ''
|
"if open != ''
|
||||||
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
||||||
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||||
" call matchadd(group, '\%' . line . 'l\V' . open)
|
" call matchadd(group, '\%' . line . 'l\V' . escape(open, '\'))
|
||||||
"endif
|
"endif
|
||||||
endif
|
endif
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -11,6 +11,22 @@
|
||||||
"
|
"
|
||||||
"============================================================================
|
"============================================================================
|
||||||
"
|
"
|
||||||
|
" Security:
|
||||||
|
"
|
||||||
|
" This checker runs 'perl -c' against your file, which in turn executes
|
||||||
|
" any BEGIN, UNITCHECK, and CHECK blocks, and any use statements in
|
||||||
|
" your file. This is probably fine if you wrote the file yourself,
|
||||||
|
" but it can be a problem if you're trying to check third party files.
|
||||||
|
" If you are 100% willing to let Vim run the code in your file, set
|
||||||
|
" g:syntastic_enable_perl_checker to 1 in your vimrc to enable this
|
||||||
|
" checker:
|
||||||
|
"
|
||||||
|
" let g:syntastic_enable_perl_checker = 1
|
||||||
|
"
|
||||||
|
" References:
|
||||||
|
"
|
||||||
|
" - http://perldoc.perl.org/perlrun.html#*-c*
|
||||||
|
"
|
||||||
" Checker options:
|
" Checker options:
|
||||||
"
|
"
|
||||||
" - g:syntastic_perl_interpreter (string; default: 'perl')
|
" - g:syntastic_perl_interpreter (string; default: 'perl')
|
||||||
|
@ -24,11 +40,7 @@
|
||||||
if exists('g:loaded_syntastic_perl_perl_checker')
|
if exists('g:loaded_syntastic_perl_perl_checker')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_syntastic_perl_perl_checker=1
|
let g:loaded_syntastic_perl_perl_checker = 1
|
||||||
|
|
||||||
if !exists('g:syntastic_perl_interpreter')
|
|
||||||
let g:syntastic_perl_interpreter = 'perl'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('g:syntastic_perl_lib_path')
|
if !exists('g:syntastic_perl_lib_path')
|
||||||
let g:syntastic_perl_lib_path = []
|
let g:syntastic_perl_lib_path = []
|
||||||
|
@ -38,6 +50,10 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
||||||
|
if !exists('g:syntastic_perl_interpreter')
|
||||||
|
let g:syntastic_perl_interpreter = self.getExec()
|
||||||
|
endif
|
||||||
|
|
||||||
" don't call executable() here, to allow things like
|
" don't call executable() here, to allow things like
|
||||||
" let g:syntastic_perl_interpreter='/usr/bin/env perl'
|
" let g:syntastic_perl_interpreter='/usr/bin/env perl'
|
||||||
silent! call system(syntastic#util#shexpand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)'))
|
silent! call system(syntastic#util#shexpand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)'))
|
||||||
|
@ -45,6 +61,11 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_perl_perl_GetLocList() dict
|
function! SyntaxCheckers_perl_perl_GetLocList() dict
|
||||||
|
if !exists('g:syntastic_enable_perl_checker') || !g:syntastic_enable_perl_checker
|
||||||
|
call syntastic#log#error('checker perl/perl: checks disabled for security reasons; set g:syntastic_enable_perl_checker to 1 to override')
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
let exe = expand(g:syntastic_perl_interpreter)
|
let exe = expand(g:syntastic_perl_interpreter)
|
||||||
if type(g:syntastic_perl_lib_path) == type('')
|
if type(g:syntastic_perl_lib_path) == type('')
|
||||||
call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list')
|
call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list')
|
||||||
|
|
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_php_php_GetHighlightRegex(item)
|
function! SyntaxCheckers_php_php_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'")
|
let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'")
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_php_php_GetLocList() dict
|
function! SyntaxCheckers_php_php_GetLocList() dict
|
||||||
|
|
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item)
|
function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown')
|
let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown')
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_po_msgfmt_GetLocList() dict
|
function! SyntaxCheckers_po_msgfmt_GetLocList() dict
|
||||||
|
|
|
@ -39,7 +39,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||||
if len(parts) >= 4
|
if len(parts) >= 4
|
||||||
let e["type"] = parts[1][0]
|
let e["type"] = parts[1][0]
|
||||||
let e["text"] = parts[3] . ' [' . parts[1] . ']'
|
let e["text"] = parts[3] . ' [' . parts[1] . ']'
|
||||||
let e["hl"] = '\V' . parts[2]
|
let e["hl"] = '\V' . escape(parts[2], '\')
|
||||||
elseif e["text"] =~? '\v^I\d+:'
|
elseif e["text"] =~? '\v^I\d+:'
|
||||||
let e["valid"] = 0
|
let e["valid"] = 0
|
||||||
else
|
else
|
||||||
|
|
|
@ -21,7 +21,7 @@ set cpo&vim
|
||||||
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||||
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
||||||
let term = split(a:i['text'], ' - ')[1]
|
let term = split(a:i['text'], ' - ')[1]
|
||||||
return '\V\<'.term.'\>'
|
return '\V\<' . escape(term, '\') . '\>'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_texinfo_makeinfo_GetHighlightRegex(item)
|
function! SyntaxCheckers_texinfo_makeinfo_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], "\\m`\\zs[^']\\+\\ze'")
|
let term = matchstr(a:item['text'], "\\m`\\zs[^']\\+\\ze'")
|
||||||
return term != '' ? '\V' . term : ''
|
return term != '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_texinfo_makeinfo_GetLocList() dict
|
function! SyntaxCheckers_texinfo_makeinfo_GetLocList() dict
|
||||||
|
|
|
@ -22,7 +22,7 @@ function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)')
|
let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)')
|
||||||
if term != ''
|
if term != ''
|
||||||
let col = get(a:item, 'col', 0)
|
let col = get(a:item, 'col', 0)
|
||||||
let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . term
|
let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
return term
|
return term
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return '\V' . (col ? '\%' . col . 'c' : '') . term
|
return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2008-11-25.
|
" @Created: 2008-11-25.
|
||||||
" @Last Change: 2013-09-25.
|
" @Last Change: 2014-01-23.
|
||||||
" @Revision: 0.0.92
|
" @Revision: 0.0.108
|
||||||
|
|
||||||
let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2
|
let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2
|
||||||
let s:prototype.highlight = g:tlib#input#higroup
|
let s:prototype.highlight = g:tlib#input#higroup
|
||||||
|
@ -147,7 +147,16 @@ endf
|
||||||
|
|
||||||
" :nodoc:
|
" :nodoc:
|
||||||
function! s:prototype.ReduceFrontFilter(world) dict "{{{3
|
function! s:prototype.ReduceFrontFilter(world) dict "{{{3
|
||||||
let a:world.filter[0][0] = a:world.filter[0][0][0:-2]
|
let filter = a:world.filter[0][0]
|
||||||
|
" TLogVAR filter
|
||||||
|
let str = matchstr(filter, '\(\\\(\.\\{-}\|[.?*+$^]\)\|\)$')
|
||||||
|
if empty(str)
|
||||||
|
let filter = filter[0 : -2]
|
||||||
|
else
|
||||||
|
let filter = strpart(filter, 0, len(filter) - len(str))
|
||||||
|
endif
|
||||||
|
" TLogVAR str, filter
|
||||||
|
let a:world.filter[0][0] = filter
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2008-11-25.
|
" @Created: 2008-11-25.
|
||||||
" @Last Change: 2013-09-25.
|
" @Last Change: 2014-01-23.
|
||||||
" @Revision: 0.0.51
|
" @Revision: 0.0.57
|
||||||
|
|
||||||
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2
|
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2
|
||||||
let s:prototype.highlight = g:tlib#input#higroup
|
let s:prototype.highlight = g:tlib#input#higroup
|
||||||
|
@ -29,11 +29,7 @@ let s:Help = s:prototype.Help
|
||||||
" :nodoc:
|
" :nodoc:
|
||||||
function! s:prototype.Help(world) dict "{{{3
|
function! s:prototype.Help(world) dict "{{{3
|
||||||
call call(s:Help, [a:world], self)
|
call call(s:Help, [a:world], self)
|
||||||
if self.name == 'cnfx'
|
call a:world.PushHelp('.', 'Any characters')
|
||||||
call a:world.PushHelp(g:tlib#Filter_cnfx#expander, 'Any characters')
|
|
||||||
else
|
|
||||||
call a:world.PushHelp('.', 'Any characters')
|
|
||||||
endif
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,16 +46,6 @@ function! s:prototype.PushFrontFilter(world, char) dict "{{{3
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
|
||||||
function! s:prototype.ReduceFrontFilter(world) dict "{{{3
|
|
||||||
let flt = a:world.filter[0][0]
|
|
||||||
if flt =~ '\\\.\\{-}$'
|
|
||||||
let a:world.filter[0][0] = flt[0:-7]
|
|
||||||
else
|
|
||||||
let a:world.filter[0][0] = flt[0:-2]
|
|
||||||
endif
|
|
||||||
endf
|
|
||||||
|
|
||||||
" :nodoc:
|
" :nodoc:
|
||||||
function! s:prototype.CleanFilter(filter) dict "{{{3
|
function! s:prototype.CleanFilter(filter) dict "{{{3
|
||||||
return substitute(a:filter, '\\.\\{-}', '.', 'g')
|
return substitute(a:filter, '\\.\\{-}', '.', 'g')
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Created: 2008-11-25.
|
|
||||||
" @Last Change: 2013-09-25.
|
|
||||||
" @Revision: 0.0.62
|
|
||||||
|
|
||||||
let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2
|
|
||||||
let s:prototype.highlight = g:tlib#input#higroup
|
|
||||||
|
|
||||||
|
|
||||||
" A character that should be expanded to '\.\{-}'.
|
|
||||||
TLet g:tlib#Filter_cnfx#expander = '+'
|
|
||||||
|
|
||||||
|
|
||||||
" The same as |tlib#Filter_cnfd#New()| but a a customizable character
|
|
||||||
" |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'.
|
|
||||||
" The pattern is a '/\V' very no-'/magic' regexp pattern.
|
|
||||||
function! tlib#Filter_cnfx#New(...) "{{{3
|
|
||||||
let object = s:prototype.New(a:0 >= 1 ? a:1 : {})
|
|
||||||
return object
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
|
||||||
function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3
|
|
||||||
let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_cnfx#expander, 'V'), '\\.\\{-}', 'g')
|
|
||||||
let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1]
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
|
||||||
function! s:prototype.PushFrontFilter(world, char) dict "{{{3
|
|
||||||
let a:world.filter[0][0] .= a:char == char2nr(g:tlib#Filter_cnfx#expander) ? '\.\{-}' : nr2char(a:char)
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
|
||||||
function! s:prototype.CleanFilter(filter) dict "{{{3
|
|
||||||
return substitute(a:filter, '\\.\\{-}', g:tlib#Filter_cnfx#expander, 'g')
|
|
||||||
endf
|
|
||||||
|
|
68
sources_non_forked/tlib/autoload/tlib/Filter_glob.vim
Normal file
68
sources_non_forked/tlib/autoload/tlib/Filter_glob.vim
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||||
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
" @Created: 2008-11-25.
|
||||||
|
" @Last Change: 2014-01-23.
|
||||||
|
" @Revision: 0.0.80
|
||||||
|
|
||||||
|
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_glob'], 'name': 'glob'}) "{{{2
|
||||||
|
let s:prototype.highlight = g:tlib#input#higroup
|
||||||
|
|
||||||
|
|
||||||
|
" A character that should be expanded to '\.\{-}'.
|
||||||
|
TLet g:tlib#Filter_glob#seq = '*'
|
||||||
|
|
||||||
|
|
||||||
|
" A character that should be expanded to '\.\?'.
|
||||||
|
TLet g:tlib#Filter_glob#char = '?'
|
||||||
|
|
||||||
|
|
||||||
|
" The same as |tlib#Filter_cnf#New()| but a a customizable character
|
||||||
|
" |see tlib#Filter_glob#seq| is expanded to '\.\{-}' and
|
||||||
|
" |g:tlib#Filter_glob#char| is expanded to '\.'.
|
||||||
|
" The pattern is a '/\V' very no-'/magic' regexp pattern.
|
||||||
|
function! tlib#Filter_glob#New(...) "{{{3
|
||||||
|
let object = s:prototype.New(a:0 >= 1 ? a:1 : {})
|
||||||
|
return object
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
let s:Help = s:prototype.Help
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.Help(world) dict "{{{3
|
||||||
|
call call(s:Help, [a:world], self)
|
||||||
|
call a:world.PushHelp(g:tlib#Filter_glob#seq, 'Any characters')
|
||||||
|
call a:world.PushHelp(g:tlib#Filter_glob#char, 'Single characters')
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3
|
||||||
|
let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_glob#seq, 'V'), '\\.\\{-}', 'g')
|
||||||
|
let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_glob#char, 'V'), '\\.', 'g')
|
||||||
|
let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1]
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.PushFrontFilter(world, char) dict "{{{3
|
||||||
|
" TLogVAR a:char, nr2char(a:char)
|
||||||
|
if a:char == char2nr(g:tlib#Filter_glob#seq)
|
||||||
|
let char = '\.\{-}'
|
||||||
|
elseif a:char == char2nr(g:tlib#Filter_glob#char)
|
||||||
|
let char = '\.'
|
||||||
|
else
|
||||||
|
let char = nr2char(a:char)
|
||||||
|
endif
|
||||||
|
let a:world.filter[0][0] .= char
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.CleanFilter(filter) dict "{{{3
|
||||||
|
let filter = substitute(a:filter, '\\.\\{-}', g:tlib#Filter_glob#seq, 'g')
|
||||||
|
let filter = substitute(filter, '\\.', g:tlib#Filter_glob#char, 'g')
|
||||||
|
return filter
|
||||||
|
endf
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
" World.vim -- The World prototype for tlib#input#List()
|
|
||||||
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
|
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-05-01.
|
" @Revision: 1389
|
||||||
" @Last Change: 2013-12-03.
|
|
||||||
" @Revision: 0.1.1310
|
|
||||||
|
|
||||||
" :filedoc:
|
" :filedoc:
|
||||||
" A prototype used by |tlib#input#List|.
|
" A prototype used by |tlib#input#List|.
|
||||||
|
@ -75,6 +72,7 @@ let s:prototype = tlib#Object#New({
|
||||||
\ 'resize_vertical': 0,
|
\ 'resize_vertical': 0,
|
||||||
\ 'restore_from_cache': [],
|
\ 'restore_from_cache': [],
|
||||||
\ 'filtered_items': [],
|
\ 'filtered_items': [],
|
||||||
|
\ 'resume_state': '',
|
||||||
\ 'retrieve_eval': '',
|
\ 'retrieve_eval': '',
|
||||||
\ 'return_agent': '',
|
\ 'return_agent': '',
|
||||||
\ 'rv': '',
|
\ 'rv': '',
|
||||||
|
@ -92,6 +90,7 @@ let s:prototype = tlib#Object#New({
|
||||||
\ 'temp_prompt': [],
|
\ 'temp_prompt': [],
|
||||||
\ 'timeout': 0,
|
\ 'timeout': 0,
|
||||||
\ 'timeout_resolution': 2,
|
\ 'timeout_resolution': 2,
|
||||||
|
\ 'tabpagenr': -1,
|
||||||
\ 'type': '',
|
\ 'type': '',
|
||||||
\ 'win_wnr': -1,
|
\ 'win_wnr': -1,
|
||||||
\ 'win_height': -1,
|
\ 'win_height': -1,
|
||||||
|
@ -119,6 +118,22 @@ function! s:prototype.Set_display_format(value) dict "{{{3
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.DisplayFormat(list) dict "{{{3
|
||||||
|
let display_format = self.display_format
|
||||||
|
if !empty(display_format)
|
||||||
|
if has_key(self, 'InitFormatName')
|
||||||
|
call self.InitFormatName()
|
||||||
|
endif
|
||||||
|
let cache = self.fmt_display
|
||||||
|
" TLogVAR display_format, fmt_entries
|
||||||
|
return map(copy(a:list), 'self.FormatName(cache, display_format, v:val)')
|
||||||
|
else
|
||||||
|
return a:list
|
||||||
|
endif
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
" :nodoc:
|
||||||
function! s:prototype.Set_highlight_filename() dict "{{{3
|
function! s:prototype.Set_highlight_filename() dict "{{{3
|
||||||
let self.tlib_UseInputListScratch = 'call world.Highlight_filename()'
|
let self.tlib_UseInputListScratch = 'call world.Highlight_filename()'
|
||||||
|
@ -180,6 +195,32 @@ else
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.UseFilenameIndicators() dict "{{{3
|
||||||
|
return g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators')
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :nodoc:
|
||||||
|
function! s:prototype.InitFormatName() dict "{{{3
|
||||||
|
if self.UseFilenameIndicators()
|
||||||
|
let self._buffers = {}
|
||||||
|
for bufnr in range(1, bufnr('$'))
|
||||||
|
let filename = fnamemodify(bufname(bufnr), ':p')
|
||||||
|
" TLogVAR filename
|
||||||
|
let bufdef = {
|
||||||
|
\ 'bufnr': bufnr,
|
||||||
|
\ }
|
||||||
|
" '&buflisted'
|
||||||
|
for opt in ['&modified', '&bufhidden']
|
||||||
|
let bufdef[opt] = getbufvar(bufnr, opt)
|
||||||
|
endfor
|
||||||
|
let self._buffers[filename] = bufdef
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
" :nodoc:
|
||||||
function! s:prototype.FormatFilename(file) dict "{{{3
|
function! s:prototype.FormatFilename(file) dict "{{{3
|
||||||
" TLogVAR a:file
|
" TLogVAR a:file
|
||||||
|
@ -196,34 +237,30 @@ else
|
||||||
if strwidth(fname) > width
|
if strwidth(fname) > width
|
||||||
let fname = strpart(fname, 0, width - 3) .'...'
|
let fname = strpart(fname, 0, width - 3) .'...'
|
||||||
endif
|
endif
|
||||||
let dnmax = &co - max([width, strwidth(fname)]) - 10 - self.index_width - &fdc
|
let dnmax = &co - max([width, strwidth(fname)]) - 8 - self.index_width - &fdc
|
||||||
if g:tlib_inputlist_filename_indicators
|
let use_indicators = self.UseFilenameIndicators()
|
||||||
let dnmax -= 2
|
|
||||||
endif
|
|
||||||
if strwidth(dname) > dnmax
|
|
||||||
let dname = '...'. strpart(dname, len(dname) - dnmax)
|
|
||||||
endif
|
|
||||||
let marker = []
|
|
||||||
let use_indicators = g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators')
|
|
||||||
" TLogVAR use_indicators
|
" TLogVAR use_indicators
|
||||||
|
let marker = []
|
||||||
if use_indicators
|
if use_indicators
|
||||||
call insert(marker, '[')
|
call insert(marker, '[')
|
||||||
if g:tlib_inputlist_filename_indicators
|
if g:tlib_inputlist_filename_indicators
|
||||||
let bnr = bufnr(a:file)
|
let bufdef = get(self._buffers, a:file, {})
|
||||||
TLogVAR a:file, bnr, self.bufnr
|
" let bnr = bufnr(a:file)
|
||||||
|
let bnr = get(bufdef, 'bufnr', -1)
|
||||||
|
" TLogVAR a:file, bnr, self.bufnr
|
||||||
if bnr != -1
|
if bnr != -1
|
||||||
if bnr == self.bufnr
|
if bnr == self.bufnr
|
||||||
call add(marker, '%')
|
call add(marker, '%')
|
||||||
else
|
else
|
||||||
call add(marker, bnr)
|
call add(marker, bnr)
|
||||||
endif
|
endif
|
||||||
if getbufvar(bnr, '&modified')
|
if get(bufdef, '&modified', 0)
|
||||||
call add(marker, '+')
|
call add(marker, '+')
|
||||||
endif
|
endif
|
||||||
if getbufvar(bnr, '&bufhidden') == 'hide'
|
if get(bufdef, '&bufhidden', '') == 'hide'
|
||||||
call add(marker, 'h')
|
call add(marker, 'h')
|
||||||
endif
|
endif
|
||||||
" if !buflisted(bnr)
|
" if !get(bufdef, '&buflisted', 1)
|
||||||
" call add(marker, 'u')
|
" call add(marker, 'u')
|
||||||
" endif
|
" endif
|
||||||
" echom "DBG" a:file string(get(self,'filename_indicators'))
|
" echom "DBG" a:file string(get(self,'filename_indicators'))
|
||||||
|
@ -242,9 +279,16 @@ else
|
||||||
else
|
else
|
||||||
call add(marker, '|')
|
call add(marker, '|')
|
||||||
endif
|
endif
|
||||||
|
let markers = join(marker, '')
|
||||||
|
if !empty(markers)
|
||||||
|
let dnmax -= len(markers)
|
||||||
|
endif
|
||||||
|
if strwidth(dname) > dnmax
|
||||||
|
let dname = '...'. strpart(dname, len(dname) - dnmax)
|
||||||
|
endif
|
||||||
return printf("%-*s %s %s",
|
return printf("%-*s %s %s",
|
||||||
\ self.width_filename + len(fname) - strwidth(fname),
|
\ self.width_filename + len(fname) - strwidth(fname),
|
||||||
\ fname, join(marker, ''), dname)
|
\ fname, markers, dname)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -764,6 +808,7 @@ function! s:prototype.UseInputListScratch() dict "{{{3
|
||||||
if !exists('b:tlib_list_init')
|
if !exists('b:tlib_list_init')
|
||||||
call tlib#autocmdgroup#Init()
|
call tlib#autocmdgroup#Init()
|
||||||
autocmd TLib VimResized <buffer> call feedkeys("\<c-j>", 't')
|
autocmd TLib VimResized <buffer> call feedkeys("\<c-j>", 't')
|
||||||
|
" autocmd TLib WinLeave <buffer> let b:tlib_world_event = 'WinLeave' | call feedkeys("\<c-j>", 't')
|
||||||
let b:tlib_list_init = 1
|
let b:tlib_list_init = 1
|
||||||
endif
|
endif
|
||||||
if !exists('w:tlib_list_init')
|
if !exists('w:tlib_list_init')
|
||||||
|
@ -923,16 +968,17 @@ function! s:prototype.DisplayHelp() dict "{{{3
|
||||||
let self.temp_lines = self.InitHelp()
|
let self.temp_lines = self.InitHelp()
|
||||||
call self.PushHelp('<Esc>', self.key_mode == 'default' ? 'Abort' : 'Reset keymap')
|
call self.PushHelp('<Esc>', self.key_mode == 'default' ? 'Abort' : 'Reset keymap')
|
||||||
call self.PushHelp('Enter, <cr>', 'Pick the current item')
|
call self.PushHelp('Enter, <cr>', 'Pick the current item')
|
||||||
call self.PushHelp('<M-Number>', 'Pick an item')
|
|
||||||
call self.PushHelp('Mouse', 'L: Pick item, R: Show menu')
|
call self.PushHelp('Mouse', 'L: Pick item, R: Show menu')
|
||||||
|
call self.PushHelp('<M-Number>', 'Select an item')
|
||||||
call self.PushHelp('<BS>, <C-BS>', 'Reduce filter')
|
call self.PushHelp('<BS>, <C-BS>', 'Reduce filter')
|
||||||
call self.PushHelp('<S-Esc>, <F10>', 'Enter command')
|
call self.PushHelp('<S-Esc>, <F10>', 'Enter command')
|
||||||
|
|
||||||
if self.key_mode == 'default'
|
if self.key_mode == 'default'
|
||||||
call self.PushHelp('<C|M-r>', 'Reset the display')
|
call self.PushHelp('<C|M-r>', 'Reset the display')
|
||||||
call self.PushHelp('Up/Down', 'Next/previous item')
|
call self.PushHelp('Up/Down', 'Next/previous item')
|
||||||
call self.PushHelp('<C|M-q>', 'Edit top filter string')
|
call self.PushHelp('<C|M-q>', 'Edit top filter string')
|
||||||
call self.PushHelp('Page Up/Down', 'Scroll')
|
call self.PushHelp('Page Up/Down', 'Scroll')
|
||||||
|
call self.PushHelp('<S-Space>', 'Enter * Wildcard')
|
||||||
if self.allow_suspend
|
if self.allow_suspend
|
||||||
call self.PushHelp('<C|M-z>', 'Suspend/Resume')
|
call self.PushHelp('<C|M-z>', 'Suspend/Resume')
|
||||||
call self.PushHelp('<C-o>', 'Switch to origin')
|
call self.PushHelp('<C-o>', 'Switch to origin')
|
||||||
|
@ -1164,7 +1210,7 @@ function! s:prototype.Query() dict "{{{3
|
||||||
if g:tlib_inputlist_shortmessage
|
if g:tlib_inputlist_shortmessage
|
||||||
let query = 'Filter: '. self.DisplayFilter()
|
let query = 'Filter: '. self.DisplayFilter()
|
||||||
else
|
else
|
||||||
let query = self.query .' (filter: '. self.DisplayFilter() .'; press "?" for help)'
|
let query = self.query .' (filter: '. self.DisplayFilter() .'; press <F1> for help)'
|
||||||
endif
|
endif
|
||||||
return query
|
return query
|
||||||
endf
|
endf
|
||||||
|
@ -1236,6 +1282,9 @@ endf
|
||||||
" :nodoc:
|
" :nodoc:
|
||||||
function! s:prototype.SwitchWindow(where) dict "{{{3
|
function! s:prototype.SwitchWindow(where) dict "{{{3
|
||||||
" TLogDBG string(tlib#win#List())
|
" TLogDBG string(tlib#win#List())
|
||||||
|
if self.tabpagenr != tabpagenr()
|
||||||
|
call tlib#tab#Set(self.tabpagenr)
|
||||||
|
endif
|
||||||
let wnr = get(self, a:where.'_wnr')
|
let wnr = get(self, a:where.'_wnr')
|
||||||
" TLogVAR self, wnr
|
" TLogVAR self, wnr
|
||||||
return tlib#win#Set(wnr)
|
return tlib#win#Set(wnr)
|
||||||
|
@ -1312,3 +1361,8 @@ function! s:prototype.RestoreOrigin(...) dict "{{{3
|
||||||
" TLogDBG "RestoreOrigin1 ". string(tlib#win#List())
|
" TLogDBG "RestoreOrigin1 ". string(tlib#win#List())
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! s:prototype.Suspend() dict "{{{3
|
||||||
|
call tlib#agent#Suspend(self, self.rv)
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-06-24.
|
" @Created: 2007-06-24.
|
||||||
" @Last Change: 2013-11-05.
|
" @Last Change: 2014-02-06.
|
||||||
" @Revision: 0.1.242
|
" @Revision: 0.1.251
|
||||||
|
|
||||||
|
|
||||||
" :filedoc:
|
" :filedoc:
|
||||||
|
@ -55,6 +55,20 @@ function! tlib#agent#PageDown(world, selected) "{{{3
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! tlib#agent#Home(world, selected) "{{{3
|
||||||
|
let a:world.prefidx = 1
|
||||||
|
let a:world.state = 'redisplay'
|
||||||
|
return a:world
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! tlib#agent#End(world, selected) "{{{3
|
||||||
|
let a:world.prefidx = len(a:world.list)
|
||||||
|
let a:world.state = 'redisplay'
|
||||||
|
return a:world
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
function! tlib#agent#Up(world, selected, ...) "{{{3
|
function! tlib#agent#Up(world, selected, ...) "{{{3
|
||||||
TVarArg ['lines', 1]
|
TVarArg ['lines', 1]
|
||||||
let a:world.idx = ''
|
let a:world.idx = ''
|
||||||
|
@ -463,7 +477,7 @@ function! tlib#agent#ShowInfo(world, selected)
|
||||||
for f in a:selected
|
for f in a:selected
|
||||||
if filereadable(f)
|
if filereadable(f)
|
||||||
let desc = [getfperm(f), strftime('%c', getftime(f)), getfsize(f) .' bytes', getftype(f)]
|
let desc = [getfperm(f), strftime('%c', getftime(f)), getfsize(f) .' bytes', getftype(f)]
|
||||||
call add(lines, fnamemodify(f, ':t') .':')
|
call add(lines, fnamemodify(f, ':p'))
|
||||||
call add(lines, ' '. join(desc, '; '))
|
call add(lines, ' '. join(desc, '; '))
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -561,7 +575,7 @@ endf
|
||||||
|
|
||||||
function! tlib#agent#ExecAgentByName(world, selected) "{{{3
|
function! tlib#agent#ExecAgentByName(world, selected) "{{{3
|
||||||
let s:agent_names_world = a:world
|
let s:agent_names_world = a:world
|
||||||
let agent_names = {}
|
let agent_names = {'Help': 'tlib#agent#Help'}
|
||||||
for def in values(a:world.key_map[a:world.key_mode])
|
for def in values(a:world.key_map[a:world.key_mode])
|
||||||
if has_key(def, 'help') && !empty(def.help) && has_key(def, 'agent') && !empty(def.agent)
|
if has_key(def, 'help') && !empty(def.help) && has_key(def, 'agent') && !empty(def.agent)
|
||||||
let agent_names[def.help] = def.agent
|
let agent_names[def.help] = def.agent
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-06-30.
|
" @Created: 2007-06-30.
|
||||||
" @Last Change: 2013-09-25.
|
" @Last Change: 2013-09-25.
|
||||||
" @Revision: 0.1.220
|
" @Revision: 0.1.230
|
||||||
|
|
||||||
|
|
||||||
" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'.
|
" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'.
|
||||||
|
@ -109,13 +109,20 @@ endf
|
||||||
|
|
||||||
|
|
||||||
function! tlib#cache#Save(cfile, dictionary) "{{{3
|
function! tlib#cache#Save(cfile, dictionary) "{{{3
|
||||||
|
" TLogVAR a:cfile, a:dictionary
|
||||||
call tlib#persistent#Save(a:cfile, a:dictionary)
|
call tlib#persistent#Save(a:cfile, a:dictionary)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
function! tlib#cache#Get(cfile) "{{{3
|
function! tlib#cache#Get(cfile, ...) "{{{3
|
||||||
call tlib#cache#MaybePurge()
|
call tlib#cache#MaybePurge()
|
||||||
return tlib#persistent#Get(a:cfile)
|
if !empty(a:cfile) && filereadable(a:cfile)
|
||||||
|
let val = readfile(a:cfile, 'b')
|
||||||
|
return eval(join(val, "\n"))
|
||||||
|
else
|
||||||
|
let default = a:0 >= 1 ? a:1 : {}
|
||||||
|
return default
|
||||||
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,10 +130,18 @@ endf
|
||||||
" or does not exist, create it calling a generator function.
|
" or does not exist, create it calling a generator function.
|
||||||
function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3
|
function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3
|
||||||
if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime)
|
if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime)
|
||||||
let args = a:0 >= 1 ? a:1 : []
|
if empty(a:generator) && a:0 >= 1
|
||||||
let val = call(a:generator, args)
|
" TLogVAR a:1
|
||||||
" TLogVAR a:generator, args, val
|
let val = a:1
|
||||||
call tlib#cache#Save(a:cfile, {'val': val})
|
else
|
||||||
|
let args = a:0 >= 1 ? a:1 : []
|
||||||
|
" TLogVAR a:generator, args
|
||||||
|
let val = call(a:generator, args)
|
||||||
|
endif
|
||||||
|
" TLogVAR val
|
||||||
|
let cval = {'val': val}
|
||||||
|
" TLogVAR cval
|
||||||
|
call tlib#cache#Save(a:cfile, cval)
|
||||||
return val
|
return val
|
||||||
else
|
else
|
||||||
let val = tlib#cache#Get(a:cfile)
|
let val = tlib#cache#Get(a:cfile)
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-06-30.
|
" @Created: 2007-06-30.
|
||||||
" @Last Change: 2009-02-15.
|
" @Last Change: 2014-01-20.
|
||||||
" @Revision: 0.0.30
|
" @Revision: 0.0.37
|
||||||
|
|
||||||
if &cp || exists("loaded_tlib_char_autoload")
|
if &cp || exists("loaded_tlib_char_autoload")
|
||||||
finish
|
finish
|
||||||
|
@ -19,13 +19,22 @@ let loaded_tlib_char_autoload = 1
|
||||||
" echo tlib#char#Get()
|
" echo tlib#char#Get()
|
||||||
" echo tlib#char#Get(5)
|
" echo tlib#char#Get(5)
|
||||||
function! tlib#char#Get(...) "{{{3
|
function! tlib#char#Get(...) "{{{3
|
||||||
TVarArg ['timeout', 0], ['resolution', 0]
|
TVarArg ['timeout', 0], ['resolution', 0], ['getmod', 0]
|
||||||
|
let char = -1
|
||||||
|
let mode = 0
|
||||||
if timeout == 0 || !has('reltime')
|
if timeout == 0 || !has('reltime')
|
||||||
return getchar()
|
let char = getchar()
|
||||||
else
|
else
|
||||||
return tlib#char#GetWithTimeout(timeout, resolution)
|
let char = tlib#char#GetWithTimeout(timeout, resolution)
|
||||||
|
endif
|
||||||
|
if getmod
|
||||||
|
if char != -1
|
||||||
|
let mode = getcharmod()
|
||||||
|
endif
|
||||||
|
return [char, mode]
|
||||||
|
else
|
||||||
|
return char
|
||||||
endif
|
endif
|
||||||
return -1
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-08-23.
|
" @Created: 2007-08-23.
|
||||||
" @Last Change: 2013-05-14.
|
" @Last Change: 2014-02-05.
|
||||||
" @Revision: 0.0.46
|
" @Revision: 0.0.53
|
||||||
|
|
||||||
if &cp || exists("loaded_tlib_cmd_autoload")
|
if &cp || exists("loaded_tlib_cmd_autoload")
|
||||||
finish
|
finish
|
||||||
|
@ -58,10 +58,12 @@ endf
|
||||||
" call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames')
|
" call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames')
|
||||||
function! tlib#cmd#BrowseOutputWithCallback(callback, command) "{{{3
|
function! tlib#cmd#BrowseOutputWithCallback(callback, command) "{{{3
|
||||||
let list = tlib#cmd#OutputAsList(a:command)
|
let list = tlib#cmd#OutputAsList(a:command)
|
||||||
let cmd = tlib#input#List('s', 'Output of: '. a:command, list)
|
let cmds = tlib#input#List('m', 'Output of: '. a:command, list)
|
||||||
if !empty(cmd)
|
if !empty(cmds)
|
||||||
let Callback = function(a:callback)
|
for cmd in cmds
|
||||||
call call(Callback, [cmd])
|
let Callback = function(a:callback)
|
||||||
|
call call(Callback, [cmd])
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
@ -70,8 +72,9 @@ function! tlib#cmd#DefaultBrowseOutput(cmd) "{{{3
|
||||||
endf
|
endf
|
||||||
|
|
||||||
function! tlib#cmd#ParseScriptname(line) "{{{3
|
function! tlib#cmd#ParseScriptname(line) "{{{3
|
||||||
let parsedValue = substitute(a:line, '^.\{-}\/', '/', '')
|
" let parsedValue = substitute(a:line, '^.\{-}\/', '/', '')
|
||||||
exe ':e '. parsedValue
|
let parsedValue = matchstr(a:line, '^\s*\d\+:\s*\zs.*$')
|
||||||
|
exe 'drop '. fnameescape(parsedValue)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" :def: function! tlib#cmd#UseVertical(?rx='')
|
" :def: function! tlib#cmd#UseVertical(?rx='')
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
" input.vim
|
|
||||||
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
|
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-06-30.
|
" @Revision: 1315
|
||||||
" @Last Change: 2013-09-30.
|
|
||||||
" @Revision: 0.0.1262
|
|
||||||
|
|
||||||
|
|
||||||
" :filedoc:
|
" :filedoc:
|
||||||
|
@ -23,16 +20,15 @@ TLet g:tlib#input#livesearch_threshold = 1000
|
||||||
|
|
||||||
|
|
||||||
" Determine how |tlib#input#List()| and related functions work.
|
" Determine how |tlib#input#List()| and related functions work.
|
||||||
" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See:
|
" Can be "glob", "cnf", "cnfd", "seq", or "fuzzy". See:
|
||||||
" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted
|
" glob ... Like cnf but "*" and "?" (see |g:tlib#Filter_glob#seq|,
|
||||||
" as a wildcard (this is the default method)
|
" |g:tlib#Filter_glob#char|) are interpreted as glob-like
|
||||||
" - A plus character ("+") acts as a wildcard as if ".\{-}" (see
|
" |wildcards| (this is the default method)
|
||||||
" |/\{-|) were entered.
|
|
||||||
" - Examples:
|
" - Examples:
|
||||||
" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
" - "f*o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
||||||
" "far".
|
" "far".
|
||||||
" - Otherwise it is a derivate of the cnf method (see below).
|
" - Otherwise it is a derivate of the cnf method (see below).
|
||||||
" - See also |tlib#Filter_cnfx#New()|.
|
" - See also |tlib#Filter_glob#New()|.
|
||||||
" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
|
" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
|
||||||
" expanded to "\.\{-}"
|
" expanded to "\.\{-}"
|
||||||
" - A period character (".") acts as a wildcard as if ".\{-}" (see
|
" - A period character (".") acts as a wildcard as if ".\{-}" (see
|
||||||
|
@ -60,7 +56,7 @@ TLet g:tlib#input#livesearch_threshold = 1000
|
||||||
" - |tlib#Filter_seq#New()|
|
" - |tlib#Filter_seq#New()|
|
||||||
" fuzzy .. Match fuzzy character sequences
|
" fuzzy .. Match fuzzy character sequences
|
||||||
" - |tlib#Filter_fuzzy#New()|
|
" - |tlib#Filter_fuzzy#New()|
|
||||||
TLet g:tlib#input#filter_mode = 'cnfx'
|
TLet g:tlib#input#filter_mode = 'glob'
|
||||||
|
|
||||||
|
|
||||||
" The highlight group to use for showing matches in the input list
|
" The highlight group to use for showing matches in the input list
|
||||||
|
@ -126,6 +122,8 @@ TLet g:tlib#input#numeric_chars = {
|
||||||
TLet g:tlib#input#keyagents_InputList_s = {
|
TLet g:tlib#input#keyagents_InputList_s = {
|
||||||
\ "\<PageUp>": 'tlib#agent#PageUp',
|
\ "\<PageUp>": 'tlib#agent#PageUp',
|
||||||
\ "\<PageDown>": 'tlib#agent#PageDown',
|
\ "\<PageDown>": 'tlib#agent#PageDown',
|
||||||
|
\ "\<Home>": 'tlib#agent#Home',
|
||||||
|
\ "\<End>": 'tlib#agent#End',
|
||||||
\ "\<Up>": 'tlib#agent#Up',
|
\ "\<Up>": 'tlib#agent#Up',
|
||||||
\ "\<Down>": 'tlib#agent#Down',
|
\ "\<Down>": 'tlib#agent#Down',
|
||||||
\ "\<c-Up>": 'tlib#agent#UpN',
|
\ "\<c-Up>": 'tlib#agent#UpN',
|
||||||
|
@ -140,7 +138,6 @@ TLet g:tlib#input#keyagents_InputList_s = {
|
||||||
\ 26: 'tlib#agent#Suspend',
|
\ 26: 'tlib#agent#Suspend',
|
||||||
\ 250: 'tlib#agent#Suspend',
|
\ 250: 'tlib#agent#Suspend',
|
||||||
\ 15: 'tlib#agent#SuspendToParentWindow',
|
\ 15: 'tlib#agent#SuspendToParentWindow',
|
||||||
\ 63: 'tlib#agent#Help',
|
|
||||||
\ "\<F1>": 'tlib#agent#Help',
|
\ "\<F1>": 'tlib#agent#Help',
|
||||||
\ "\<F10>": 'tlib#agent#ExecAgentByName',
|
\ "\<F10>": 'tlib#agent#ExecAgentByName',
|
||||||
\ "\<S-Esc>": 'tlib#agent#ExecAgentByName',
|
\ "\<S-Esc>": 'tlib#agent#ExecAgentByName',
|
||||||
|
@ -155,6 +152,7 @@ TLet g:tlib#input#keyagents_InputList_s = {
|
||||||
\ char2nr(g:tlib#input#or): 'tlib#agent#OR',
|
\ char2nr(g:tlib#input#or): 'tlib#agent#OR',
|
||||||
\ char2nr(g:tlib#input#and): 'tlib#agent#AND',
|
\ char2nr(g:tlib#input#and): 'tlib#agent#AND',
|
||||||
\ }
|
\ }
|
||||||
|
" \ 63: 'tlib#agent#Help',
|
||||||
|
|
||||||
|
|
||||||
" :nodefault:
|
" :nodefault:
|
||||||
|
@ -345,6 +343,16 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||||
try
|
try
|
||||||
call s:RunStateHandlers(world)
|
call s:RunStateHandlers(world)
|
||||||
|
|
||||||
|
" if exists('b:tlib_world_event')
|
||||||
|
" let event = b:tlib_world_event
|
||||||
|
" unlet! b:tlib_world_event
|
||||||
|
" if event == 'WinLeave'
|
||||||
|
" " let world.resume_state = world.state
|
||||||
|
" let world = tlib#agent#Suspend(world, world.rv)
|
||||||
|
" break
|
||||||
|
" endif
|
||||||
|
" endif
|
||||||
|
|
||||||
" let time02 = str2float(reltimestr(reltime())) " DBG
|
" let time02 = str2float(reltimestr(reltime())) " DBG
|
||||||
" TLogVAR time02, time02 - time0
|
" TLogVAR time02, time02 - time0
|
||||||
if world.state =~ '\<reset\>'
|
if world.state =~ '\<reset\>'
|
||||||
|
@ -443,14 +451,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||||
" TLogDBG 5
|
" TLogDBG 5
|
||||||
" TLogDBG len(world.list)
|
" TLogDBG len(world.list)
|
||||||
" TLogVAR world.list
|
" TLogVAR world.list
|
||||||
let dlist = copy(world.list)
|
let dlist = world.DisplayFormat(world.list)
|
||||||
" TLogVAR world.display_format
|
|
||||||
if !empty(world.display_format)
|
|
||||||
let display_format = world.display_format
|
|
||||||
let cache = world.fmt_display
|
|
||||||
" TLogVAR display_format, fmt_entries
|
|
||||||
call map(dlist, 'world.FormatName(cache, display_format, v:val)')
|
|
||||||
endif
|
|
||||||
" TLogVAR world.prefidx
|
" TLogVAR world.prefidx
|
||||||
" TLogDBG 6
|
" TLogDBG 6
|
||||||
" let time6 = str2float(reltimestr(reltime())) " DBG
|
" let time6 = str2float(reltimestr(reltime())) " DBG
|
||||||
|
@ -545,20 +546,15 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||||
exec exec_cmd
|
exec exec_cmd
|
||||||
endif
|
endif
|
||||||
elseif has('gui_gtk') || has('gui_gtk2')
|
elseif has('gui_gtk') || has('gui_gtk2')
|
||||||
let c = getchar()
|
let c = s:GetModdedChar(world)
|
||||||
let cmod = getcharmod()
|
" TLogVAR c
|
||||||
" TLogVAR c, cmod
|
|
||||||
if c !~ '\D' && c > 0 && cmod != 0
|
|
||||||
let c = printf("<%s-%s>", cmod, c)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
" TLogVAR world.timeout
|
" TLogVAR world.timeout
|
||||||
let c = tlib#char#Get(world.timeout, world.timeout_resolution)
|
let c = s:GetModdedChar(world)
|
||||||
" TLogVAR c, has_key(world.key_map[world.key_mode],c)
|
" TLogVAR c, has_key(world.key_map[world.key_mode],c)
|
||||||
let cmod = getcharmod()
|
|
||||||
endif
|
endif
|
||||||
" TLogVAR c, cmod
|
" TLogVAR c
|
||||||
" TLogDBG string(sort(keys(world.key_map[world.key_mode])))
|
" TLogDBG string(sort(keys(world.key_map[world.key_mode])))
|
||||||
|
|
||||||
" TLogVAR world.next_agent, world.next_eval
|
" TLogVAR world.next_agent, world.next_eval
|
||||||
|
@ -602,7 +598,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||||
" let world.offset = world.prefidx
|
" let world.offset = world.prefidx
|
||||||
if empty(world.prefidx)
|
if empty(world.prefidx)
|
||||||
" call feedkeys(c, 't')
|
" call feedkeys(c, 't')
|
||||||
let c = tlib#char#Get(world.timeout)
|
let c = s:GetModdedChar(world)
|
||||||
let world.state = 'help'
|
let world.state = 'help'
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
@ -829,6 +825,16 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! s:GetModdedChar(world) "{{{3
|
||||||
|
let [char, mode] = tlib#char#Get(a:world.timeout, a:world.timeout_resolution, 1)
|
||||||
|
if char !~ '\D' && char > 0 && mode != 0
|
||||||
|
return printf("<%s-%s>", mode, char)
|
||||||
|
else
|
||||||
|
return char
|
||||||
|
endif
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
function! s:Init(world, cmd) "{{{3
|
function! s:Init(world, cmd) "{{{3
|
||||||
" TLogVAR a:cmd
|
" TLogVAR a:cmd
|
||||||
let a:world.initial_display = 1
|
let a:world.initial_display = 1
|
||||||
|
@ -844,6 +850,9 @@ function! s:Init(world, cmd) "{{{3
|
||||||
else
|
else
|
||||||
call a:world.Retrieve(1)
|
call a:world.Retrieve(1)
|
||||||
endif
|
endif
|
||||||
|
" if !empty(a:world.resume_state)
|
||||||
|
" let a:world.state = a:world.resume_state
|
||||||
|
" endif
|
||||||
elseif !a:world.initialized
|
elseif !a:world.initialized
|
||||||
" TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr
|
" TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr
|
||||||
let a:world.filetype = &filetype
|
let a:world.filetype = &filetype
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2012-05-11.
|
" @Created: 2012-05-11.
|
||||||
" @Last Change: 2012-05-11.
|
" @Last Change: 2012-05-11.
|
||||||
" @Revision: 7
|
" @Revision: 9
|
||||||
|
|
||||||
" The directory for persistent data files. If empty, use
|
" The directory for persistent data files. If empty, use
|
||||||
" |tlib#dir#MyRuntime|.'/share'.
|
" |tlib#dir#MyRuntime|.'/share'.
|
||||||
|
@ -29,13 +29,8 @@ function! tlib#persistent#Filename(type, ...) "{{{3
|
||||||
return tlib#cache#Filename(a:type, file, mkdir, tlib#persistent#Dir())
|
return tlib#cache#Filename(a:type, file, mkdir, tlib#persistent#Dir())
|
||||||
endf
|
endf
|
||||||
|
|
||||||
function! tlib#persistent#Get(cfile) "{{{3
|
function! tlib#persistent#Get(...) "{{{3
|
||||||
if !empty(a:cfile) && filereadable(a:cfile)
|
return call('tlib#cache#Get', a:000)
|
||||||
let val = readfile(a:cfile, 'b')
|
|
||||||
return eval(join(val, "\n"))
|
|
||||||
else
|
|
||||||
return {}
|
|
||||||
endif
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
function! tlib#persistent#Value(...) "{{{3
|
function! tlib#persistent#Value(...) "{{{3
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-09-30.
|
" @Created: 2007-09-30.
|
||||||
" @Last Change: 2010-01-07.
|
" @Last Change: 2010-01-07.
|
||||||
" @Revision: 0.0.66
|
" @Revision: 0.0.69
|
||||||
|
|
||||||
if &cp || exists("loaded_tlib_progressbar_autoload")
|
if &cp || exists("loaded_tlib_progressbar_autoload")
|
||||||
finish
|
finish
|
||||||
|
@ -57,6 +57,7 @@ function! tlib#progressbar#Display(value, ...) "{{{3
|
||||||
let pbr = repeat('.', s:width[0] - val)
|
let pbr = repeat('.', s:width[0] - val)
|
||||||
let txt = printf(s:format[0], '['.pbl.pbr.']') . extra
|
let txt = printf(s:format[0], '['.pbl.pbr.']') . extra
|
||||||
let &l:statusline = txt
|
let &l:statusline = txt
|
||||||
|
" TLogDBG txt
|
||||||
redrawstatus
|
redrawstatus
|
||||||
" redraw
|
" redraw
|
||||||
" call tlib#notify#Echo(txt)
|
" call tlib#notify#Echo(txt)
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-07-18.
|
" @Created: 2007-07-18.
|
||||||
" @Last Change: 2013-11-11.
|
" @Last Change: 2014-02-06.
|
||||||
" @Revision: 0.0.251
|
" @Revision: 0.0.252
|
||||||
|
|
||||||
if &cp || exists("loaded_tlib_scratch_autoload")
|
if &cp || exists("loaded_tlib_scratch_autoload")
|
||||||
finish
|
finish
|
||||||
|
@ -100,6 +100,8 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let keyargs.scratch = bufnr('%')
|
let keyargs.scratch = bufnr('%')
|
||||||
|
let keyargs.scratch_tabpagenr = tabpagenr()
|
||||||
|
let keyargs.scratch_winnr = winnr()
|
||||||
" TLogVAR 2, winnr(), bufnr('%'), bufname("%"), keyargs.scratch
|
" TLogVAR 2, winnr(), bufnr('%'), bufname("%"), keyargs.scratch
|
||||||
return keyargs.scratch
|
return keyargs.scratch
|
||||||
endf
|
endf
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-08-27.
|
" @Created: 2007-08-27.
|
||||||
" @Last Change: 2009-02-15.
|
" @Last Change: 2014-02-06.
|
||||||
" @Revision: 0.0.29
|
" @Revision: 0.0.30
|
||||||
|
|
||||||
if &cp || exists("loaded_tlib_tab_autoload")
|
if &cp || exists("loaded_tlib_tab_autoload")
|
||||||
finish
|
finish
|
||||||
|
@ -50,6 +50,8 @@ endf
|
||||||
|
|
||||||
|
|
||||||
function! tlib#tab#Set(tabnr) "{{{3
|
function! tlib#tab#Set(tabnr) "{{{3
|
||||||
exec a:tabnr .'tabnext'
|
if a:tabnr > 0
|
||||||
|
exec a:tabnr .'tabnext'
|
||||||
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2010-07-19.
|
" @Created: 2010-07-19.
|
||||||
" @Last Change: 2012-06-08.
|
" @Last Change: 2012-06-08.
|
||||||
" @Revision: 35
|
" @Revision: 37
|
||||||
|
|
||||||
|
|
||||||
let s:restoreframecmd = ''
|
let s:restoreframecmd = ''
|
||||||
|
@ -120,3 +120,33 @@ function! s:RestoreFrameParams() "{{{3
|
||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" :display: tlib#vim##CopyFunction(old, new, overwrite=0)
|
||||||
|
function! tlib#vim#CopyFunction(old, new, ...) "{{{3
|
||||||
|
let overwrite = a:0 >= 1 ? a:1 : 0
|
||||||
|
redir => oldfn
|
||||||
|
exec 'silent function' a:old
|
||||||
|
redir END
|
||||||
|
if exists('*'. a:new)
|
||||||
|
if overwrite > 0
|
||||||
|
exec 'delfunction' a:new
|
||||||
|
elseif overwrite < 0
|
||||||
|
throw 'tlib#vim##CopyFunction: Function already exists: '. a:old .' -> '. a:new
|
||||||
|
else
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let fn = split(oldfn, '\n')
|
||||||
|
let fn = map(fn, 'substitute(v:val, ''^\d\+'', "", "")')
|
||||||
|
let fn[0] = substitute(fn[0], '\V\^\s\*fu\%[nction]!\?\s\+\zs'. a:old, a:new, '')
|
||||||
|
let t = @t
|
||||||
|
try
|
||||||
|
let @t = join(fn, "\n")
|
||||||
|
redir => out
|
||||||
|
@t
|
||||||
|
redir END
|
||||||
|
finally
|
||||||
|
let @t = t
|
||||||
|
endtry
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,13 @@ Contents~
|
||||||
:TBrowseOutput ......................... |:TBrowseOutput|
|
:TBrowseOutput ......................... |:TBrowseOutput|
|
||||||
:TBrowseScriptnames .................... |:TBrowseScriptnames|
|
:TBrowseScriptnames .................... |:TBrowseScriptnames|
|
||||||
:TTimeCommand .......................... |:TTimeCommand|
|
:TTimeCommand .......................... |:TTimeCommand|
|
||||||
|
Add .................................... |Add()|
|
||||||
|
TestGetArg ............................. |TestGetArg()|
|
||||||
|
TestGetArg1 ............................ |TestGetArg1()|
|
||||||
|
TestArgs ............................... |TestArgs()|
|
||||||
|
TestArgs1 .............................. |TestArgs1()|
|
||||||
|
TestArgs2 .............................. |TestArgs2()|
|
||||||
|
TestArgs3 .............................. |TestArgs3()|
|
||||||
g:tlib#debug ........................... |g:tlib#debug|
|
g:tlib#debug ........................... |g:tlib#debug|
|
||||||
tlib#notify#Echo ....................... |tlib#notify#Echo()|
|
tlib#notify#Echo ....................... |tlib#notify#Echo()|
|
||||||
tlib#notify#TrimMessage ................ |tlib#notify#TrimMessage()|
|
tlib#notify#TrimMessage ................ |tlib#notify#TrimMessage()|
|
||||||
|
@ -53,6 +60,7 @@ Contents~
|
||||||
tlib#vim#Maximize ...................... |tlib#vim#Maximize()|
|
tlib#vim#Maximize ...................... |tlib#vim#Maximize()|
|
||||||
tlib#vim#RestoreWindow ................. |tlib#vim#RestoreWindow()|
|
tlib#vim#RestoreWindow ................. |tlib#vim#RestoreWindow()|
|
||||||
g:tlib#vim#use_wmctrl .................. |g:tlib#vim#use_wmctrl|
|
g:tlib#vim#use_wmctrl .................. |g:tlib#vim#use_wmctrl|
|
||||||
|
tlib#vim#CopyFunction .................. |tlib#vim#CopyFunction()|
|
||||||
tlib#progressbar#Init .................. |tlib#progressbar#Init()|
|
tlib#progressbar#Init .................. |tlib#progressbar#Init()|
|
||||||
tlib#progressbar#Display ............... |tlib#progressbar#Display()|
|
tlib#progressbar#Display ............... |tlib#progressbar#Display()|
|
||||||
tlib#progressbar#Restore ............... |tlib#progressbar#Restore()|
|
tlib#progressbar#Restore ............... |tlib#progressbar#Restore()|
|
||||||
|
@ -89,6 +97,9 @@ Contents~
|
||||||
tlib#char#Get .......................... |tlib#char#Get()|
|
tlib#char#Get .......................... |tlib#char#Get()|
|
||||||
tlib#char#IsAvailable .................. |tlib#char#IsAvailable()|
|
tlib#char#IsAvailable .................. |tlib#char#IsAvailable()|
|
||||||
tlib#char#GetWithTimeout ............... |tlib#char#GetWithTimeout()|
|
tlib#char#GetWithTimeout ............... |tlib#char#GetWithTimeout()|
|
||||||
|
g:tlib#Filter_glob#seq ................. |g:tlib#Filter_glob#seq|
|
||||||
|
g:tlib#Filter_glob#char ................ |g:tlib#Filter_glob#char|
|
||||||
|
tlib#Filter_glob#New ................... |tlib#Filter_glob#New()|
|
||||||
g:tlib_scratch_pos ..................... |g:tlib_scratch_pos|
|
g:tlib_scratch_pos ..................... |g:tlib_scratch_pos|
|
||||||
g:tlib#scratch#hidden .................. |g:tlib#scratch#hidden|
|
g:tlib#scratch#hidden .................. |g:tlib#scratch#hidden|
|
||||||
tlib#scratch#UseScratch ................ |tlib#scratch#UseScratch()|
|
tlib#scratch#UseScratch ................ |tlib#scratch#UseScratch()|
|
||||||
|
@ -124,6 +135,8 @@ Contents~
|
||||||
tlib#agent#CopyItems ................... |tlib#agent#CopyItems()|
|
tlib#agent#CopyItems ................... |tlib#agent#CopyItems()|
|
||||||
tlib#agent#PageUp ...................... |tlib#agent#PageUp()|
|
tlib#agent#PageUp ...................... |tlib#agent#PageUp()|
|
||||||
tlib#agent#PageDown .................... |tlib#agent#PageDown()|
|
tlib#agent#PageDown .................... |tlib#agent#PageDown()|
|
||||||
|
tlib#agent#Home ........................ |tlib#agent#Home()|
|
||||||
|
tlib#agent#End ......................... |tlib#agent#End()|
|
||||||
tlib#agent#Up .......................... |tlib#agent#Up()|
|
tlib#agent#Up .......................... |tlib#agent#Up()|
|
||||||
tlib#agent#Down ........................ |tlib#agent#Down()|
|
tlib#agent#Down ........................ |tlib#agent#Down()|
|
||||||
tlib#agent#UpN ......................... |tlib#agent#UpN()|
|
tlib#agent#UpN ......................... |tlib#agent#UpN()|
|
||||||
|
@ -178,8 +191,6 @@ Contents~
|
||||||
tlib#bitwise#ShiftLeft ................. |tlib#bitwise#ShiftLeft()|
|
tlib#bitwise#ShiftLeft ................. |tlib#bitwise#ShiftLeft()|
|
||||||
tlib#bitwise#Add ....................... |tlib#bitwise#Add()|
|
tlib#bitwise#Add ....................... |tlib#bitwise#Add()|
|
||||||
tlib#bitwise#Sub ....................... |tlib#bitwise#Sub()|
|
tlib#bitwise#Sub ....................... |tlib#bitwise#Sub()|
|
||||||
g:tlib#Filter_cnfx#expander ............ |g:tlib#Filter_cnfx#expander|
|
|
||||||
tlib#Filter_cnfx#New ................... |tlib#Filter_cnfx#New()|
|
|
||||||
tlib#url#Decode ........................ |tlib#url#Decode()|
|
tlib#url#Decode ........................ |tlib#url#Decode()|
|
||||||
tlib#url#DecodeChar .................... |tlib#url#DecodeChar()|
|
tlib#url#DecodeChar .................... |tlib#url#DecodeChar()|
|
||||||
tlib#url#EncodeChar .................... |tlib#url#EncodeChar()|
|
tlib#url#EncodeChar .................... |tlib#url#EncodeChar()|
|
||||||
|
@ -235,6 +246,7 @@ Contents~
|
||||||
g:tlib_inputlist_shortmessage .......... |g:tlib_inputlist_shortmessage|
|
g:tlib_inputlist_shortmessage .......... |g:tlib_inputlist_shortmessage|
|
||||||
tlib#World#New ......................... |tlib#World#New()|
|
tlib#World#New ......................... |tlib#World#New()|
|
||||||
prototype.PrintLines
|
prototype.PrintLines
|
||||||
|
prototype.Suspend
|
||||||
tlib#tab#BufMap ........................ |tlib#tab#BufMap()|
|
tlib#tab#BufMap ........................ |tlib#tab#BufMap()|
|
||||||
tlib#tab#TabWinNr ...................... |tlib#tab#TabWinNr()|
|
tlib#tab#TabWinNr ...................... |tlib#tab#TabWinNr()|
|
||||||
tlib#tab#Set ........................... |tlib#tab#Set()|
|
tlib#tab#Set ........................... |tlib#tab#Set()|
|
||||||
|
@ -409,6 +421,33 @@ plugin/02tlib.vim~
|
||||||
Time the execution time of CMD.
|
Time the execution time of CMD.
|
||||||
|
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
test/tlib.vim~
|
||||||
|
|
||||||
|
*Add()*
|
||||||
|
Add(a,b)
|
||||||
|
List
|
||||||
|
|
||||||
|
*TestGetArg()*
|
||||||
|
TestGetArg(...)
|
||||||
|
Optional arguments
|
||||||
|
|
||||||
|
*TestGetArg1()*
|
||||||
|
TestGetArg1(...)
|
||||||
|
|
||||||
|
*TestArgs()*
|
||||||
|
TestArgs(...)
|
||||||
|
|
||||||
|
*TestArgs1()*
|
||||||
|
TestArgs1(...)
|
||||||
|
|
||||||
|
*TestArgs2()*
|
||||||
|
TestArgs2(...)
|
||||||
|
|
||||||
|
*TestArgs3()*
|
||||||
|
TestArgs3(...)
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
autoload/tlib.vim~
|
autoload/tlib.vim~
|
||||||
|
|
||||||
|
@ -451,7 +490,7 @@ tlib#persistent#Dir(?mode = 'bg')
|
||||||
tlib#persistent#Filename(type, ?file=%, ?mkdir=0)
|
tlib#persistent#Filename(type, ?file=%, ?mkdir=0)
|
||||||
|
|
||||||
*tlib#persistent#Get()*
|
*tlib#persistent#Get()*
|
||||||
tlib#persistent#Get(cfile)
|
tlib#persistent#Get(...)
|
||||||
|
|
||||||
*tlib#persistent#Value()*
|
*tlib#persistent#Value()*
|
||||||
tlib#persistent#Value(...)
|
tlib#persistent#Value(...)
|
||||||
|
@ -500,6 +539,9 @@ g:tlib#vim#use_wmctrl (default: executable('wmctrl'))
|
||||||
default method of setting 'lines' and 'columns' to a large
|
default method of setting 'lines' and 'columns' to a large
|
||||||
value.
|
value.
|
||||||
|
|
||||||
|
*tlib#vim#CopyFunction()*
|
||||||
|
tlib#vim##CopyFunction(old, new, overwrite=0)
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
autoload/tlib/progressbar.vim~
|
autoload/tlib/progressbar.vim~
|
||||||
|
@ -731,6 +773,25 @@ tlib#char#IsAvailable()
|
||||||
tlib#char#GetWithTimeout(timeout, ...)
|
tlib#char#GetWithTimeout(timeout, ...)
|
||||||
|
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
autoload/tlib/Filter_glob.vim~
|
||||||
|
|
||||||
|
*g:tlib#Filter_glob#seq*
|
||||||
|
g:tlib#Filter_glob#seq (default: '*')
|
||||||
|
A character that should be expanded to '\.\{-}'.
|
||||||
|
|
||||||
|
*g:tlib#Filter_glob#char*
|
||||||
|
g:tlib#Filter_glob#char (default: '?')
|
||||||
|
A character that should be expanded to '\.\?'.
|
||||||
|
|
||||||
|
*tlib#Filter_glob#New()*
|
||||||
|
tlib#Filter_glob#New(...)
|
||||||
|
The same as |tlib#Filter_cnf#New()| but a a customizable character
|
||||||
|
|see tlib#Filter_glob#seq| is expanded to '\.\{-}' and
|
||||||
|
|g:tlib#Filter_glob#char| is expanded to '\.'.
|
||||||
|
The pattern is a '/\V' very no-'/magic' regexp pattern.
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
autoload/tlib/scratch.vim~
|
autoload/tlib/scratch.vim~
|
||||||
|
|
||||||
|
@ -829,7 +890,7 @@ tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='')
|
||||||
tlib#cache#Save(cfile, dictionary)
|
tlib#cache#Save(cfile, dictionary)
|
||||||
|
|
||||||
*tlib#cache#Get()*
|
*tlib#cache#Get()*
|
||||||
tlib#cache#Get(cfile)
|
tlib#cache#Get(cfile, ...)
|
||||||
|
|
||||||
*tlib#cache#Value()*
|
*tlib#cache#Value()*
|
||||||
tlib#cache#Value(cfile, generator, ftime, ...)
|
tlib#cache#Value(cfile, generator, ftime, ...)
|
||||||
|
@ -939,6 +1000,12 @@ tlib#agent#PageUp(world, selected)
|
||||||
*tlib#agent#PageDown()*
|
*tlib#agent#PageDown()*
|
||||||
tlib#agent#PageDown(world, selected)
|
tlib#agent#PageDown(world, selected)
|
||||||
|
|
||||||
|
*tlib#agent#Home()*
|
||||||
|
tlib#agent#Home(world, selected)
|
||||||
|
|
||||||
|
*tlib#agent#End()*
|
||||||
|
tlib#agent#End(world, selected)
|
||||||
|
|
||||||
*tlib#agent#Up()*
|
*tlib#agent#Up()*
|
||||||
tlib#agent#Up(world, selected, ...)
|
tlib#agent#Up(world, selected, ...)
|
||||||
|
|
||||||
|
@ -1116,20 +1183,6 @@ tlib#bitwise#Add(num1, num2, ...)
|
||||||
tlib#bitwise#Sub(num1, num2, ...)
|
tlib#bitwise#Sub(num1, num2, ...)
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
autoload/tlib/Filter_cnfx.vim~
|
|
||||||
|
|
||||||
*g:tlib#Filter_cnfx#expander*
|
|
||||||
g:tlib#Filter_cnfx#expander (default: '+')
|
|
||||||
A character that should be expanded to '\.\{-}'.
|
|
||||||
|
|
||||||
*tlib#Filter_cnfx#New()*
|
|
||||||
tlib#Filter_cnfx#New(...)
|
|
||||||
The same as |tlib#Filter_cnfd#New()| but a a customizable character
|
|
||||||
|see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'.
|
|
||||||
The pattern is a '/\V' very no-'/magic' regexp pattern.
|
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
autoload/tlib/url.vim~
|
autoload/tlib/url.vim~
|
||||||
|
|
||||||
|
@ -1274,18 +1327,17 @@ g:tlib#input#livesearch_threshold (default: 1000)
|
||||||
filter. This is useful on slower machines or with very long lists.
|
filter. This is useful on slower machines or with very long lists.
|
||||||
|
|
||||||
*g:tlib#input#filter_mode*
|
*g:tlib#input#filter_mode*
|
||||||
g:tlib#input#filter_mode (default: 'cnfx')
|
g:tlib#input#filter_mode (default: 'glob')
|
||||||
Determine how |tlib#input#List()| and related functions work.
|
Determine how |tlib#input#List()| and related functions work.
|
||||||
Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See:
|
Can be "glob", "cnf", "cnfd", "seq", or "fuzzy". See:
|
||||||
cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted
|
glob ... Like cnf but "*" and "?" (see |g:tlib#Filter_glob#seq|,
|
||||||
as a wildcard (this is the default method)
|
|g:tlib#Filter_glob#char|) are interpreted as glob-like
|
||||||
- A plus character ("+") acts as a wildcard as if ".\{-}" (see
|
|wildcards| (this is the default method)
|
||||||
|/\{-|) were entered.
|
|
||||||
- Examples:
|
- Examples:
|
||||||
- "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
- "f*o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
||||||
"far".
|
"far".
|
||||||
- Otherwise it is a derivate of the cnf method (see below).
|
- Otherwise it is a derivate of the cnf method (see below).
|
||||||
- See also |tlib#Filter_cnfx#New()|.
|
- See also |tlib#Filter_glob#New()|.
|
||||||
cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
|
cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
|
||||||
expanded to "\.\{-}"
|
expanded to "\.\{-}"
|
||||||
- A period character (".") acts as a wildcard as if ".\{-}" (see
|
- A period character (".") acts as a wildcard as if ".\{-}" (see
|
||||||
|
@ -1568,6 +1620,8 @@ tlib#World#New(...)
|
||||||
|
|
||||||
prototype.PrintLines
|
prototype.PrintLines
|
||||||
|
|
||||||
|
prototype.Suspend
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
autoload/tlib/tab.vim~
|
autoload/tlib/tab.vim~
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 2007-04-10.
|
" @Created: 2007-04-10.
|
||||||
" @Last Change: 2013-09-25.
|
" @Last Change: 2013-09-25.
|
||||||
" @Revision: 748
|
" @Revision: 749
|
||||||
" GetLatestVimScripts: 1863 1 tlib.vim
|
" GetLatestVimScripts: 1863 1 tlib.vim
|
||||||
|
|
||||||
if &cp || exists("loaded_tlib")
|
if &cp || exists("loaded_tlib")
|
||||||
|
@ -14,7 +14,7 @@ if v:version < 700 "{{{2
|
||||||
echoerr "tlib requires Vim >= 7"
|
echoerr "tlib requires Vim >= 7"
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let loaded_tlib = 107
|
let loaded_tlib = 108
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
|
@ -19,6 +19,7 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
|
||||||
let tokens = reverse(split(substitute(fnamemodify(name, ':p:.:h'), '\\', '/', 'g'), '/'))
|
let tokens = reverse(split(substitute(fnamemodify(name, ':p:.:h'), '\\', '/', 'g'), '/'))
|
||||||
let token_index = 0
|
let token_index = 0
|
||||||
for token in tokens
|
for token in tokens
|
||||||
|
if token == '' | continue | endif
|
||||||
if token == '.' | break | endif
|
if token == '.' | break | endif
|
||||||
if !has_key(path_tokens, token_index)
|
if !has_key(path_tokens, token_index)
|
||||||
let path_tokens[token_index] = {}
|
let path_tokens[token_index] = {}
|
||||||
|
|
|
@ -36,19 +36,17 @@ function! airline#extensions#whitespace#check()
|
||||||
|
|
||||||
let mixed = 0
|
let mixed = 0
|
||||||
if index(checks, 'indent') > -1
|
if index(checks, 'indent') > -1
|
||||||
let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')]
|
let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw')
|
||||||
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if trailing != 0 || mixed
|
if trailing != 0 || mixed != 0
|
||||||
let b:airline_whitespace_check = s:symbol
|
let b:airline_whitespace_check = s:symbol
|
||||||
if s:show_message
|
if s:show_message
|
||||||
if trailing != 0
|
if trailing != 0
|
||||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
|
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
|
||||||
endif
|
endif
|
||||||
if mixed
|
if mixed != 0
|
||||||
let mixnr = indents[0] == indents[1] ? indents[0] : indents[2]
|
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed)
|
||||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr)
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
1
sources_non_forked/vim-commentary/CONTRIBUTING.markdown
Normal file
1
sources_non_forked/vim-commentary/CONTRIBUTING.markdown
Normal file
|
@ -0,0 +1 @@
|
||||||
|
See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown).
|
|
@ -1,5 +1,4 @@
|
||||||
commentary.vim
|
# commentary.vim
|
||||||
==============
|
|
||||||
|
|
||||||
Comment stuff out. Use `gcc` to comment out a line (takes a count),
|
Comment stuff out. Use `gcc` to comment out a line (takes a count),
|
||||||
`gc` to comment out the target of a motion (for example, `gcap` to
|
`gc` to comment out the target of a motion (for example, `gcap` to
|
||||||
|
@ -15,10 +14,9 @@ minimalism, it weighs in at under 100 lines of code.
|
||||||
Oh, and it uncomments, too. The above maps actually toggle, and `gcu`
|
Oh, and it uncomments, too. The above maps actually toggle, and `gcu`
|
||||||
uncomments a set of adjacent commented lines. Install
|
uncomments a set of adjacent commented lines. Install
|
||||||
[repeat.vim](https://github.com/tpope/vim-repeat) to enable
|
[repeat.vim](https://github.com/tpope/vim-repeat) to enable
|
||||||
repeating `gcu` with `.` (the other maps are repeatable without it).
|
repeating `gcu` with `.`. (The other maps are repeatable without it.)
|
||||||
|
|
||||||
Installation
|
## Installation
|
||||||
------------
|
|
||||||
|
|
||||||
If you don't have a preferred installation method, I recommend
|
If you don't have a preferred installation method, I recommend
|
||||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
||||||
|
@ -30,8 +28,7 @@ then simply copy and paste:
|
||||||
Once help tags have been generated, you can view the manual with
|
Once help tags have been generated, you can view the manual with
|
||||||
`:help commentary`.
|
`:help commentary`.
|
||||||
|
|
||||||
FAQ
|
## FAQ
|
||||||
---
|
|
||||||
|
|
||||||
> My favorite file type isn't supported!
|
> My favorite file type isn't supported!
|
||||||
|
|
||||||
|
@ -39,14 +36,7 @@ Relax! You just have to adjust `'commentstring'`:
|
||||||
|
|
||||||
autocmd FileType apache set commentstring=#\ %s
|
autocmd FileType apache set commentstring=#\ %s
|
||||||
|
|
||||||
Contributing
|
## Self-Promotion
|
||||||
------------
|
|
||||||
|
|
||||||
See the contribution guidelines for
|
|
||||||
[pathogen.vim](https://github.com/tpope/vim-pathogen#readme).
|
|
||||||
|
|
||||||
Self-Promotion
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Like commentary.vim? Follow the repository on
|
Like commentary.vim? Follow the repository on
|
||||||
[GitHub](https://github.com/tpope/vim-commentary) and vote for it on
|
[GitHub](https://github.com/tpope/vim-commentary) and vote for it on
|
||||||
|
@ -55,8 +45,7 @@ you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
||||||
[Twitter](http://twitter.com/tpope) and
|
[Twitter](http://twitter.com/tpope) and
|
||||||
[GitHub](https://github.com/tpope).
|
[GitHub](https://github.com/tpope).
|
||||||
|
|
||||||
License
|
## License
|
||||||
-------
|
|
||||||
|
|
||||||
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
||||||
See `:help license`.
|
See `:help license`.
|
||||||
|
|
|
@ -4,7 +4,7 @@ Author: Tim Pope <http://tpo.pe/>
|
||||||
License: Same terms as Vim itself (see |license|)
|
License: Same terms as Vim itself (see |license|)
|
||||||
|
|
||||||
Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be
|
Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be
|
||||||
correctly set.
|
correctly set, or uses b:commentary_format if it is set.
|
||||||
|
|
||||||
The gc mappings are preferred, while the \\ mappings are provided for
|
The gc mappings are preferred, while the \\ mappings are provided for
|
||||||
backwards compatibility.
|
backwards compatibility.
|
||||||
|
@ -25,4 +25,7 @@ gcc Comment or uncomment [count] lines.
|
||||||
gcu Uncomment the current and adjacent commented lines.
|
gcu Uncomment the current and adjacent commented lines.
|
||||||
\\u
|
\\u
|
||||||
|
|
||||||
|
The |User| CommentaryPost autocommand fires after a successful operation and
|
||||||
|
can be used for advanced customization.
|
||||||
|
|
||||||
vim:tw=78:et:ft=help:norl:
|
vim:tw=78:et:ft=help:norl:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
" commentary.vim - Comment stuff out
|
" commentary.vim - Comment stuff out
|
||||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||||
" Version: 1.1
|
" Version: 1.2
|
||||||
" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim
|
" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim
|
||||||
|
|
||||||
if exists("g:loaded_commentary") || &cp || v:version < 700
|
if exists("g:loaded_commentary") || &cp || v:version < 700
|
||||||
|
@ -8,6 +8,12 @@ if exists("g:loaded_commentary") || &cp || v:version < 700
|
||||||
endif
|
endif
|
||||||
let g:loaded_commentary = 1
|
let g:loaded_commentary = 1
|
||||||
|
|
||||||
|
function! s:surroundings() abort
|
||||||
|
return split(substitute(substitute(
|
||||||
|
\ get(b:, 'commentary_format', &commentstring)
|
||||||
|
\ ,'\S\zs%s',' %s','') ,'%s\ze\S', '%s ', ''), '%s', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:go(type,...) abort
|
function! s:go(type,...) abort
|
||||||
if a:0
|
if a:0
|
||||||
let [lnum1, lnum2] = [a:type, a:1]
|
let [lnum1, lnum2] = [a:type, a:1]
|
||||||
|
@ -15,7 +21,7 @@ function! s:go(type,...) abort
|
||||||
let [lnum1, lnum2] = [line("'["), line("']")]
|
let [lnum1, lnum2] = [line("'["), line("']")]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [l, r] = split(substitute(substitute(&commentstring,'\S\zs%s',' %s',''),'%s\ze\S','%s ',''),'%s',1)
|
let [l, r] = s:surroundings()
|
||||||
let uncomment = 2
|
let uncomment = 2
|
||||||
for lnum in range(lnum1,lnum2)
|
for lnum in range(lnum1,lnum2)
|
||||||
let line = matchstr(getline(lnum),'\S.*\s\@<!')
|
let line = matchstr(getline(lnum),'\S.*\s\@<!')
|
||||||
|
@ -38,10 +44,11 @@ function! s:go(type,...) abort
|
||||||
endif
|
endif
|
||||||
call setline(lnum,line)
|
call setline(lnum,line)
|
||||||
endfor
|
endfor
|
||||||
|
silent doautocmd User CommentaryPost
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:undo()
|
function! s:undo() abort
|
||||||
let [l, r] = split(substitute(substitute(&commentstring,'\S\zs%s',' %s',''),'%s\ze\S','%s ',''),'%s',1)
|
let [l, r] = s:surroundings()
|
||||||
let lnums = [line('.')+1, line('.')-2]
|
let lnums = [line('.')+1, line('.')-2]
|
||||||
for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']]
|
for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']]
|
||||||
while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r)
|
while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r)
|
||||||
|
@ -65,7 +72,7 @@ if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
|
||||||
nmap gcu <Plug>CommentaryUndo
|
nmap gcu <Plug>CommentaryUndo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if maparg('\\','n') ==# '' && maparg('\','n') ==# ''
|
if maparg('\\','n') ==# '' && maparg('\','n') ==# '' && get(g:, 'commentary_map_backslash', 1)
|
||||||
xmap \\ <Plug>Commentary
|
xmap \\ <Plug>Commentary
|
||||||
nmap \\ <Plug>Commentary
|
nmap \\ <Plug>Commentary
|
||||||
nmap \\\ <Plug>CommentaryLine
|
nmap \\\ <Plug>CommentaryLine
|
||||||
|
|
|
@ -3,13 +3,13 @@ and removing other plugins. The sad truth about VimScript is that it is
|
||||||
fraught with incompatibilities waiting to happen. I'm happy to work around
|
fraught with incompatibilities waiting to happen. I'm happy to work around
|
||||||
them where I can, but it's up to you to isolate the conflict.
|
them where I can, but it's up to you to isolate the conflict.
|
||||||
|
|
||||||
If your [commit message sucks](http://stopwritingramblingcommitmessages.com/),
|
Fugitive is particularly prone to regressions due to Git version issues,
|
||||||
I'm not going to accept your pull request. I've explained very politely
|
platform issues, and interactions with other plugins. I end up bisecting a
|
||||||
dozens of times that
|
lot more than other projects, and thus I'm especially meticulous here about
|
||||||
[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
maintaining a clean, readable, history. Squash and force push any requested
|
||||||
are absolute rules on my own repositories, so I may lack the energy to explain
|
changes to a pull request. And if your [commit message
|
||||||
it to you yet another time. And please, if I ask you to change something,
|
sucks](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
|
||||||
`git commit --amend`.
|
I'm not going to accept it. Period.
|
||||||
|
|
||||||
Beyond that, don't be shy about asking before patching. What takes you hours
|
Beyond that, don't be shy about asking before patching. What takes you hours
|
||||||
might take me minutes simply because I have both domain knowledge and a
|
might take me minutes simply because I have both domain knowledge and a
|
||||||
|
|
|
@ -139,6 +139,9 @@ function! fugitive#extract_git_dir(path) abort
|
||||||
if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0
|
if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
|
if root ==# $GIT_WORK_TREE && fugitive#is_git_dir($GIT_DIR)
|
||||||
|
return $GIT_DIR
|
||||||
|
endif
|
||||||
let dir = s:sub(root, '[\/]$', '') . '/.git'
|
let dir = s:sub(root, '[\/]$', '') . '/.git'
|
||||||
let type = getftype(dir)
|
let type = getftype(dir)
|
||||||
if type ==# 'dir' && fugitive#is_git_dir(dir)
|
if type ==# 'dir' && fugitive#is_git_dir(dir)
|
||||||
|
@ -736,14 +739,16 @@ function! s:stage_info(lnum) abort
|
||||||
endwhile
|
endwhile
|
||||||
if !lnum
|
if !lnum
|
||||||
return ['', '']
|
return ['', '']
|
||||||
elseif getline(lnum+1) =~# '^# .*\<git \%(reset\|rm --cached\) ' || getline(lnum) ==# '# Changes to be committed:'
|
elseif (getline(lnum+1) =~# '^# .*\<git \%(reset\|rm --cached\) ' && getline(lnum+2) ==# '#') || getline(lnum) ==# '# Changes to be committed:'
|
||||||
return [matchstr(filename, colon.' *\zs.*'), 'staged']
|
return [matchstr(filename, colon.' *\zs.*'), 'staged']
|
||||||
|
elseif (getline(lnum+1) =~# '^# .*\<git add ' && getline(lnum+2) ==# '#') || getline(lnum) ==# '# Untracked files:'
|
||||||
|
return [filename, 'untracked']
|
||||||
elseif getline(lnum+2) =~# '^# .*\<git checkout ' || getline(lnum) ==# '# Changes not staged for commit:'
|
elseif getline(lnum+2) =~# '^# .*\<git checkout ' || getline(lnum) ==# '# Changes not staged for commit:'
|
||||||
return [matchstr(filename, colon.' *\zs.*'), 'unstaged']
|
return [matchstr(filename, colon.' *\zs.*'), 'unstaged']
|
||||||
elseif getline(lnum+1) =~# '^# .*\<git add/rm ' || getline(lnum) ==# '# Unmerged paths:'
|
elseif getline(lnum+2) =~# '^# .*\<git \%(add\|rm\)' || getline(lnum) ==# '# Unmerged paths:'
|
||||||
return [matchstr(filename, colon.' *\zs.*'), 'unmerged']
|
return [matchstr(filename, colon.' *\zs.*'), 'unmerged']
|
||||||
else
|
else
|
||||||
return [filename, 'untracked']
|
return ['', 'unknown']
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -1142,7 +1147,8 @@ function! s:Edit(cmd,bang,...) abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:bang
|
if a:bang
|
||||||
let args = s:gsub(join(a:000, ' '), '\\@<!%(\\\\)*\zs[%#]', '\=s:buffer().expand(submatch(0))')
|
let arglist = map(copy(a:000), 's:gsub(v:val, ''\\@<!%(\\\\)*\zs[%#]'', ''\=s:buffer().expand(submatch(0))'')')
|
||||||
|
let args = join(arglist, ' ')
|
||||||
if a:cmd =~# 'read'
|
if a:cmd =~# 'read'
|
||||||
let git = buffer.repo().git_command()
|
let git = buffer.repo().git_command()
|
||||||
let last = line('$')
|
let last = line('$')
|
||||||
|
@ -1155,7 +1161,7 @@ function! s:Edit(cmd,bang,...) abort
|
||||||
return 'redraw|echo '.string(':!'.git.' '.args)
|
return 'redraw|echo '.string(':!'.git.' '.args)
|
||||||
else
|
else
|
||||||
let temp = resolve(tempname())
|
let temp = resolve(tempname())
|
||||||
let s:temp_files[temp] = buffer.repo().dir()
|
let s:temp_files[temp] = { 'dir': buffer.repo().dir(), 'args': arglist }
|
||||||
silent execute a:cmd.' '.temp
|
silent execute a:cmd.' '.temp
|
||||||
if a:cmd =~# 'pedit'
|
if a:cmd =~# 'pedit'
|
||||||
wincmd P
|
wincmd P
|
||||||
|
@ -1630,7 +1636,8 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
||||||
else
|
else
|
||||||
let cmd += ['--contents', '-']
|
let cmd += ['--contents', '-']
|
||||||
endif
|
endif
|
||||||
let basecmd = escape(call(s:repo().git_command,cmd+['--',s:buffer().path()],s:repo()),'!')
|
let cmd += ['--', s:buffer().path()]
|
||||||
|
let basecmd = escape(call(s:repo().git_command,cmd,s:repo()),'!')
|
||||||
try
|
try
|
||||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||||
if !s:repo().bare()
|
if !s:repo().bare()
|
||||||
|
@ -1671,7 +1678,7 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
||||||
setlocal scrollbind nowrap nofoldenable
|
setlocal scrollbind nowrap nofoldenable
|
||||||
let top = line('w0') + &scrolloff
|
let top = line('w0') + &scrolloff
|
||||||
let current = line('.')
|
let current = line('.')
|
||||||
let s:temp_files[temp] = s:repo().dir()
|
let s:temp_files[temp] = { 'dir': s:repo().dir(), 'args': cmd }
|
||||||
exe 'keepalt leftabove vsplit '.temp
|
exe 'keepalt leftabove vsplit '.temp
|
||||||
let b:fugitive_blamed_bufnr = bufnr
|
let b:fugitive_blamed_bufnr = bufnr
|
||||||
let w:fugitive_leave = restore
|
let w:fugitive_leave = restore
|
||||||
|
@ -2309,8 +2316,9 @@ augroup fugitive_temp
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufNewFile,BufReadPost *
|
autocmd BufNewFile,BufReadPost *
|
||||||
\ if has_key(s:temp_files,expand('<afile>:p')) |
|
\ if has_key(s:temp_files,expand('<afile>:p')) |
|
||||||
\ let b:git_dir = s:temp_files[expand('<afile>:p')] |
|
\ let b:git_dir = s:temp_files[expand('<afile>:p')].dir |
|
||||||
\ let b:git_type = 'temp' |
|
\ let b:git_type = 'temp' |
|
||||||
|
\ let b:git_args = s:temp_files[expand('<afile>:p')].args |
|
||||||
\ call fugitive#detect(expand('<afile>:p')) |
|
\ call fugitive#detect(expand('<afile>:p')) |
|
||||||
\ setlocal bufhidden=delete |
|
\ setlocal bufhidden=delete |
|
||||||
\ nnoremap <buffer> <silent> q :<C-U>bdelete<CR>|
|
\ nnoremap <buffer> <silent> q :<C-U>bdelete<CR>|
|
||||||
|
|
103
sources_non_forked/vim-golang/autoload/go/complete.vim
Normal file
103
sources_non_forked/vim-golang/autoload/go/complete.vim
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
" Copyright 2011 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" This file provides a utility function that performs auto-completion of
|
||||||
|
" package names, for use by other commands.
|
||||||
|
|
||||||
|
let s:goos = $GOOS
|
||||||
|
let s:goarch = $GOARCH
|
||||||
|
|
||||||
|
if len(s:goos) == 0
|
||||||
|
if exists('g:golang_goos')
|
||||||
|
let s:goos = g:golang_goos
|
||||||
|
elseif has('win32') || has('win64')
|
||||||
|
let s:goos = 'windows'
|
||||||
|
elseif has('macunix')
|
||||||
|
let s:goos = 'darwin'
|
||||||
|
else
|
||||||
|
let s:goos = '*'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(s:goarch) == 0
|
||||||
|
if exists('g:golang_goarch')
|
||||||
|
let s:goarch = g:golang_goarch
|
||||||
|
else
|
||||||
|
let s:goarch = '*'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! go#complete#PackageMembers(package, member)
|
||||||
|
silent! let content = system('godoc ' . a:package)
|
||||||
|
if v:shell_error || !len(content)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'")
|
||||||
|
try
|
||||||
|
let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*'
|
||||||
|
let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*'
|
||||||
|
let candidates =
|
||||||
|
\ map(filter(copy(lines), 'v:val =~ mx1'), 'substitute(v:val, mx1, "\\1", "")')
|
||||||
|
\ + map(filter(copy(lines), 'v:val =~ mx2'), 'substitute(v:val, mx2, "\\1", "")')
|
||||||
|
return filter(candidates, '!stridx(v:val, a:member)')
|
||||||
|
catch
|
||||||
|
return []
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#complete#Package(ArgLead, CmdLine, CursorPos)
|
||||||
|
let dirs = []
|
||||||
|
|
||||||
|
let words = split(a:CmdLine, '\s\+', 1)
|
||||||
|
if len(words) > 2
|
||||||
|
" Complete package members
|
||||||
|
return go#complete#PackageMembers(words[1], words[2])
|
||||||
|
endif
|
||||||
|
|
||||||
|
if executable('go')
|
||||||
|
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
|
||||||
|
if v:shell_error
|
||||||
|
echomsg '\'go env GOROOT\' failed'
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let goroot = $GOROOT
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(goroot) != 0 && isdirectory(goroot)
|
||||||
|
let dirs += [goroot]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let pathsep = ':'
|
||||||
|
if s:goos == 'windows'
|
||||||
|
let pathsep = ';'
|
||||||
|
endif
|
||||||
|
let workspaces = split($GOPATH, pathsep)
|
||||||
|
if workspaces != []
|
||||||
|
let dirs += workspaces
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(dirs) == 0
|
||||||
|
" should not happen
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ret = {}
|
||||||
|
for dir in dirs
|
||||||
|
" this may expand to multiple lines
|
||||||
|
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
|
||||||
|
call add(root, expand(dir . '/src'))
|
||||||
|
for r in root
|
||||||
|
for i in split(globpath(r, a:ArgLead.'*'), "\n")
|
||||||
|
if isdirectory(i)
|
||||||
|
let i .= '/'
|
||||||
|
elseif i !~ '\.a$'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
|
||||||
|
let ret[i] = i
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
return sort(keys(ret))
|
||||||
|
endfunction
|
30
sources_non_forked/vim-golang/compiler/go.vim
Normal file
30
sources_non_forked/vim-golang/compiler/go.vim
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
" Copyright 2013 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" compiler/go.vim: Vim compiler file for Go.
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = "go"
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
CompilerSet makeprg=go\ build
|
||||||
|
CompilerSet errorformat=
|
||||||
|
\%-G#\ %.%#,
|
||||||
|
\%A%f:%l:%c:\ %m,
|
||||||
|
\%A%f:%l:\ %m,
|
||||||
|
\%C%*\\s%m,
|
||||||
|
\%-G%.%#
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4:et
|
23
sources_non_forked/vim-golang/ftdetect/gofiletype.vim
Normal file
23
sources_non_forked/vim-golang/ftdetect/gofiletype.vim
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
" We take care to preserve the user's fileencodings and fileformats,
|
||||||
|
" because those settings are global (not buffer local), yet we want
|
||||||
|
" to override them for loading Go files, which are defined to be UTF-8.
|
||||||
|
let s:current_fileformats = ''
|
||||||
|
let s:current_fileencodings = ''
|
||||||
|
|
||||||
|
" define fileencodings to open as utf-8 encoding even if it's ascii.
|
||||||
|
function! s:gofiletype_pre()
|
||||||
|
let s:current_fileformats = &g:fileformats
|
||||||
|
let s:current_fileencodings = &g:fileencodings
|
||||||
|
set fileencodings=utf-8 fileformats=unix
|
||||||
|
setlocal filetype=go
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" restore fileencodings as others
|
||||||
|
function! s:gofiletype_post()
|
||||||
|
let &g:fileformats = s:current_fileformats
|
||||||
|
let &g:fileencodings = s:current_fileencodings
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
|
||||||
|
au BufRead *.go call s:gofiletype_pre()
|
||||||
|
au BufReadPost *.go call s:gofiletype_post()
|
17
sources_non_forked/vim-golang/ftplugin/go.vim
Normal file
17
sources_non_forked/vim-golang/ftplugin/go.vim
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
" Copyright 2013 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" go.vim: Vim filetype plugin for Go.
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||||
|
setlocal commentstring=//\ %s
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setl com< cms<"
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4:et
|
69
sources_non_forked/vim-golang/ftplugin/go/fmt.vim
Normal file
69
sources_non_forked/vim-golang/ftplugin/go/fmt.vim
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
" Copyright 2011 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" fmt.vim: Vim command to format Go files with gofmt.
|
||||||
|
"
|
||||||
|
" This filetype plugin add a new commands for go buffers:
|
||||||
|
"
|
||||||
|
" :Fmt
|
||||||
|
"
|
||||||
|
" Filter the current Go buffer through gofmt.
|
||||||
|
" It tries to preserve cursor position and avoids
|
||||||
|
" replacing the buffer with stderr output.
|
||||||
|
"
|
||||||
|
" Options:
|
||||||
|
"
|
||||||
|
" g:go_fmt_commands [default=1]
|
||||||
|
"
|
||||||
|
" Flag to indicate whether to enable the commands listed above.
|
||||||
|
"
|
||||||
|
" g:gofmt_command [default="gofmt"]
|
||||||
|
"
|
||||||
|
" Flag naming the gofmt executable to use.
|
||||||
|
"
|
||||||
|
if exists("b:did_ftplugin_go_fmt")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("g:go_fmt_commands")
|
||||||
|
let g:go_fmt_commands = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("g:gofmt_command")
|
||||||
|
let g:gofmt_command = "gofmt"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:go_fmt_commands
|
||||||
|
command! -buffer Fmt call s:GoFormat()
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:GoFormat()
|
||||||
|
let view = winsaveview()
|
||||||
|
silent execute "%!" . g:gofmt_command
|
||||||
|
if v:shell_error
|
||||||
|
let errors = []
|
||||||
|
for line in getline(1, line('$'))
|
||||||
|
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
||||||
|
if !empty(tokens)
|
||||||
|
call add(errors, {"filename": @%,
|
||||||
|
\"lnum": tokens[2],
|
||||||
|
\"col": tokens[3],
|
||||||
|
\"text": tokens[4]})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if empty(errors)
|
||||||
|
% | " Couldn't detect gofmt error format, output errors
|
||||||
|
endif
|
||||||
|
undo
|
||||||
|
if !empty(errors)
|
||||||
|
call setqflist(errors, 'r')
|
||||||
|
endif
|
||||||
|
echohl Error | echomsg "Gofmt returned error" | echohl None
|
||||||
|
endif
|
||||||
|
call winrestview(view)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let b:did_ftplugin_go_fmt = 1
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4:et
|
250
sources_non_forked/vim-golang/ftplugin/go/import.vim
Normal file
250
sources_non_forked/vim-golang/ftplugin/go/import.vim
Normal file
|
@ -0,0 +1,250 @@
|
||||||
|
" Copyright 2011 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" import.vim: Vim commands to import/drop Go packages.
|
||||||
|
"
|
||||||
|
" This filetype plugin adds three new commands for go buffers:
|
||||||
|
"
|
||||||
|
" :Import {path}
|
||||||
|
"
|
||||||
|
" Import ensures that the provided package {path} is imported
|
||||||
|
" in the current Go buffer, using proper style and ordering.
|
||||||
|
" If {path} is already being imported, an error will be
|
||||||
|
" displayed and the buffer will be untouched.
|
||||||
|
"
|
||||||
|
" :ImportAs {localname} {path}
|
||||||
|
"
|
||||||
|
" Same as Import, but uses a custom local name for the package.
|
||||||
|
"
|
||||||
|
" :Drop {path}
|
||||||
|
"
|
||||||
|
" Remove the import line for the provided package {path}, if
|
||||||
|
" present in the current Go buffer. If {path} is not being
|
||||||
|
" imported, an error will be displayed and the buffer will be
|
||||||
|
" untouched.
|
||||||
|
"
|
||||||
|
" If you would like to add shortcuts, you can do so by doing the following:
|
||||||
|
"
|
||||||
|
" Import fmt
|
||||||
|
" au Filetype go nnoremap <buffer> <LocalLeader>f :Import fmt<CR>
|
||||||
|
"
|
||||||
|
" Drop fmt
|
||||||
|
" au Filetype go nnoremap <buffer> <LocalLeader>F :Drop fmt<CR>
|
||||||
|
"
|
||||||
|
" Import the word under your cursor
|
||||||
|
" au Filetype go nnoremap <buffer> <LocalLeader>k
|
||||||
|
" \ :exe 'Import ' . expand('<cword>')<CR>
|
||||||
|
"
|
||||||
|
" The backslash '\' is the default maplocalleader, so it is possible that
|
||||||
|
" your vim is set to use a different character (:help maplocalleader).
|
||||||
|
"
|
||||||
|
" Options:
|
||||||
|
"
|
||||||
|
" g:go_import_commands [default=1]
|
||||||
|
"
|
||||||
|
" Flag to indicate whether to enable the commands listed above.
|
||||||
|
"
|
||||||
|
if exists("b:did_ftplugin_go_import")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("g:go_import_commands")
|
||||||
|
let g:go_import_commands = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:go_import_commands
|
||||||
|
command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
|
||||||
|
command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
|
||||||
|
command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:SwitchImport(enabled, localname, path)
|
||||||
|
let view = winsaveview()
|
||||||
|
let path = a:path
|
||||||
|
|
||||||
|
" Quotes are not necessary, so remove them if provided.
|
||||||
|
if path[0] == '"'
|
||||||
|
let path = strpart(path, 1)
|
||||||
|
endif
|
||||||
|
if path[len(path)-1] == '"'
|
||||||
|
let path = strpart(path, 0, len(path) - 1)
|
||||||
|
endif
|
||||||
|
if path == ''
|
||||||
|
call s:Error('Import path not provided')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Extract any site prefix (e.g. github.com/).
|
||||||
|
" If other imports with the same prefix are grouped separately,
|
||||||
|
" we will add this new import with them.
|
||||||
|
" Only up to and including the first slash is used.
|
||||||
|
let siteprefix = matchstr(path, "^[^/]*/")
|
||||||
|
|
||||||
|
let qpath = '"' . path . '"'
|
||||||
|
if a:localname != ''
|
||||||
|
let qlocalpath = a:localname . ' ' . qpath
|
||||||
|
else
|
||||||
|
let qlocalpath = qpath
|
||||||
|
endif
|
||||||
|
let indentstr = 0
|
||||||
|
let packageline = -1 " Position of package name statement
|
||||||
|
let appendline = -1 " Position to introduce new import
|
||||||
|
let deleteline = -1 " Position of line with existing import
|
||||||
|
let linesdelta = 0 " Lines added/removed
|
||||||
|
|
||||||
|
" Find proper place to add/remove import.
|
||||||
|
let line = 0
|
||||||
|
while line <= line('$')
|
||||||
|
let linestr = getline(line)
|
||||||
|
|
||||||
|
if linestr =~# '^package\s'
|
||||||
|
let packageline = line
|
||||||
|
let appendline = line
|
||||||
|
|
||||||
|
elseif linestr =~# '^import\s\+('
|
||||||
|
let appendstr = qlocalpath
|
||||||
|
let indentstr = 1
|
||||||
|
let appendline = line
|
||||||
|
let firstblank = -1
|
||||||
|
let lastprefix = ""
|
||||||
|
while line <= line("$")
|
||||||
|
let line = line + 1
|
||||||
|
let linestr = getline(line)
|
||||||
|
let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)')
|
||||||
|
if empty(m)
|
||||||
|
if siteprefix == "" && a:enabled
|
||||||
|
" must be in the first group
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
" record this position, but keep looking
|
||||||
|
if firstblank < 0
|
||||||
|
let firstblank = line
|
||||||
|
endif
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
if m[1] == ')'
|
||||||
|
" if there's no match, add it to the first group
|
||||||
|
if appendline < 0 && firstblank >= 0
|
||||||
|
let appendline = firstblank
|
||||||
|
endif
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let lastprefix = matchstr(m[4], "^[^/]*/")
|
||||||
|
if a:localname != '' && m[3] != ''
|
||||||
|
let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath)
|
||||||
|
endif
|
||||||
|
let appendstr = m[2] . qlocalpath
|
||||||
|
let indentstr = 0
|
||||||
|
if m[4] == path
|
||||||
|
let appendline = -1
|
||||||
|
let deleteline = line
|
||||||
|
break
|
||||||
|
elseif m[4] < path
|
||||||
|
" don't set candidate position if we have a site prefix,
|
||||||
|
" we've passed a blank line, and this doesn't share the same
|
||||||
|
" site prefix.
|
||||||
|
if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0
|
||||||
|
let appendline = line
|
||||||
|
endif
|
||||||
|
elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0
|
||||||
|
" first entry of site group
|
||||||
|
let appendline = line - 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
break
|
||||||
|
|
||||||
|
elseif linestr =~# '^import '
|
||||||
|
if appendline == packageline
|
||||||
|
let appendstr = 'import ' . qlocalpath
|
||||||
|
let appendline = line - 1
|
||||||
|
endif
|
||||||
|
let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"')
|
||||||
|
if !empty(m)
|
||||||
|
if m[3] == path
|
||||||
|
let appendline = -1
|
||||||
|
let deleteline = line
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
if m[3] < path
|
||||||
|
let appendline = line
|
||||||
|
endif
|
||||||
|
if a:localname != '' && m[2] != ''
|
||||||
|
let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath)
|
||||||
|
endif
|
||||||
|
let appendstr = 'import' . m[1] . qlocalpath
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif linestr =~# '^\(var\|const\|type\|func\)\>'
|
||||||
|
break
|
||||||
|
|
||||||
|
endif
|
||||||
|
let line = line + 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" Append or remove the package import, as requested.
|
||||||
|
if a:enabled
|
||||||
|
if deleteline != -1
|
||||||
|
call s:Error(qpath . ' already being imported')
|
||||||
|
elseif appendline == -1
|
||||||
|
call s:Error('No package line found')
|
||||||
|
else
|
||||||
|
if appendline == packageline
|
||||||
|
call append(appendline + 0, '')
|
||||||
|
call append(appendline + 1, 'import (')
|
||||||
|
call append(appendline + 2, ')')
|
||||||
|
let appendline += 2
|
||||||
|
let linesdelta += 3
|
||||||
|
let appendstr = qlocalpath
|
||||||
|
let indentstr = 1
|
||||||
|
endif
|
||||||
|
call append(appendline, appendstr)
|
||||||
|
execute appendline + 1
|
||||||
|
if indentstr
|
||||||
|
execute 'normal >>'
|
||||||
|
endif
|
||||||
|
let linesdelta += 1
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if deleteline == -1
|
||||||
|
call s:Error(qpath . ' not being imported')
|
||||||
|
else
|
||||||
|
execute deleteline . 'd'
|
||||||
|
let linesdelta -= 1
|
||||||
|
|
||||||
|
if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)'
|
||||||
|
" Delete empty import block
|
||||||
|
let deleteline -= 1
|
||||||
|
execute deleteline . "d"
|
||||||
|
execute deleteline . "d"
|
||||||
|
let linesdelta -= 2
|
||||||
|
endif
|
||||||
|
|
||||||
|
if getline(deleteline) == '' && getline(deleteline - 1) == ''
|
||||||
|
" Delete spacing for removed line too.
|
||||||
|
execute deleteline . "d"
|
||||||
|
let linesdelta -= 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Adjust view for any changes.
|
||||||
|
let view.lnum += linesdelta
|
||||||
|
let view.topline += linesdelta
|
||||||
|
if view.topline < 0
|
||||||
|
let view.topline = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Put buffer back where it was.
|
||||||
|
call winrestview(view)
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:Error(s)
|
||||||
|
echohl Error | echo a:s | echohl None
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let b:did_ftplugin_go_import = 1
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4:et
|
78
sources_non_forked/vim-golang/ftplugin/go/test.sh
Normal file
78
sources_non_forked/vim-golang/ftplugin/go/test.sh
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
#
|
||||||
|
# Copyright 2012 The Go Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
#
|
||||||
|
# Tests for import.vim.
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
cat > base.go <<EOF
|
||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
|
||||||
|
"mycorp/foo"
|
||||||
|
)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
# usage: test_one command pattern
|
||||||
|
# Pattern is a PCRE expression that will match across lines.
|
||||||
|
test_one() {
|
||||||
|
echo 2>&1 -n "$1: "
|
||||||
|
vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \
|
||||||
|
-c "$1" -c 'wq! test.go' base.go
|
||||||
|
# ensure blank lines are treated correctly
|
||||||
|
if ! gofmt test.go | cmp test.go -; then
|
||||||
|
echo 2>&1 "gofmt conflict"
|
||||||
|
gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1
|
||||||
|
fail=1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if ! [[ $(cat test.go) =~ $2 ]]; then
|
||||||
|
echo 2>&1 "$2 did not match"
|
||||||
|
cat test.go | sed "s/^/ /" 2>&1
|
||||||
|
fail=1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo 2>&1 "ok"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tests for Import
|
||||||
|
|
||||||
|
test_one "Import baz" '"baz".*"bytes"'
|
||||||
|
test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"'
|
||||||
|
test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix
|
||||||
|
test_one "Import nat" '"io".*"nat".*"net"'
|
||||||
|
test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"'
|
||||||
|
test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"'
|
||||||
|
test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"'
|
||||||
|
test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"'
|
||||||
|
|
||||||
|
# Tests for Drop
|
||||||
|
|
||||||
|
cat > base.go <<EOF
|
||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"foo"
|
||||||
|
|
||||||
|
"something"
|
||||||
|
"zoo"
|
||||||
|
)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_one "Drop something" '\([^"]*"foo"[^"]*"zoo"[^"]*\)'
|
||||||
|
|
||||||
|
rm -f base.go test.go
|
||||||
|
if [ $fail -gt 0 ]; then
|
||||||
|
echo 2>&1 "FAIL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo 2>&1 "PASS"
|
65
sources_non_forked/vim-golang/indent/go.vim
Normal file
65
sources_non_forked/vim-golang/indent/go.vim
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
" Copyright 2011 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" indent/go.vim: Vim indent file for Go.
|
||||||
|
"
|
||||||
|
" TODO:
|
||||||
|
" - function invocations split across lines
|
||||||
|
" - general line splits (line ends in an operator)
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
" C indentation is too far off useful, mainly due to Go's := operator.
|
||||||
|
" Let's just define our own.
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GoIndent(v:lnum)
|
||||||
|
setlocal indentkeys+=<:>,0=},0=)
|
||||||
|
|
||||||
|
if exists("*GoIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! GoIndent(lnum)
|
||||||
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
|
if prevlnum == 0
|
||||||
|
" top of file
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" grab the previous and current line, stripping comments.
|
||||||
|
let prevl = substitute(getline(prevlnum), '//.*$', '', '')
|
||||||
|
let thisl = substitute(getline(a:lnum), '//.*$', '', '')
|
||||||
|
let previ = indent(prevlnum)
|
||||||
|
|
||||||
|
let ind = previ
|
||||||
|
|
||||||
|
if prevl =~ '[({]\s*$'
|
||||||
|
" previous line opened a block
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
if prevl =~# '^\s*\(case .*\|default\):$'
|
||||||
|
" previous line is part of a switch statement
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
" TODO: handle if the previous line is a label.
|
||||||
|
|
||||||
|
if thisl =~ '^\s*[)}]'
|
||||||
|
" this line closed a block
|
||||||
|
let ind -= &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Colons are tricky.
|
||||||
|
" We want to outdent if it's part of a switch ("case foo:" or "default:").
|
||||||
|
" We ignore trying to deal with jump labels because (a) they're rare, and
|
||||||
|
" (b) they're hard to disambiguate from a composite literal key.
|
||||||
|
if thisl =~# '^\s*\(case .*\|default\):$'
|
||||||
|
let ind -= &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfunction
|
6
sources_non_forked/vim-golang/mirror.txt
Normal file
6
sources_non_forked/vim-golang/mirror.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
This is a mirror of the misc/vim portion of the official Go repository. It is
|
||||||
|
automatically updated.
|
||||||
|
|
||||||
|
Any contributions or issues should be made to the official repository.
|
||||||
|
|
||||||
|
http://golang.org/doc/contribute.html
|
130
sources_non_forked/vim-golang/plugin/godoc.vim
Normal file
130
sources_non_forked/vim-golang/plugin/godoc.vim
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
" Copyright 2011 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" godoc.vim: Vim command to see godoc.
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" Commands:
|
||||||
|
"
|
||||||
|
" :Godoc
|
||||||
|
"
|
||||||
|
" Open the relevant Godoc for either the word[s] passed to the command or
|
||||||
|
" the, by default, the word under the cursor.
|
||||||
|
"
|
||||||
|
" Options:
|
||||||
|
"
|
||||||
|
" g:go_godoc_commands [default=1]
|
||||||
|
"
|
||||||
|
" Flag to indicate whether to enable the commands listed above.
|
||||||
|
|
||||||
|
if exists("g:loaded_godoc")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_godoc = 1
|
||||||
|
|
||||||
|
let s:buf_nr = -1
|
||||||
|
let s:last_word = ''
|
||||||
|
|
||||||
|
if !exists('g:go_godoc_commands')
|
||||||
|
let g:go_godoc_commands = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:go_godoc_commands
|
||||||
|
command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc(<f-args>)
|
||||||
|
endif
|
||||||
|
|
||||||
|
nnoremap <silent> <Plug>(godoc-keyword) :<C-u>call <SID>Godoc('')<CR>
|
||||||
|
|
||||||
|
function! s:GodocView()
|
||||||
|
if !bufexists(s:buf_nr)
|
||||||
|
leftabove new
|
||||||
|
file `="[Godoc]"`
|
||||||
|
let s:buf_nr = bufnr('%')
|
||||||
|
elseif bufwinnr(s:buf_nr) == -1
|
||||||
|
leftabove split
|
||||||
|
execute s:buf_nr . 'buffer'
|
||||||
|
delete _
|
||||||
|
elseif bufwinnr(s:buf_nr) != bufwinnr('%')
|
||||||
|
execute bufwinnr(s:buf_nr) . 'wincmd w'
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal filetype=godoc
|
||||||
|
setlocal bufhidden=delete
|
||||||
|
setlocal buftype=nofile
|
||||||
|
setlocal noswapfile
|
||||||
|
setlocal nobuflisted
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal nocursorline
|
||||||
|
setlocal nocursorcolumn
|
||||||
|
setlocal iskeyword+=:
|
||||||
|
setlocal iskeyword-=-
|
||||||
|
|
||||||
|
nnoremap <buffer> <silent> K :Godoc<cr>
|
||||||
|
|
||||||
|
au BufHidden <buffer> call let <SID>buf_nr = -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:GodocWord(word)
|
||||||
|
if !executable('godoc')
|
||||||
|
echohl WarningMsg
|
||||||
|
echo "godoc command not found."
|
||||||
|
echo " install with: go get code.google.com/p/go.tools/cmd/godoc"
|
||||||
|
echohl None
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let word = a:word
|
||||||
|
silent! let content = system('godoc ' . word)
|
||||||
|
if v:shell_error || !len(content)
|
||||||
|
if len(s:last_word)
|
||||||
|
silent! let content = system('godoc ' . s:last_word.'/'.word)
|
||||||
|
if v:shell_error || !len(content)
|
||||||
|
echo 'No documentation found for "' . word . '".'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let word = s:last_word.'/'.word
|
||||||
|
else
|
||||||
|
echo 'No documentation found for "' . word . '".'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let s:last_word = word
|
||||||
|
silent! call s:GodocView()
|
||||||
|
setlocal modifiable
|
||||||
|
silent! %d _
|
||||||
|
silent! put! =content
|
||||||
|
silent! normal gg
|
||||||
|
setlocal nomodifiable
|
||||||
|
setfiletype godoc
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:Godoc(...)
|
||||||
|
if !len(a:000)
|
||||||
|
let oldiskeyword = &iskeyword
|
||||||
|
setlocal iskeyword+=.
|
||||||
|
let word = expand('<cword>')
|
||||||
|
let &iskeyword = oldiskeyword
|
||||||
|
let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g')
|
||||||
|
let words = split(word, '\.\ze[^./]\+$')
|
||||||
|
else
|
||||||
|
let words = a:000
|
||||||
|
endif
|
||||||
|
if !len(words)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if s:GodocWord(words[0])
|
||||||
|
if len(words) > 1
|
||||||
|
if search('^\%(const\|var\|type\|\s\+\) ' . words[1] . '\s\+=\s')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if search('^func ' . words[1] . '(')
|
||||||
|
silent! normal zt
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
echo 'No documentation found for "' . words[1] . '".'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4:et
|
101
sources_non_forked/vim-golang/readme.txt
Normal file
101
sources_non_forked/vim-golang/readme.txt
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
Vim plugins for Go (http://golang.org)
|
||||||
|
======================================
|
||||||
|
|
||||||
|
To use all the Vim plugins, add these lines to your $HOME/.vimrc.
|
||||||
|
|
||||||
|
" Some Linux distributions set filetype in /etc/vimrc.
|
||||||
|
" Clear filetype flags before changing runtimepath to force Vim to reload them.
|
||||||
|
filetype off
|
||||||
|
filetype plugin indent off
|
||||||
|
set runtimepath+=$GOROOT/misc/vim
|
||||||
|
filetype plugin indent on
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
If you want to select fewer plugins, use the instructions in the rest of
|
||||||
|
this file.
|
||||||
|
|
||||||
|
A popular configuration is to gofmt Go source files when they are saved.
|
||||||
|
To do that, add this line to the end of your $HOME/.vimrc.
|
||||||
|
|
||||||
|
autocmd FileType go autocmd BufWritePre <buffer> Fmt
|
||||||
|
|
||||||
|
|
||||||
|
Vim syntax highlighting
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
To install automatic syntax highlighting for GO programs:
|
||||||
|
|
||||||
|
1. Copy or link the filetype detection script to the ftdetect directory
|
||||||
|
underneath your vim runtime directory (normally $HOME/.vim/ftdetect)
|
||||||
|
2. Copy or link syntax/go.vim to the syntax directory underneath your vim
|
||||||
|
runtime directory (normally $HOME/.vim/syntax). Linking this file rather
|
||||||
|
than just copying it will ensure any changes are automatically reflected
|
||||||
|
in your syntax highlighting.
|
||||||
|
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
|
||||||
|
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
In a typical unix environment you might accomplish this using the following
|
||||||
|
commands:
|
||||||
|
|
||||||
|
mkdir -p $HOME/.vim/ftdetect
|
||||||
|
mkdir -p $HOME/.vim/syntax
|
||||||
|
mkdir -p $HOME/.vim/autoload/go
|
||||||
|
ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
|
||||||
|
ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
|
||||||
|
ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
|
||||||
|
echo "syntax on" >> $HOME/.vimrc
|
||||||
|
|
||||||
|
|
||||||
|
Vim filetype plugins
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
To install one of the available filetype plugins:
|
||||||
|
|
||||||
|
1. Same as 1 above.
|
||||||
|
2. Copy or link ftplugin/go.vim to the ftplugin directory underneath your vim
|
||||||
|
runtime directory (normally $HOME/.vim/ftplugin). Copy or link one or more
|
||||||
|
additional plugins from ftplugin/go/*.vim to the Go-specific subdirectory
|
||||||
|
in the same place ($HOME/.vim/ftplugin/go/*.vim).
|
||||||
|
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
|
||||||
|
|
||||||
|
filetype plugin on
|
||||||
|
|
||||||
|
|
||||||
|
Vim indentation plugin
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
To install automatic indentation:
|
||||||
|
|
||||||
|
1. Same as 1 above.
|
||||||
|
2. Copy or link indent/go.vim to the indent directory underneath your vim
|
||||||
|
runtime directory (normally $HOME/.vim/indent).
|
||||||
|
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
|
||||||
|
|
||||||
|
filetype indent on
|
||||||
|
|
||||||
|
|
||||||
|
Vim compiler plugin
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
To install the compiler plugin:
|
||||||
|
|
||||||
|
1. Same as 1 above.
|
||||||
|
2. Copy or link compiler/go.vim to the compiler directory underneath your vim
|
||||||
|
runtime directory (normally $HOME/.vim/compiler).
|
||||||
|
3. Activate the compiler plugin with ":compiler go". To always enable the
|
||||||
|
compiler plugin in Go source files add an autocommand to your .vimrc file
|
||||||
|
(normally $HOME/.vimrc):
|
||||||
|
|
||||||
|
autocmd FileType go compiler go
|
||||||
|
|
||||||
|
|
||||||
|
Godoc plugin
|
||||||
|
------------
|
||||||
|
|
||||||
|
To install godoc plugin:
|
||||||
|
|
||||||
|
1. Same as 1 above.
|
||||||
|
2. Copy or link plugin/godoc.vim to $HOME/.vim/plugin/godoc,
|
||||||
|
syntax/godoc.vim to $HOME/.vim/syntax/godoc.vim,
|
||||||
|
and autoload/go/complete.vim to $HOME/.vim/autoload/go/complete.vim.
|
207
sources_non_forked/vim-golang/syntax/go.vim
Normal file
207
sources_non_forked/vim-golang/syntax/go.vim
Normal file
|
@ -0,0 +1,207 @@
|
||||||
|
" Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
"
|
||||||
|
" go.vim: Vim syntax file for Go.
|
||||||
|
"
|
||||||
|
" Options:
|
||||||
|
" There are some options for customizing the highlighting; the recommended
|
||||||
|
" settings are the default values, but you can write:
|
||||||
|
" let OPTION_NAME = 0
|
||||||
|
" in your ~/.vimrc file to disable particular options. You can also write:
|
||||||
|
" let OPTION_NAME = 1
|
||||||
|
" to enable particular options. At present, all options default to on.
|
||||||
|
"
|
||||||
|
" - go_highlight_array_whitespace_error
|
||||||
|
" Highlights white space after "[]".
|
||||||
|
" - go_highlight_chan_whitespace_error
|
||||||
|
" Highlights white space around the communications operator that don't follow
|
||||||
|
" the standard style.
|
||||||
|
" - go_highlight_extra_types
|
||||||
|
" Highlights commonly used library types (io.Reader, etc.).
|
||||||
|
" - go_highlight_space_tab_error
|
||||||
|
" Highlights instances of tabs following spaces.
|
||||||
|
" - go_highlight_trailing_whitespace_error
|
||||||
|
" Highlights trailing white space.
|
||||||
|
|
||||||
|
" Quit when a (custom) syntax file was already loaded
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("go_highlight_array_whitespace_error")
|
||||||
|
let go_highlight_array_whitespace_error = 1
|
||||||
|
endif
|
||||||
|
if !exists("go_highlight_chan_whitespace_error")
|
||||||
|
let go_highlight_chan_whitespace_error = 1
|
||||||
|
endif
|
||||||
|
if !exists("go_highlight_extra_types")
|
||||||
|
let go_highlight_extra_types = 1
|
||||||
|
endif
|
||||||
|
if !exists("go_highlight_space_tab_error")
|
||||||
|
let go_highlight_space_tab_error = 1
|
||||||
|
endif
|
||||||
|
if !exists("go_highlight_trailing_whitespace_error")
|
||||||
|
let go_highlight_trailing_whitespace_error = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
syn keyword goDirective package import
|
||||||
|
syn keyword goDeclaration var const type
|
||||||
|
syn keyword goDeclType struct interface
|
||||||
|
|
||||||
|
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
|
||||||
|
syn keyword goConditional if else switch select
|
||||||
|
syn keyword goLabel case default
|
||||||
|
syn keyword goRepeat for range
|
||||||
|
|
||||||
|
hi def link goStatement Statement
|
||||||
|
hi def link goConditional Conditional
|
||||||
|
hi def link goLabel Label
|
||||||
|
hi def link goRepeat Repeat
|
||||||
|
|
||||||
|
" Predefined types
|
||||||
|
syn keyword goType chan map bool string error
|
||||||
|
syn keyword goSignedInts int int8 int16 int32 int64 rune
|
||||||
|
syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr
|
||||||
|
syn keyword goFloats float32 float64
|
||||||
|
syn keyword goComplexes complex64 complex128
|
||||||
|
|
||||||
|
hi def link goType Type
|
||||||
|
hi def link goSignedInts Type
|
||||||
|
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 goType /\<func\>/
|
||||||
|
syn match goDeclaration /^func\>/
|
||||||
|
|
||||||
|
" Predefined functions and values
|
||||||
|
syn keyword goBuiltins append cap close complex copy delete imag len
|
||||||
|
syn keyword goBuiltins make new panic print println real recover
|
||||||
|
syn keyword goConstants iota true false nil
|
||||||
|
|
||||||
|
hi def link goBuiltins Keyword
|
||||||
|
hi def link goConstants Keyword
|
||||||
|
|
||||||
|
" Comments; their contents
|
||||||
|
syn keyword goTodo contained TODO FIXME XXX BUG
|
||||||
|
syn cluster goCommentGroup contains=goTodo
|
||||||
|
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
|
||||||
|
syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell
|
||||||
|
|
||||||
|
hi def link goComment Comment
|
||||||
|
hi def link goTodo Todo
|
||||||
|
|
||||||
|
" Go escapes
|
||||||
|
syn match goEscapeOctal display contained "\\[0-7]\{3}"
|
||||||
|
syn match goEscapeC display contained +\\[abfnrtv\\'"]+
|
||||||
|
syn match goEscapeX display contained "\\x\x\{2}"
|
||||||
|
syn match goEscapeU display contained "\\u\x\{4}"
|
||||||
|
syn match goEscapeBigU display contained "\\U\x\{8}"
|
||||||
|
syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+
|
||||||
|
|
||||||
|
hi def link goEscapeOctal goSpecialString
|
||||||
|
hi def link goEscapeC goSpecialString
|
||||||
|
hi def link goEscapeX goSpecialString
|
||||||
|
hi def link goEscapeU goSpecialString
|
||||||
|
hi def link goEscapeBigU goSpecialString
|
||||||
|
hi def link goSpecialString Special
|
||||||
|
hi def link goEscapeError Error
|
||||||
|
|
||||||
|
" Strings and their contents
|
||||||
|
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
|
||||||
|
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
|
||||||
|
syn region goRawString start=+`+ end=+`+
|
||||||
|
|
||||||
|
hi def link goString String
|
||||||
|
hi def link goRawString String
|
||||||
|
|
||||||
|
" Characters; their contents
|
||||||
|
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
|
||||||
|
syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
|
||||||
|
|
||||||
|
hi def link goCharacter Character
|
||||||
|
|
||||||
|
" Regions
|
||||||
|
syn region goBlock start="{" end="}" transparent fold
|
||||||
|
syn region goParen start='(' end=')' transparent
|
||||||
|
|
||||||
|
" Integers
|
||||||
|
syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>"
|
||||||
|
syn match goHexadecimalInt "\<0x\x\+\>"
|
||||||
|
syn match goOctalInt "\<0\o\+\>"
|
||||||
|
syn match goOctalError "\<0\o*[89]\d*\>"
|
||||||
|
|
||||||
|
hi def link goDecimalInt Integer
|
||||||
|
hi def link goHexadecimalInt Integer
|
||||||
|
hi def link goOctalInt Integer
|
||||||
|
hi def link Integer Number
|
||||||
|
|
||||||
|
" Floating point
|
||||||
|
syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
|
||||||
|
syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
|
||||||
|
syn match goFloat "\<\d\+[Ee][-+]\d\+\>"
|
||||||
|
|
||||||
|
hi def link goFloat Float
|
||||||
|
|
||||||
|
" Imaginary literals
|
||||||
|
syn match goImaginary "\<\d\+i\>"
|
||||||
|
syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>"
|
||||||
|
syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>"
|
||||||
|
syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>"
|
||||||
|
|
||||||
|
hi def link goImaginary Number
|
||||||
|
|
||||||
|
" Spaces after "[]"
|
||||||
|
if go_highlight_array_whitespace_error != 0
|
||||||
|
syn match goSpaceError display "\(\[\]\)\@<=\s\+"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Spacing errors around the 'chan' keyword
|
||||||
|
if go_highlight_chan_whitespace_error != 0
|
||||||
|
" receive-only annotation on chan type
|
||||||
|
syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
|
||||||
|
" send-only annotation on chan type
|
||||||
|
syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
|
||||||
|
" value-ignoring receives in a few contexts
|
||||||
|
syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Extra types commonly seen
|
||||||
|
if go_highlight_extra_types != 0
|
||||||
|
syn match goExtraType /\<bytes\.\(Buffer\)\>/
|
||||||
|
syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/
|
||||||
|
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
|
||||||
|
syn match goExtraType /\<unsafe\.Pointer\>/
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Space-tab error
|
||||||
|
if go_highlight_space_tab_error != 0
|
||||||
|
syn match goSpaceError display " \+\t"me=e-1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Trailing white space error
|
||||||
|
if go_highlight_trailing_whitespace_error != 0
|
||||||
|
syn match goSpaceError display excludenl "\s\+$"
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi def link goExtraType Type
|
||||||
|
hi def link goSpaceError Error
|
||||||
|
|
||||||
|
" Search backwards for a global declaration to start processing the syntax.
|
||||||
|
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
|
||||||
|
|
||||||
|
" There's a bug in the implementation of grouphere. For now, use the
|
||||||
|
" following as a more expensive/less precise workaround.
|
||||||
|
syn sync minlines=500
|
||||||
|
|
||||||
|
let b:current_syntax = "go"
|
20
sources_non_forked/vim-golang/syntax/godoc.vim
Normal file
20
sources_non_forked/vim-golang/syntax/godoc.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
" Copyright 2011 The Go Authors. All rights reserved.
|
||||||
|
" Use of this source code is governed by a BSD-style
|
||||||
|
" license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
syn match godocTitle "^\([A-Z][A-Z ]*\)$"
|
||||||
|
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
|
||||||
|
HiLink godocTitle Title
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
|
||||||
|
let b:current_syntax = "godoc"
|
||||||
|
|
||||||
|
" vim:ts=4 sts=2 sw=2:
|
|
@ -640,27 +640,30 @@ fun! snipMate#ScopesByFile()
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" used by both: completion and insert snippet
|
" used by both: completion and insert snippet
|
||||||
fun! snipMate#GetSnippetsForWordBelowCursor(word, suffix, break_on_first_match)
|
fun! snipMate#GetSnippetsForWordBelowCursor(word, exact)
|
||||||
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
|
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
|
||||||
let parts = split(a:word, '\W\zs')
|
let parts = split(a:word, '\W\zs')
|
||||||
if len(parts) > 2
|
if len(parts) > 2
|
||||||
let parts = parts[-2:] " max 2 additional items, this might become a setting
|
let parts = parts[-2:] " max 2 additional items, this might become a setting
|
||||||
endif
|
endif
|
||||||
let lookups = [a:word.a:suffix]
|
let lookups = [a:word]
|
||||||
let lookup = ''
|
let lookup = ''
|
||||||
for w in reverse(parts)
|
for w in reverse(parts)
|
||||||
let lookup = w . lookup
|
let lookup = w . lookup
|
||||||
if index(lookups, lookup) == -1
|
if index(lookups, lookup) == -1
|
||||||
call add(lookups, lookup.a:suffix)
|
call add(lookups, lookup)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" allow matching '.'
|
" allow matching '.'
|
||||||
if a:word =~ '\.$'
|
if a:word =~ '\.$'
|
||||||
call add(lookups, '.'.a:suffix)
|
call add(lookups, '.')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call filter(lookups, 'v:val != ""')
|
" Remove empty lookup entries, but only if there are other nonempty lookups
|
||||||
|
if len(lookups) > 1
|
||||||
|
call filter(lookups, 'v:val != ""')
|
||||||
|
endif
|
||||||
|
|
||||||
let matching_snippets = []
|
let matching_snippets = []
|
||||||
let snippet = ''
|
let snippet = ''
|
||||||
|
@ -668,12 +671,14 @@ fun! snipMate#GetSnippetsForWordBelowCursor(word, suffix, break_on_first_match)
|
||||||
for word in lookups
|
for word in lookups
|
||||||
let s:c.word = word
|
let s:c.word = word
|
||||||
for [k,snippetD] in items(funcref#Call(s:c['get_snippets'], [snipMate#ScopesByFile(), word]))
|
for [k,snippetD] in items(funcref#Call(s:c['get_snippets'], [snipMate#ScopesByFile(), word]))
|
||||||
if a:suffix == ''
|
" hack: require exact match
|
||||||
" hack: require exact match
|
if a:exact && k !=# word
|
||||||
if k !=# word | continue | endif
|
continue
|
||||||
endif
|
endif
|
||||||
call add(matching_snippets, [k, snippetD])
|
call add(matching_snippets, [k, snippetD])
|
||||||
if a:break_on_first_match | break| endif
|
if a:exact
|
||||||
|
break
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
return matching_snippets
|
return matching_snippets
|
||||||
|
@ -708,7 +713,7 @@ fun! snipMate#WordBelowCursor()
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
||||||
let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, '*', 0), 'v:val[0]')
|
let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, 0), 'v:val[0]')
|
||||||
return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"')
|
return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
@ -769,7 +774,7 @@ function! snipMate#TriggerSnippet(...)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
|
let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
|
||||||
let list = snipMate#GetSnippetsForWordBelowCursor(word, '', 1)
|
let list = snipMate#GetSnippetsForWordBelowCursor(word, 1)
|
||||||
if empty(list)
|
if empty(list)
|
||||||
let snippet = ''
|
let snippet = ''
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
Aaron Broder
|
|
||||||
Adam Folmert
|
|
||||||
Alberto Pose
|
|
||||||
Angel Alonso
|
|
||||||
Ben Orenstein
|
|
||||||
Bill Casarin
|
|
||||||
Christopher Joslyn
|
|
||||||
Daniel Hahler
|
|
||||||
Elliot Murphy
|
|
||||||
Eustaquio Rangel
|
|
||||||
Henrik Nyh
|
|
||||||
Honza Pokorny
|
|
||||||
Iuri Fernandes Queiroz
|
|
||||||
Jakub Nawalaniec
|
|
||||||
James F. Herdman
|
|
||||||
Jon Bernard
|
|
||||||
Kozo NISHIDA
|
|
||||||
Leandro Pincini
|
|
||||||
Marc Weber
|
|
||||||
Marcin Kulik
|
|
||||||
Marjan.Hratson
|
|
||||||
Micah Elliott
|
|
||||||
Michael Sanders
|
|
||||||
Naveed Massjouni
|
|
||||||
Rob Hudson
|
|
||||||
Rok Garbas
|
|
||||||
Sebastian Schulze
|
|
||||||
Srushti Ambekallu
|
|
||||||
Stephen Tudor
|
|
||||||
Steven Oliver
|
|
||||||
Stuart Colville
|
|
||||||
Tom Adams
|
|
||||||
Zied ABID
|
|
||||||
fo60213
|
|
||||||
marutanm
|
|
||||||
msanders
|
|
||||||
Povilas Balzaravičius Pawka
|
|
||||||
Dmitry Dementev
|
|
||||||
Travis Holton
|
|
||||||
Chrisyue
|
|
||||||
Erik Westrup
|
|
||||||
Matt Deacalion Stevens
|
|
||||||
|
|
||||||
TODO: add contributors from github.com/SirVer/Ultisnip having contributed to
|
|
||||||
github.com/SirVer/Ultisnip/UltiSnips/* files
|
|
|
@ -1,5 +1,3 @@
|
||||||
IMPORTANT: comment on: [What about merging with Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114)
|
|
||||||
|
|
||||||
Snipmate & UltiSnip Snippets
|
Snipmate & UltiSnip Snippets
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
@ -9,51 +7,48 @@ It is community-maintained and many people have contributed snippet files and
|
||||||
other improvements already.
|
other improvements already.
|
||||||
|
|
||||||
Contents
|
Contents
|
||||||
========
|
--------
|
||||||
|
|
||||||
snippets/*: snippets using snipmate format
|
- `snippets/*`: snippets using snipmate format
|
||||||
UltiSnips/*: snippets using UltiSnips format
|
- `UltiSnips/*`: snippets using UltiSnips format
|
||||||
|
|
||||||
Snippet engines supporting vim-snippets
|
Snippet engines supporting vim-snippets
|
||||||
========================================
|
----------------------------------------
|
||||||
|
|
||||||
There are different forks of snippet engines which allow the user to insert
|
There are different forks of snippet engines which allow the user to insert
|
||||||
snippets by typing the name of a snippet hitting the expansion mapping.
|
snippets by typing the name of a snippet hitting the expansion mapping.
|
||||||
|
|
||||||
github.com/garbas/vim-snipmate:
|
- [github.com/SirVer/ultisnips](https://github.com/SirVer/ultisnips):
|
||||||
VimL, snipmate-snippets, engine sometimes behaves strange, supports
|
python, supports all snippets in this repo.
|
||||||
rewriting snippets on the fly (eg adding a second version with folding
|
- [github.com/garbas/vim-snipmate](https://github.com/garbas/vim-snipmate):
|
||||||
markers)
|
VimL, snipmate-snippets, engine sometimes behaves strange. Supports
|
||||||
|
snippets/*
|
||||||
|
- [github.com/Shougo/neosnippet](https://github.com/Shougo/neosnippet.vim):
|
||||||
|
VimL, supports snippets/* with some configuration.
|
||||||
|
- [github.com/drmingdrmer/xptemplate](https://github.com/drmingdrmer/xptemplate):
|
||||||
|
Totally different syntax, does not read snippets contained in this file, but
|
||||||
|
it is also very powerful. It does not support vim-snippets (just listing it
|
||||||
|
here for completness)
|
||||||
|
|
||||||
github.com/MarcWeber/UltiSnips:
|
There tries to be a more comprehensive list (which still is incomplete) here:
|
||||||
python, snipmate-snippets and UltiSnips-snippets
|
http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html
|
||||||
|
|
||||||
github.com/SirVer/ultisnips:
|
UltiSnips has additional features such as high speed, nesting snippets,
|
||||||
python, UltiSnips-snippets
|
expanding snippets in snippets and offers powerful transformations on text in
|
||||||
|
snippets (like visual selections or placeholder texts).
|
||||||
|
|
||||||
github.com/Shougo/neosnippet:
|
Which one to use? If you have python give
|
||||||
viml, has a compatible mode allowing to reuse most snipmate snippets ?
|
[SirVer/ultisnips](https://github.com/SirVer/ultisnips) a try because its fast
|
||||||
|
and has the most features.
|
||||||
github.com/drmingdrmer/xptemplate:
|
|
||||||
Totally different syntax, does not read snippets contained in this file,
|
|
||||||
but it is also very powerful. It does not support vim-snippets (just
|
|
||||||
listing it here for completness)
|
|
||||||
|
|
||||||
This tries to be a more comprehensive list (which still is incomplete)
|
|
||||||
http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html
|
|
||||||
|
|
||||||
UltiSnips engine has additional features such as "nested snippets".
|
|
||||||
|
|
||||||
Which one to use? If you have python give MarcWeber/UltiSnips a try because its
|
|
||||||
fast and supports all important features. You can prefer the UltiSnip versions
|
|
||||||
of the snippets by setting the "always_use_first_snippet" option to 1.
|
|
||||||
|
|
||||||
If you have VimL only (vim without python support) your best option is using
|
If you have VimL only (vim without python support) your best option is using
|
||||||
garbas/vim-snipmate and cope with the minor bugs found in the engine.
|
[garbas/vim-snipmate](https://github.com/garbas/vim-snipmate) and cope with the
|
||||||
|
minor bugs found in the engine.
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
------------
|
||||||
|
|
||||||
First be aware that there are many options, see "Snippet engines" above.
|
First be aware that there are many options, see "Snippet engines" above.
|
||||||
Second be aware than there are [tons of plugin managers](http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html)
|
Second be aware than there are [tons of plugin managers](http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html)
|
||||||
which is why Marc Weber thinks that it doesn't make sense to repeat the same
|
which is why Marc Weber thinks that it doesn't make sense to repeat the same
|
||||||
|
@ -84,7 +79,8 @@ If you still have trouble getting this to work create a github ticket, ask on
|
||||||
irc or the mailinglist.
|
irc or the mailinglist.
|
||||||
|
|
||||||
Policies / for contributors
|
Policies / for contributors
|
||||||
===========================
|
---------------------------
|
||||||
|
|
||||||
Some snippets are useful for almost all languages, so let's try to have the same
|
Some snippets are useful for almost all languages, so let's try to have the same
|
||||||
triggers for them:
|
triggers for them:
|
||||||
|
|
||||||
|
@ -96,11 +92,7 @@ el : else ..
|
||||||
wh : while (cond) ...
|
wh : while (cond) ...
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're not satisfied with these defaults, open a ticket that we implement
|
Don't add useless placeholder default texts like
|
||||||
aliasing. Then you can remap "else" to "el" or the like.
|
|
||||||
|
|
||||||
|
|
||||||
Don't add stupid placeholder default texts like
|
|
||||||
```
|
```
|
||||||
if (${1:condition}){
|
if (${1:condition}){
|
||||||
${2:some code here}
|
${2:some code here}
|
||||||
|
@ -127,7 +119,7 @@ Discuss at: https://github.com/honza/vim-snippets/issues/230
|
||||||
|
|
||||||
|
|
||||||
Related repositories
|
Related repositories
|
||||||
====================
|
--------------------
|
||||||
We also encourage people to maintain sets of snippets for particular use cases
|
We also encourage people to maintain sets of snippets for particular use cases
|
||||||
so that all users can benefit from them. People can list their snippet repositories here:
|
so that all users can benefit from them. People can list their snippet repositories here:
|
||||||
|
|
||||||
|
@ -138,15 +130,15 @@ so that all users can benefit from them. People can list their snippet reposito
|
||||||
|
|
||||||
Installation using VAM: "github:rbonvall/snipmate-snippets-bib"
|
Installation using VAM: "github:rbonvall/snipmate-snippets-bib"
|
||||||
|
|
||||||
|
|
||||||
Future - ideas - examples
|
Future - ideas - examples
|
||||||
=========================
|
-------------------------
|
||||||
|
|
||||||
[overview snippet engines](http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html)
|
[overview snippet engines](http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html)
|
||||||
If you have ideas you can add them to that list of "snippet engine features by example".
|
If you have ideas you can add them to that list of "snippet engine features by example".
|
||||||
|
|
||||||
|
|
||||||
Historical notes
|
Historical notes
|
||||||
================
|
----------------
|
||||||
|
|
||||||
[vim-snipmate][1] was originally started by [Michael Sanders][2] who has now
|
[vim-snipmate][1] was originally started by [Michael Sanders][2] who has now
|
||||||
unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a
|
unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a
|
||||||
|
@ -170,17 +162,6 @@ let g:snipMate.scope_aliases = {}
|
||||||
let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'
|
let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'
|
||||||
```
|
```
|
||||||
|
|
||||||
or github.com/MarcWeber/UltiSnips this way:
|
|
||||||
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:UltiSnips = {}
|
|
||||||
|
|
||||||
let g:UltiSnips.snipmate_ft_filter = {
|
|
||||||
\ 'default' : {'filetypes': ["FILETYPE"] },
|
|
||||||
\ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] },
|
|
||||||
```
|
|
||||||
|
|
||||||
If it happens that you work on a project requiring ruby-1.8 snippets instead,
|
If it happens that you work on a project requiring ruby-1.8 snippets instead,
|
||||||
consider using vim-addon-local-vimrc and override the filetypes.
|
consider using vim-addon-local-vimrc and override the filetypes.
|
||||||
|
|
||||||
|
@ -192,16 +173,15 @@ ruby-library-version triplet. Sometimes postfixing a name such as
|
||||||
|
|
||||||
will do it then if syntax has changed.
|
will do it then if syntax has changed.
|
||||||
|
|
||||||
|
|
||||||
Language maintainers
|
Language maintainers
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
No one can really be proficient in all programming languages. If you would like
|
No one can really be proficient in all programming languages. If you would like
|
||||||
to maintain snippets for a language, please get in touch.
|
to maintain snippets for a language, please get in touch.
|
||||||
|
|
||||||
Notes: People are interested in snippets - and their interest may stop again
|
Notes: People are interested in snippets - and their interest may wane again.
|
||||||
at will. So its ok if people maintain a language only for a short period of
|
This list is kept up-to-date on a best effort basis.
|
||||||
time - or jump in and get things done - don't let the flow stop :)
|
|
||||||
vim-snippets is not like the "linux kernel".
|
|
||||||
|
|
||||||
* Python - [honza](http://github.com/honza)
|
* Python - [honza](http://github.com/honza)
|
||||||
* Javascript - [honza](http://github.com/honza)
|
* Javascript - [honza](http://github.com/honza)
|
||||||
|
@ -220,18 +200,13 @@ Until further work is done on `vim-snipmate`, please don't add folding markers
|
||||||
into snippets. `vim-snipmate` has some comments about how to patch all snippets
|
into snippets. `vim-snipmate` has some comments about how to patch all snippets
|
||||||
on the fly adding those.
|
on the fly adding those.
|
||||||
|
|
||||||
Because MarcWeber/UltiSnips [6] supports also snipmate-snippets there is no
|
Because UltiSnips reads snipmate-snippets too there is no need to duplicate all
|
||||||
need to duplicate all snippets - only those snippets who use advanced UltiSnips
|
snippets - only those snippets who use advanced UltiSnips features should be
|
||||||
features should be duplicated in UltiSnips (?)
|
duplicated in UltiSnips.
|
||||||
|
|
||||||
Currently all snippets from UltiSnips have been put into UltiSnips - some work
|
Currently all snippets from UltiSnips have been put into UltiSnips - some work
|
||||||
on merging should be done (dropping duplicates etc)
|
on merging should be done (dropping duplicates etc)
|
||||||
|
|
||||||
Authors
|
|
||||||
-------
|
|
||||||
|
|
||||||
For a list of authors, please see the `AUTHORS` files.
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -243,5 +218,4 @@ terms of the MIT license.
|
||||||
[2]: http://github.com/msanders
|
[2]: http://github.com/msanders
|
||||||
[3]: http://github.com/garbas
|
[3]: http://github.com/garbas
|
||||||
[4]: http://github.com/garbas/vim-snipmate
|
[4]: http://github.com/garbas/vim-snipmate
|
||||||
[6]: http://github.com/MarcWeber/UltiSnips
|
|
||||||
[7]: http://github.com/SirVer/ultisnips
|
[7]: http://github.com/SirVer/ultisnips
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
This directory contains the main scripts that come bundled with UltiSnips.
|
This directory contains the snippets for UltiSnips.
|
||||||
|
https://github.com/sirver/ultisnips
|
||||||
|
|
||||||
Standing On The Shoulders of Giants
|
Standing On The Shoulders of Giants
|
||||||
===================================
|
===================================
|
||||||
|
@ -10,12 +11,7 @@ two projects:
|
||||||
TextMate: http://svn.textmate.org/trunk/Bundles/
|
TextMate: http://svn.textmate.org/trunk/Bundles/
|
||||||
SnipMate: http://code.google.com/p/snipmate/
|
SnipMate: http://code.google.com/p/snipmate/
|
||||||
|
|
||||||
All snippets from those sources were copied and cleaned up, so that they are
|
UltiSnips has seen contributions by many individuals. Those contributions have
|
||||||
- not using shell script, only python (so they are cross platform compatible)
|
been merged into this collection seamlessly and without further comments.
|
||||||
- not using any feature that UltiSnips doesn't offer
|
|
||||||
|
|
||||||
UltiSnips has seen contributions by various individuals. Those contributions
|
|
||||||
have been merged into this collection seamlessly and without further comments.
|
|
||||||
|
|
||||||
-- vim:ft=rst:nospell:
|
-- vim:ft=rst:nospell:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
# This file contains snippets that are always defined. I personally
|
# This file contains snippets that are always defined. I personally
|
||||||
# have snippets for signatures and often needed texts
|
# have snippets for signatures and often needed texts
|
||||||
|
|
||||||
|
# sligthly lower priority than everything else since specialized versions
|
||||||
|
# should overwrite. The user needs to adjust her priority in her snippets to
|
||||||
|
# ~-55 so that other filetypes will still overwrite.
|
||||||
|
priority -60
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# NICE BOXES #
|
# NICE BOXES #
|
||||||
##############
|
##############
|
||||||
|
@ -12,71 +17,62 @@ Automatically filled during usage"""
|
||||||
_commentDict = { }
|
_commentDict = { }
|
||||||
|
|
||||||
def _parse_comments(s):
|
def _parse_comments(s):
|
||||||
""" Parses vim's comments option to extract comment format """
|
""" Parses vim's comments option to extract comment format """
|
||||||
i = iter(s.split(","))
|
i = iter(s.split(","))
|
||||||
|
|
||||||
rv = []
|
rv = []
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
# get the flags and text of a comment part
|
# get the flags and text of a comment part
|
||||||
flags,text = i.next().split(':', 1)
|
flags, text = next(i).split(':', 1)
|
||||||
|
|
||||||
if len(flags) == 0:
|
if len(flags) == 0:
|
||||||
if len(text) == 1:
|
rv.append((text, text, text, ""))
|
||||||
rv.append((text,text,text, ""))
|
# parse 3-part comment, but ignore those with O flag
|
||||||
# parse 3-part comment, but ignore those with O flag
|
elif flags[0] == 's' and 'O' not in flags:
|
||||||
elif flags[0] == 's' and 'O' not in flags:
|
ctriple = []
|
||||||
ctriple = []
|
indent = ""
|
||||||
indent = ""
|
|
||||||
|
|
||||||
if flags[-1] in string.digits:
|
if flags[-1] in string.digits:
|
||||||
indent = " " * int(flags[-1])
|
indent = " " * int(flags[-1])
|
||||||
ctriple.append(text)
|
ctriple.append(text)
|
||||||
|
|
||||||
flags,text = i.next().split(':', 1)
|
flags,text = next(i).split(':', 1)
|
||||||
assert(flags[0] == 'm')
|
assert(flags[0] == 'm')
|
||||||
ctriple.append(text)
|
ctriple.append(text)
|
||||||
|
|
||||||
flags,text = i.next().split(':', 1)
|
flags,text = next(i).split(':', 1)
|
||||||
assert(flags[0] == 'e')
|
assert(flags[0] == 'e')
|
||||||
ctriple.append(text)
|
ctriple.append(text)
|
||||||
ctriple.append(indent)
|
ctriple.append(indent)
|
||||||
|
|
||||||
rv.append(ctriple)
|
rv.append(ctriple)
|
||||||
|
elif flags[0] == 'b':
|
||||||
elif flags[0] == 'b':
|
if len(text) == 1:
|
||||||
if len(text) == 1:
|
rv.insert(0, (text,text,text, ""))
|
||||||
rv.insert(0, (text,text,text, ""))
|
except StopIteration:
|
||||||
|
return rv
|
||||||
except StopIteration:
|
|
||||||
return rv
|
|
||||||
|
|
||||||
def _get_comment_format():
|
def _get_comment_format():
|
||||||
""" Returns a 4-element tuple representing the comment format for
|
""" Returns a 4-element tuple representing the comment format for
|
||||||
the current file. """
|
the current file. """
|
||||||
|
return _parse_comments(vim.eval("&comments"))[0]
|
||||||
ft = vim.eval("&filetype")
|
|
||||||
# check if the comment dict has the format for the current file
|
|
||||||
if _commentDict.has_key(ft):
|
|
||||||
return _commentDict[ft]
|
|
||||||
|
|
||||||
# otherwise parse vim's comments and add it for later use
|
|
||||||
commentformat = _parse_comments(vim.eval("&comments"))[0]
|
|
||||||
_commentDict[ft] = commentformat
|
|
||||||
|
|
||||||
return commentformat
|
|
||||||
|
|
||||||
|
|
||||||
def make_box(twidth, bwidth = None):
|
def make_box(twidth, bwidth=None):
|
||||||
if bwidth is None:
|
b, m, e, i = _get_comment_format()
|
||||||
bwidth = twidth + 2
|
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
|
||||||
b,m,e,i = _get_comment_format()
|
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
|
||||||
sline = b + m + bwidth*m + 2*m
|
nspaces = (bwidth_inner - twidth) // 2
|
||||||
nspaces = (bwidth - twidth)//2
|
mlines = i + m + " " + " " * nspaces
|
||||||
mlines = i + m + " " + " "*nspaces
|
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
|
||||||
mlinee = " " + " "*(bwidth-twidth-nspaces) + m
|
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
|
||||||
eline = i + 2*m + bwidth*m + m + e
|
return sline, mlines, mlinee, eline
|
||||||
return sline, mlines, mlinee, eline
|
|
||||||
|
def foldmarker():
|
||||||
|
"Return a tuple of (open fold marker, close fold marker)"
|
||||||
|
return vim.eval("&foldmarker").split(",")
|
||||||
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet box "A nice box with the current comment symbol" b
|
snippet box "A nice box with the current comment symbol" b
|
||||||
|
@ -91,14 +87,29 @@ endsnippet
|
||||||
|
|
||||||
snippet bbox "A nice box over the full width" b
|
snippet bbox "A nice box over the full width" b
|
||||||
`!p
|
`!p
|
||||||
box = make_box(len(t[1]), 71)
|
width = int(vim.eval("&textwidth")) or 71
|
||||||
|
box = make_box(len(t[1]), width)
|
||||||
snip.rv = box[0] + '\n' + box[1]
|
snip.rv = box[0] + '\n' + box[1]
|
||||||
`${1:content}`!p
|
`${1:content}`!p
|
||||||
box = make_box(len(t[1]), 71)
|
box = make_box(len(t[1]), width)
|
||||||
snip.rv = box[2] + '\n' + box[3]`
|
snip.rv = box[2] + '\n' + box[3]`
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet fold "Insert a vim fold marker" b
|
||||||
|
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet foldc "Insert a vim fold close marker" b
|
||||||
|
`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet foldp "Insert a vim fold marker pair" b
|
||||||
|
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]`
|
||||||
|
${2:${VISUAL:Content}}
|
||||||
|
`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# LOREM IPSUM GENERATORS #
|
# LOREM IPSUM GENERATORS #
|
||||||
##########################
|
##########################
|
||||||
|
|
52
sources_non_forked/vim-snippets/UltiSnips/bib.snippets
Normal file
52
sources_non_forked/vim-snippets/UltiSnips/bib.snippets
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
snippet online "Online resource" b
|
||||||
|
@online{${1:name},
|
||||||
|
author={${2:author}},
|
||||||
|
title={${3:title}},
|
||||||
|
date={${4:date}},
|
||||||
|
url={${5:url}}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet article "Article reference" b
|
||||||
|
@article{${1:name},
|
||||||
|
author={${2:author}},
|
||||||
|
title={${3:title}},
|
||||||
|
journaltitle={${4:journal}},
|
||||||
|
volume={${5:NN}},
|
||||||
|
number={${6:NN}},
|
||||||
|
year={${7:YYYY}},
|
||||||
|
pages={${8:NN}--${9:NN}}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet book "Book reference" b
|
||||||
|
@book{${1:name},
|
||||||
|
author={${2:author}},
|
||||||
|
title={${3:title}},
|
||||||
|
subtitle={${4:subtitle}},
|
||||||
|
year={${5:YYYY}},
|
||||||
|
location={${6:somewhere}},
|
||||||
|
publisher={${7:publisher}},
|
||||||
|
pages={${8:NN}--${9:NN}}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet inb "In Book reference" b
|
||||||
|
@inbook{${1:name},
|
||||||
|
author={${2:author}},
|
||||||
|
title={${3:title}},
|
||||||
|
subtitle={${4:subtitle}},
|
||||||
|
booktitle={${5:book}},
|
||||||
|
editor={${6:editor}},
|
||||||
|
year={${7:YYYY}},
|
||||||
|
location={${8:somewhere}},
|
||||||
|
publisher={${9:publisher}},
|
||||||
|
pages={${10:NN}--${11:NN}}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
|
@ -1,27 +1,29 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
def newsoa():
|
def newsoa():
|
||||||
import datetime
|
import datetime
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
# return standard SOA formatted serial for today
|
# return standard SOA formatted serial for today
|
||||||
return now.strftime("%Y%m%d00")
|
return now.strftime("%Y%m%d00")
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet zone "Bootstrap a new Bind zonefile" b
|
snippet zone "Bootstrap a new Bind zonefile" b
|
||||||
$TTL 86400
|
$TTL 86400
|
||||||
@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.(
|
@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.(
|
||||||
`!p snip.rv = newsoa()`; serial
|
`!p snip.rv = newsoa()`; serial
|
||||||
21600; refresh every 6 hours
|
21600; refresh every 6 hours
|
||||||
3600; retry after one hour
|
3600; retry after one hour
|
||||||
604800; expire after a week
|
604800; expire after a week
|
||||||
86400 ); minimum TTL of 1 day
|
86400 ); minimum TTL of 1 day
|
||||||
|
|
||||||
IN NS ns01.$1.
|
IN NS ns01.$1.
|
||||||
IN MX 10 mail.$1.
|
IN MX 10 mail.$1.
|
||||||
|
|
||||||
ns01.$1 IN A
|
ns01.$1 IN A
|
||||||
mail.$1 IN A
|
mail.$1 IN A
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet A "Insert A Record" b
|
snippet A "Insert A Record" b
|
||||||
${1:hostname} IN A ${2:ip}
|
${1:hostname} IN A ${2:ip}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet def "#define ..."
|
snippet def "#define ..."
|
||||||
#define ${1}
|
#define ${1}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -12,9 +14,9 @@ snippet ifndef "#ifndef ... #define ... #endif"
|
||||||
#endif
|
#endif
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet #if "#if #endif" !b
|
snippet #if "#if #endif" b
|
||||||
#if ${1:0}
|
#if ${1:0}
|
||||||
${VISUAL:code}$0
|
${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}}
|
||||||
#endif
|
#endif
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -36,17 +38,24 @@ $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet main "main() (main)"
|
snippet main "main() (main)"
|
||||||
int main(int argc, char const *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
${0:/* code */}
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for "for int loop (fori)"
|
snippet for "for loop (for)"
|
||||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||||
{
|
{
|
||||||
${0:/* code */}
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet fori "for int loop (fori)"
|
||||||
|
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||||
|
{
|
||||||
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -62,7 +71,7 @@ if not snip.c:
|
||||||
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
|
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
|
||||||
snip.rv = ('%s_%s' % (name,rand)).upper()
|
snip.rv = ('%s_%s' % (name,rand)).upper()
|
||||||
else:
|
else:
|
||||||
snip.rv = snip.c`}
|
snip.rv = snip.c`}
|
||||||
#define $1
|
#define $1
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
|
@ -75,9 +84,15 @@ snippet td "Typedef"
|
||||||
typedef ${1:int} ${2:MyCustomType};
|
typedef ${1:int} ${2:MyCustomType};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet wh "while loop"
|
||||||
|
while(${1:/* condition */}) {
|
||||||
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet do "do...while loop (do)"
|
snippet do "do...while loop (do)"
|
||||||
do {
|
do {
|
||||||
${0:/* code */}
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
} while(${1:/* condition */});
|
} while(${1:/* condition */});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -88,18 +103,30 @@ endsnippet
|
||||||
snippet if "if .. (if)"
|
snippet if "if .. (if)"
|
||||||
if (${1:/* condition */})
|
if (${1:/* condition */})
|
||||||
{
|
{
|
||||||
${0:/* code */}
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet el "else .. (else)"
|
||||||
|
else {
|
||||||
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eli "else if .. (eli)"
|
||||||
|
else if (${1:/* condition */}) {
|
||||||
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ife "if .. else (ife)"
|
snippet ife "if .. else (ife)"
|
||||||
if (${1:/* condition */})
|
if (${1:/* condition */})
|
||||||
{
|
{
|
||||||
${2:/* code */}
|
${2:/* code */}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
${3:/* else */}
|
${3:/* else */}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -114,4 +141,15 @@ struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
|
||||||
};
|
};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet fun "function" b
|
||||||
|
${1:void} ${2:function_name}(${3})
|
||||||
|
{
|
||||||
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet fund "function declaration" b
|
||||||
|
${1:void} ${2:function_name}(${3});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# From the TextMate bundle
|
priority -50
|
||||||
# with some modification
|
|
||||||
|
|
||||||
snippet fun "Function" b
|
snippet fun "Function" b
|
||||||
${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`->
|
${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`->
|
||||||
|
@ -10,52 +9,52 @@ snippet bfun "Function (bound)" i
|
||||||
`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr}
|
`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "If"
|
snippet if "If" b
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ife "If .. Else"
|
snippet ife "If .. Else" b
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${2:# body...}
|
${2:# body...}
|
||||||
else
|
else
|
||||||
${3:# body...}
|
${3:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet eif "Else if" b
|
snippet elif "Else if" b
|
||||||
else if ${1:condition}
|
else if ${1:condition}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifte "Ternary if"
|
snippet ifte "Ternary if" b
|
||||||
if ${1:condition} then ${2:value} else ${3:other}
|
if ${1:condition} then ${2:value} else ${3:other}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet unl "Unless"
|
snippet unl "Unless" b
|
||||||
${1:action} unless ${2:condition}
|
${1:action} unless ${2:condition}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fora "Array Comprehension"
|
snippet fora "Array Comprehension" b
|
||||||
for ${1:name} in ${2:array}
|
for ${1:name} in ${2:array}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet foro "Object Comprehension"
|
snippet foro "Object Comprehension" b
|
||||||
for ${1:key}, ${2:value} of ${3:Object}
|
for ${1:key}, ${2:value} of ${3:Object}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forr "Range Comprehension (inclusive)"
|
snippet forr "Range Comprehension (inclusive)" b
|
||||||
for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forrex "Range Comprehension (exclusive)"
|
snippet forrex "Range Comprehension (exclusive)" b
|
||||||
for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet swi "Switch"
|
snippet swi "Switch" b
|
||||||
switch ${1:object}
|
switch ${1:object}
|
||||||
when ${2:value}
|
when ${2:value}
|
||||||
${3:# body...}
|
${3:# body...}
|
||||||
|
@ -63,7 +62,7 @@ switch ${1:object}
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet swit "Switch when .. then"
|
snippet swit "Switch when .. then" b
|
||||||
switch ${1:object}
|
switch ${1:object}
|
||||||
when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value}
|
when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value}
|
||||||
else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value}
|
else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value}
|
||||||
|
@ -77,7 +76,7 @@ class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor}
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet try "Try .. Catch"
|
snippet try "Try .. Catch" b
|
||||||
try
|
try
|
||||||
$1
|
$1
|
||||||
catch ${2:error}
|
catch ${2:error}
|
||||||
|
@ -95,4 +94,3 @@ endsnippet
|
||||||
snippet log "Log" b
|
snippet log "Log" b
|
||||||
console.log ${1:"${2:msg}"}
|
console.log ${1:"${2:msg}"}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions
|
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions
|
||||||
# for some jasmine-jquery matchers
|
# for some jasmine-jquery matchers
|
||||||
#
|
#
|
||||||
|
priority -50
|
||||||
|
|
||||||
extends coffee
|
extends coffee
|
||||||
|
|
||||||
|
priority -49
|
||||||
|
|
||||||
snippet des "Describe (coffee)" b
|
snippet des "Describe (coffee)" b
|
||||||
describe '${1:description}', ->
|
describe '${1:description}', ->
|
||||||
$0
|
$0
|
||||||
|
@ -160,4 +164,3 @@ endsnippet
|
||||||
snippet noscw "expect was not called with (coffee)" b
|
snippet noscw "expect was not called with (coffee)" b
|
||||||
expect(${1:target}).wasNotCalledWith(${2:arguments})
|
expect(${1:target}).wasNotCalledWith(${2:arguments})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
extends c
|
||||||
|
|
||||||
|
# We want to overwrite everything in parent ft.
|
||||||
|
priority -49
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -20,7 +27,7 @@ endsnippet
|
||||||
snippet ns "namespace .. (namespace)"
|
snippet ns "namespace .. (namespace)"
|
||||||
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
||||||
{
|
{
|
||||||
$0
|
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
|
||||||
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
328
sources_non_forked/vim-snippets/UltiSnips/cs.snippets
Normal file
328
sources_non_forked/vim-snippets/UltiSnips/cs.snippets
Normal file
|
@ -0,0 +1,328 @@
|
||||||
|
#######################################################################
|
||||||
|
# C# Snippets for UltiSnips #
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# classes and structs #
|
||||||
|
#########################
|
||||||
|
|
||||||
|
snippet namespace "namespace" b
|
||||||
|
namespace ${1:MyNamespace}
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet class "class" w
|
||||||
|
class ${1:MyClass}
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet struct "struct" w
|
||||||
|
struct ${1:MyStruct}
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet interface "interface" w
|
||||||
|
interface I${1:Interface}
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet enum "enumeration" b
|
||||||
|
enum ${1:MyEnum} { ${2:Item} };
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
############
|
||||||
|
# Main() #
|
||||||
|
############
|
||||||
|
|
||||||
|
snippet sim "static int main" b
|
||||||
|
static int Main(string[] args)
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet svm "static void main" b
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
################
|
||||||
|
# properties #
|
||||||
|
################
|
||||||
|
|
||||||
|
snippet prop "Simple property declaration" b
|
||||||
|
public ${1:int} ${2:MyProperty} { get; set; }
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet propfull "Full property declaration" b
|
||||||
|
private ${1:int} ${2:_myProperty};
|
||||||
|
|
||||||
|
public $1 ${3:MyProperty}
|
||||||
|
{
|
||||||
|
get { return $2; }
|
||||||
|
set { $2 = value; }
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet propg "Property with a private setter" b
|
||||||
|
public ${1:int} ${2:MyProperty} { get; private set; }
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
############
|
||||||
|
# blocks #
|
||||||
|
############
|
||||||
|
|
||||||
|
snippet #if "#if #endif" b
|
||||||
|
#if ${1:DEBUG}
|
||||||
|
${VISUAL}$0
|
||||||
|
#endif
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet #region "#region #endregion" b
|
||||||
|
#region ${1:Region}
|
||||||
|
${VISUAL}$0
|
||||||
|
#endregion
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
###########
|
||||||
|
# loops #
|
||||||
|
###########
|
||||||
|
|
||||||
|
snippet for "for loop" b
|
||||||
|
for (int ${1:i} = 0; $1 < ${2:10}; $1++)
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet forr "for loop (reverse)" b
|
||||||
|
for (int ${1:i} = ${2:10}; $1 >= 0; $1--)
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet foreach "foreach loop" b
|
||||||
|
foreach (${3:var} ${2:item} in ${1:items})
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet while "while loop" b
|
||||||
|
while (${1:true})
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet do "do loop" b
|
||||||
|
do
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
} while (${1:true});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
###############
|
||||||
|
# branching #
|
||||||
|
###############
|
||||||
|
|
||||||
|
snippet if "if statement" b
|
||||||
|
if ($1)
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ife "if else statement" b
|
||||||
|
if ($1)
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet elif "else if" b
|
||||||
|
else if ($1)
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet elseif "else if" b
|
||||||
|
else if ($1)
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ifnn "if not null" b
|
||||||
|
if ($1 != null)
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet switch "switch statement" b
|
||||||
|
switch (${1:statement})
|
||||||
|
{
|
||||||
|
case ${2:value}:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$0break;
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet case "case" b
|
||||||
|
case ${1:value}:
|
||||||
|
$2
|
||||||
|
break;
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
##############
|
||||||
|
# wrappers #
|
||||||
|
##############
|
||||||
|
|
||||||
|
snippet using "using statement" b
|
||||||
|
using (${1:resource})
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet unchecked "unchecked block" b
|
||||||
|
unchecked
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet checked "checked block" b
|
||||||
|
checked
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet unsafe "unsafe" b
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
########################
|
||||||
|
# exception handling #
|
||||||
|
########################
|
||||||
|
|
||||||
|
snippet try "try catch block" b
|
||||||
|
try
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
catch (${1:Exception} ${2:e})
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet tryf "try finally block" b
|
||||||
|
try
|
||||||
|
{
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet throw "throw"
|
||||||
|
throw new ${1}Exception("${2}");
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
##########
|
||||||
|
# LINQ #
|
||||||
|
##########
|
||||||
|
|
||||||
|
snippet from "LINQ syntax" b
|
||||||
|
var ${1:seq} =
|
||||||
|
from ${2:item1} in ${3:items1}
|
||||||
|
join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2}
|
||||||
|
select ${8:$2.prop3}
|
||||||
|
where ${9:clause}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# feedback and debugging #
|
||||||
|
############################
|
||||||
|
|
||||||
|
snippet da "Debug.Assert" b
|
||||||
|
Debug.Assert(${1:true});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cw "Console.WriteLine" b
|
||||||
|
Console.WriteLine("$1");
|
||||||
|
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
|
||||||
|
snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))])
|
||||||
|
`}"${1:, something});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mbox "Message box" b
|
||||||
|
MessageBox.Show("${1:message}");
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
##################
|
||||||
|
# full methods #
|
||||||
|
##################
|
||||||
|
|
||||||
|
snippet equals "Equals method" b
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj == null || GetType() != obj.GetType())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
return base.Equals(obj);
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
##############
|
||||||
|
# comments #
|
||||||
|
##############
|
||||||
|
|
||||||
|
snippet /// "XML comment" b
|
||||||
|
/// <summary>
|
||||||
|
/// $1
|
||||||
|
/// </summary>
|
||||||
|
endsnippet
|
|
@ -2,6 +2,8 @@
|
||||||
# Most of these came from TextMate #
|
# Most of these came from TextMate #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet ! "!important CSS (!)"
|
snippet ! "!important CSS (!)"
|
||||||
${1:!important}
|
${1:!important}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# Simple shortcuts
|
# Simple shortcuts
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet imp "import (imp)" b
|
snippet imp "import (imp)" b
|
||||||
import ${1:std.stdio};
|
import ${1:std.stdio};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -42,22 +44,22 @@ endsnippet
|
||||||
|
|
||||||
snippet pub "public (pub)" b
|
snippet pub "public (pub)" b
|
||||||
public:
|
public:
|
||||||
${1:/*members*/}
|
${1:/*members*/}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet priv "private (priv)" b
|
snippet priv "private (priv)" b
|
||||||
private:
|
private:
|
||||||
${1:/*members*/}
|
${1:/*members*/}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet prot "protected (prot)" b
|
snippet prot "protected (prot)" b
|
||||||
protected:
|
protected:
|
||||||
${1:/*members*/}
|
${1:/*members*/}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pack "package (pack)" b
|
snippet pack "package (pack)" b
|
||||||
package:
|
package:
|
||||||
${1:/*members*/}
|
${1:/*members*/}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ret "return (ret)"
|
snippet ret "return (ret)"
|
||||||
|
@ -96,7 +98,7 @@ endsnippet
|
||||||
|
|
||||||
snippet enf "enforce (enf)" b
|
snippet enf "enforce (enf)" b
|
||||||
enforce(${1:/*condition*/},
|
enforce(${1:/*condition*/},
|
||||||
new ${2}Exception(${3:/*args*/}));
|
new ${2}Exception(${3:/*args*/}));
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Branches
|
# Branches
|
||||||
|
@ -104,67 +106,67 @@ endsnippet
|
||||||
snippet if "if .. (if)"
|
snippet if "if .. (if)"
|
||||||
if(${1:/*condition*/})
|
if(${1:/*condition*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${0:/*code*/}
|
${VISUAL}${0:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ife "if .. else (ife)" b
|
snippet ife "if .. else (ife)" b
|
||||||
if(${1:/*condition*/})
|
if(${1:/*condition*/})
|
||||||
{
|
{
|
||||||
${2:/*code*/}
|
${2:/*code*/}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
${3:/*else*/}
|
${3:/*else*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet el "else (el)" b
|
snippet el "else (el)" b
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
${VISUAL}${1:/*code*/}
|
${VISUAL}${1:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet eif "else if (elif)" b
|
snippet elif "else if (elif)" b
|
||||||
else if(${1:/*condition*/})
|
else if(${1:/*condition*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${0:/*code*/}
|
${VISUAL}${0:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sw "switch (sw)"
|
snippet sw "switch (sw)"
|
||||||
switch(${1:/*var*/})
|
switch(${1:/*var*/})
|
||||||
{
|
{
|
||||||
case ${2:/*value*/}:
|
case ${2:/*value*/}:
|
||||||
${3:/*code*/}
|
${3:/*code*/}
|
||||||
break;
|
break;
|
||||||
case ${4:/*value*/}:
|
case ${4:/*value*/}:
|
||||||
${5:/*code*/}
|
${5:/*code*/}
|
||||||
break;
|
break;
|
||||||
${7:/*more cases*/}
|
${7:/*more cases*/}
|
||||||
default:
|
default:
|
||||||
${6:assert(false);}
|
${6:assert(false);}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fsw "final switch (fsw)"
|
snippet fsw "final switch (fsw)"
|
||||||
switch(${1:/*var*/})
|
switch(${1:/*var*/})
|
||||||
{
|
{
|
||||||
case ${2:/*value*/}:
|
case ${2:/*value*/}:
|
||||||
${3:/*code*/}
|
${3:/*code*/}
|
||||||
break;
|
break;
|
||||||
case ${4:/*value*/}:
|
case ${4:/*value*/}:
|
||||||
${5:/*code*/}
|
${5:/*code*/}
|
||||||
break;
|
break;
|
||||||
${7:/*more cases*/}
|
${7:/*more cases*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet case "case (case)" b
|
snippet case "case (case)" b
|
||||||
case ${1:/*value*/}:
|
case ${1:/*value*/}:
|
||||||
${2:/*code*/}
|
${2:/*code*/}
|
||||||
break;
|
break;
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ?: "ternary operator (?:)"
|
snippet ?: "ternary operator (?:)"
|
||||||
|
@ -176,42 +178,42 @@ endsnippet
|
||||||
snippet do "do while (do)" b
|
snippet do "do while (do)" b
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
${VISUAL}${2:/*code*/}
|
${VISUAL}${2:/*code*/}
|
||||||
} while(${1:/*condition*/});
|
} while(${1:/*condition*/});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wh "while (wh)" b
|
snippet wh "while (wh)" b
|
||||||
while(${1:/*condition*/})
|
while(${1:/*condition*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${2:/*code*/}
|
${VISUAL}${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for "for (for)" b
|
snippet for "for (for)" b
|
||||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||||
{
|
{
|
||||||
${VISUAL}${0:/*code*/}
|
${VISUAL}${0:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forever "forever (forever)" b
|
snippet forever "forever (forever)" b
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
${VISUAL}${0:/*code*/}
|
${VISUAL}${0:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fore "foreach (fore)"
|
snippet fore "foreach (fore)"
|
||||||
foreach(${1:/*elem*/}; ${2:/*range*/})
|
foreach(${1:/*elem*/}; ${2:/*range*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:/*code*/}
|
${VISUAL}${3:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forif "foreach if (forif)" b
|
snippet forif "foreach if (forif)" b
|
||||||
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${4:/*code*/}
|
${VISUAL}${4:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -219,8 +221,8 @@ endsnippet
|
||||||
snippet in "in contract (in)" b
|
snippet in "in contract (in)" b
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
assert(${1:/*condition*/}, "${2:error message}");
|
assert(${1:/*condition*/}, "${2:error message}");
|
||||||
${3}
|
${3}
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -228,8 +230,8 @@ endsnippet
|
||||||
snippet out "out contract (out)" b
|
snippet out "out contract (out)" b
|
||||||
out${1:(result)}
|
out${1:(result)}
|
||||||
{
|
{
|
||||||
assert(${2:/*condition*/}, "${3:error message}");
|
assert(${2:/*condition*/}, "${3:error message}");
|
||||||
${4}
|
${4}
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -237,8 +239,8 @@ endsnippet
|
||||||
snippet inv "invariant (inv)" b
|
snippet inv "invariant (inv)" b
|
||||||
invariant()
|
invariant()
|
||||||
{
|
{
|
||||||
assert(${1:/*condition*/}, "${2:error message}");
|
assert(${1:/*condition*/}, "${2:error message}");
|
||||||
${3}
|
${3}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -247,29 +249,29 @@ endsnippet
|
||||||
snippet fun "function definition (fun)"
|
snippet fun "function definition (fun)"
|
||||||
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
||||||
{
|
{
|
||||||
${VISUAL}${5:/*code*/}
|
${VISUAL}${5:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet void "void function definition (void)"
|
snippet void "void function definition (void)"
|
||||||
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
||||||
{
|
{
|
||||||
${VISUAL}${4:/*code*/}
|
${VISUAL}${4:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet this "ctor (this)" w
|
snippet this "ctor (this)" w
|
||||||
this(${1:/*args*/})
|
this(${1:/*args*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${2:/*code*/}
|
${VISUAL}${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet get "getter property (get)" !
|
snippet get "getter property (get)"
|
||||||
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet set "setter property (set)" !
|
snippet set "setter property (set)"
|
||||||
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -278,7 +280,7 @@ endsnippet
|
||||||
snippet main "Main" b
|
snippet main "Main" b
|
||||||
void main(string[] args)
|
void main(string[] args)
|
||||||
{
|
{
|
||||||
${VISUAL}${0: /*code*/}
|
${VISUAL}${0: /*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -293,7 +295,7 @@ endsnippet
|
||||||
snippet scope "scope (scope)" b
|
snippet scope "scope (scope)" b
|
||||||
scope(${1:exit})
|
scope(${1:exit})
|
||||||
{
|
{
|
||||||
${VISUAL}${2:/*code*/}
|
${VISUAL}${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -302,7 +304,7 @@ endsnippet
|
||||||
snippet with "with (with)"
|
snippet with "with (with)"
|
||||||
with(${1})
|
with(${1})
|
||||||
{
|
{
|
||||||
${VISUAL}${2:/*code*/}
|
${VISUAL}${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -311,33 +313,33 @@ endsnippet
|
||||||
snippet try "try/catch (try)" b
|
snippet try "try/catch (try)" b
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
${VISUAL}${1:/*code to try*/}
|
${VISUAL}${1:/*code to try*/}
|
||||||
}
|
}
|
||||||
catch(${2}Exception e)
|
catch(${2}Exception e)
|
||||||
{
|
{
|
||||||
${3:/*handle exception*/}
|
${3:/*handle exception*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet tryf "try/catch/finally (tryf)" b
|
snippet tryf "try/catch/finally (tryf)" b
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
${VISUAL}${1:/*code to try*/}
|
${VISUAL}${1:/*code to try*/}
|
||||||
}
|
}
|
||||||
catch(${2}Exception e)
|
catch(${2}Exception e)
|
||||||
{
|
{
|
||||||
${3:/*handle exception*/}
|
${3:/*handle exception*/}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
${4:/*cleanup*/}
|
${4:/*cleanup*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet catch "catch (catch)" b
|
snippet catch "catch (catch)" b
|
||||||
catch(${1}Exception e)
|
catch(${1}Exception e)
|
||||||
{
|
{
|
||||||
${2:/*handle exception*/}
|
${2:/*handle exception*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -351,35 +353,35 @@ endsnippet
|
||||||
snippet struct "struct (struct)"
|
snippet struct "struct (struct)"
|
||||||
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||||
{
|
{
|
||||||
${2}
|
${2}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet union "union (union)"
|
snippet union "union (union)"
|
||||||
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||||
{
|
{
|
||||||
${2}
|
${2}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet class "class (class)"
|
snippet class "class (class)"
|
||||||
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||||
{
|
{
|
||||||
${2}
|
${2}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet inter "interface (inter)"
|
snippet inter "interface (inter)"
|
||||||
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||||
{
|
{
|
||||||
${2}
|
${2}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet enum "enum (enum)"
|
snippet enum "enum (enum)"
|
||||||
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||||
{
|
{
|
||||||
${2}
|
${2}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -390,10 +392,10 @@ snippet exc "exception declaration (exc)" b
|
||||||
/// ${3:/*documentation*/}
|
/// ${3:/*documentation*/}
|
||||||
class ${1}Exception : ${2}Exception
|
class ${1}Exception : ${2}Exception
|
||||||
{
|
{
|
||||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
public this(string msg, string file = __FILE__, int line = __LINE__)
|
||||||
{
|
{
|
||||||
super(msg, file, line);
|
super(msg, file, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -403,14 +405,14 @@ endsnippet
|
||||||
snippet version "version (version)" b
|
snippet version "version (version)" b
|
||||||
version(${1:/*version name*/})
|
version(${1:/*version name*/})
|
||||||
{
|
{
|
||||||
${VISUAL}${2:/*code*/}
|
${VISUAL}${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet debug "debug" b
|
snippet debug "debug" b
|
||||||
debug
|
debug
|
||||||
{
|
{
|
||||||
${VISUAL}${1:/*code*/}
|
${VISUAL}${1:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -420,7 +422,7 @@ endsnippet
|
||||||
snippet temp "template (temp)" b
|
snippet temp "template (temp)" b
|
||||||
template ${2:/*name*/}(${1:/*args*/})
|
template ${2:/*name*/}(${1:/*args*/})
|
||||||
{
|
{
|
||||||
${3:/*code*/}
|
${3:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -438,7 +440,7 @@ endsnippet
|
||||||
snippet unittest "unittest (unittest)" b
|
snippet unittest "unittest (unittest)" b
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
${1:/*code*/}
|
${1:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -448,41 +450,41 @@ endsnippet
|
||||||
snippet opDis "opDispatch (opDis)" b
|
snippet opDis "opDispatch (opDis)" b
|
||||||
${1:/*return type*/} opDispatch(string s)()
|
${1:/*return type*/} opDispatch(string s)()
|
||||||
{
|
{
|
||||||
${2:/*code*/};
|
${2:/*code*/};
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet op= "opAssign (op=)" b
|
snippet op= "opAssign (op=)" b
|
||||||
void opAssign(${1} rhs) ${2:@safe pure nothrow}
|
void opAssign(${1} rhs) ${2:@safe pure nothrow}
|
||||||
{
|
{
|
||||||
${2:/*code*/}
|
${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet opCmp "opCmp (opCmp)" b
|
snippet opCmp "opCmp (opCmp)" b
|
||||||
int opCmp(${1} rhs) @safe const pure nothrow
|
int opCmp(${1} rhs) @safe const pure nothrow
|
||||||
{
|
{
|
||||||
${2:/*code*/}
|
${2:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet opApply "opApply (opApply)" b
|
snippet opApply "opApply (opApply)" b
|
||||||
int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg)
|
int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
${2:/*loop*/}
|
${2:/*loop*/}
|
||||||
{
|
{
|
||||||
result = dg(${3:/*arg/s*/});
|
result = dg(${3:/*arg/s*/});
|
||||||
if(result){break;}
|
if(result){break;}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet toString "toString (toString)" b
|
snippet toString "toString (toString)" b
|
||||||
string toString() @safe const pure nothrow
|
string toString() @safe const pure nothrow
|
||||||
{
|
{
|
||||||
${1:/*code*/}
|
${1:/*code*/}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -490,12 +492,11 @@ endsnippet
|
||||||
# Comments
|
# Comments
|
||||||
|
|
||||||
|
|
||||||
snippet todo "TODO (todo)" !
|
snippet todo "TODO (todo)"
|
||||||
// TODO: ${1}
|
// TODO: ${1}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# DDoc
|
# DDoc
|
||||||
|
|
||||||
snippet doc "generic ddoc block (doc)" b
|
snippet doc "generic ddoc block (doc)" b
|
||||||
|
@ -508,7 +509,7 @@ snippet fdoc "function ddoc block (fdoc)" b
|
||||||
/// ${1:description}
|
/// ${1:description}
|
||||||
///
|
///
|
||||||
/// ${2:Params: ${3:param} = ${4:param description}
|
/// ${2:Params: ${3:param} = ${4:param description}
|
||||||
/// ${5}}
|
/// ${5}}
|
||||||
///
|
///
|
||||||
/// ${6:Returns: ${7:return value}}
|
/// ${6:Returns: ${7:return value}}
|
||||||
///
|
///
|
||||||
|
@ -517,7 +518,7 @@ endsnippet
|
||||||
|
|
||||||
snippet Par "Params (Par)"
|
snippet Par "Params (Par)"
|
||||||
Params: ${1:param} = ${2:param description}
|
Params: ${1:param} = ${2:param description}
|
||||||
/// ${3}
|
/// ${3}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet Ret "Returns (Ret)"
|
snippet Ret "Returns (Ret)"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
# Generic Tags
|
# Generic Tags
|
||||||
snippet %
|
snippet %
|
||||||
{% ${1} %}${2}
|
{% ${1} %}${2}
|
||||||
|
@ -5,7 +7,7 @@ endsnippet
|
||||||
|
|
||||||
snippet %%
|
snippet %%
|
||||||
{% ${1:tag_name} %}
|
{% ${1:tag_name} %}
|
||||||
${2}
|
${2}
|
||||||
{% end$1 %}
|
{% end$1 %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -17,14 +19,14 @@ endsnippet
|
||||||
|
|
||||||
snippet autoescape
|
snippet autoescape
|
||||||
{% autoescape ${1:off} %}
|
{% autoescape ${1:off} %}
|
||||||
${2}
|
${2}
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet block
|
snippet block
|
||||||
{% block ${1} %}
|
{% block ${1} %}
|
||||||
${2}
|
${2}
|
||||||
{% endblock %}
|
{% endblock $1 %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet #
|
snippet #
|
||||||
|
@ -33,7 +35,7 @@ endsnippet
|
||||||
|
|
||||||
snippet comment
|
snippet comment
|
||||||
{% comment %}
|
{% comment %}
|
||||||
${1}
|
${1}
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ endsnippet
|
||||||
|
|
||||||
snippet filter
|
snippet filter
|
||||||
{% filter ${1} %}
|
{% filter ${1} %}
|
||||||
${2}
|
${2}
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -61,24 +63,24 @@ endsnippet
|
||||||
|
|
||||||
snippet for
|
snippet for
|
||||||
{% for ${1} in ${2} %}
|
{% for ${1} in ${2} %}
|
||||||
${3}
|
${3}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet empty
|
snippet empty
|
||||||
{% empty %}
|
{% empty %}
|
||||||
${1}
|
${1}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if
|
snippet if
|
||||||
{% if ${1} %}
|
{% if ${1} %}
|
||||||
${2}
|
${2}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet el
|
snippet else
|
||||||
{% else %}
|
{% else %}
|
||||||
${1}
|
${1}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifchanged
|
snippet ifchanged
|
||||||
|
@ -87,13 +89,13 @@ endsnippet
|
||||||
|
|
||||||
snippet ifequal
|
snippet ifequal
|
||||||
{% ifequal ${1} ${2} %}
|
{% ifequal ${1} ${2} %}
|
||||||
${3}
|
${3}
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifnotequal
|
snippet ifnotequal
|
||||||
{% ifnotequal ${1} ${2} %}
|
{% ifnotequal ${1} ${2} %}
|
||||||
${3}
|
${3}
|
||||||
{% endifnotequal %}
|
{% endifnotequal %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Credit: @iurifg
|
priority -50
|
||||||
|
|
||||||
snippet do
|
snippet do
|
||||||
do
|
do
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# TEXTMATE SNIPPETS #
|
# TEXTMATE SNIPPETS #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet pat "Case:Receive:Try Clause"
|
snippet pat "Case:Receive:Try Clause"
|
||||||
${1:pattern}${2: when ${3:guard}} ->;
|
${1:pattern}${2: when ${3:guard}} ->;
|
||||||
${4:body}
|
${4:body}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
# TextMate added these variables to cope with changes in ERB handling
|
# TextMate added these variables to cope with changes in ERB handling
|
||||||
# in different versions of Rails -- for instance, Rails 3 automatically
|
# in different versions of Rails -- for instance, Rails 3 automatically
|
||||||
# strips whitespace so that it's no longer necessary to use a form like
|
# strips whitespace so that it's no longer necessary to use a form like
|
||||||
|
@ -11,16 +13,15 @@
|
||||||
#
|
#
|
||||||
global !p
|
global !p
|
||||||
def textmate_var(var, snip):
|
def textmate_var(var, snip):
|
||||||
lookup = dict(
|
lookup = dict(
|
||||||
TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '),
|
TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '),
|
||||||
TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'),
|
TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'),
|
||||||
TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '),
|
TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '),
|
||||||
TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'),
|
TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'),
|
||||||
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>'
|
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>'
|
||||||
)
|
)
|
||||||
|
snip.rv = lookup[var]
|
||||||
snip.rv = lookup[var]
|
return
|
||||||
return
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ endsnippet
|
||||||
|
|
||||||
snippet ft "form_tag"
|
snippet ft "form_tag"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
$0
|
$0
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -52,11 +53,11 @@ endsnippet
|
||||||
|
|
||||||
snippet for "for loop (ERB)"
|
snippet for "for loop (ERB)"
|
||||||
<% if !${1:list}.blank? %>
|
<% if !${1:list}.blank? %>
|
||||||
<% for ${2:item} in ${1} %>
|
<% for ${2:item} in ${1} %>
|
||||||
$3
|
$3
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
$4
|
$4
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -74,7 +75,7 @@ snippet ffhf "form_for hidden_field 2"
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ffl "form_for label 2"
|
snippet ffl "form_for label 2"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ffpf "form_for password_field 2"
|
snippet ffpf "form_for password_field 2"
|
||||||
|
@ -99,7 +100,7 @@ endsnippet
|
||||||
|
|
||||||
snippet fields "fields_for"
|
snippet fields "fields_for"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||||
$0
|
$0
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ snippet f. "f.hidden_field"
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f. "f.label"
|
snippet f. "f.label"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f. "f.password_field"
|
snippet f. "f.password_field"
|
||||||
|
@ -148,14 +149,14 @@ endsnippet
|
||||||
snippet ffe "form_for with errors"
|
snippet ffe "form_for with errors"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
$0
|
$0
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ff "form_for"
|
snippet ff "form_for"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
$0
|
$0
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -271,9 +272,9 @@ snippet st "submit_tag"
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet el "else (ERB)"
|
snippet else "else (ERB)"
|
||||||
<% else %>
|
<% else %>
|
||||||
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "if (ERB)"
|
snippet if "if (ERB)"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# Snippets for Go
|
# Snippets for Go
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
# when to abbriviate and when not?
|
# when to abbriviate and when not?
|
||||||
# b doesn't work here, because it ignores whitespace
|
# b doesn't work here, because it ignores whitespace
|
||||||
# optional local name?
|
# optional local name?
|
||||||
|
@ -31,37 +33,55 @@ const (
|
||||||
)
|
)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet struct "Struct declaration" b
|
||||||
|
type ${1:Struct} struct {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet interface "Interface declaration" b
|
||||||
|
type ${1:Interface} interface {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
# statements
|
# statements
|
||||||
snippet for "For loop" !b
|
snippet for "For loop" b
|
||||||
for ${1:condition}${1/(.+)/ /}{
|
for ${1:condition}${1/(.+)/ /}{
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forr "For range loop" !b
|
snippet forr "For range loop" b
|
||||||
for ${2:name} := range ${1:collection} {
|
for ${2:name} := range ${1:collection} {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "If statement" !b
|
snippet if "If statement" b
|
||||||
if ${1:condition}${1/(.+)/ /}{
|
if ${1:condition}${1/(.+)/ /}{
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet switch "Switch statement" !b
|
snippet switch "Switch statement" b
|
||||||
switch ${1:expression}${1/(.+)/ /}{
|
switch ${1:expression}${1/(.+)/ /}{
|
||||||
case${0}
|
case${0}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet case "Case clause" !b
|
snippet select "Select statement" b
|
||||||
|
select {
|
||||||
|
case${0}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet case "Case clause" b
|
||||||
case ${1:condition}:
|
case ${1:condition}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet default "Default clause" !b
|
snippet default "Default clause" b
|
||||||
default:
|
default:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -86,22 +106,26 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# types and variables
|
# types and variables
|
||||||
snippet map "Map type" !b
|
snippet map "Map type" b
|
||||||
map[${1:keytype}]${2:valtype}
|
map[${1:keytype}]${2:valtype}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet : "Variable declaration :=" !b
|
snippet : "Variable declaration :=" b
|
||||||
${1:name} := ${0:value}
|
${1:name} := ${0:value}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet var "Variable declaration" !b
|
snippet var "Variable declaration" b
|
||||||
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet vars "Variables declaration" !b
|
snippet vars "Variables declaration" b
|
||||||
var (
|
var (
|
||||||
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
||||||
)
|
)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet json "JSON field"
|
||||||
|
\`json:"${1:displayName}"\`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
snippet ife "if ... then ... else ..."
|
priority -50
|
||||||
|
|
||||||
|
snippet if "if ... then ... else ..."
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
then ${2:expression}
|
then ${2:expression}
|
||||||
else ${3:expression}
|
else ${3:expression}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet case "case ... of ..."
|
snippet case "case ... of ..."
|
||||||
case ${1} of
|
case ${1:expression} of
|
||||||
${2} -> ${3}
|
${2:pattern} -> ${3:expression}
|
||||||
${4} -> ${5}
|
${4:pattern} -> ${5:expression}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet :: "Type signature"
|
snippet :: "Type signature"
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
# Snippets for VIM Help Files
|
# Snippets for VIM Help Files
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
def sec_title(snip, t):
|
def sec_title(snip, t):
|
||||||
file_start = snip.fn.split('.')[0]
|
file_start = snip.fn.split('.')[0]
|
||||||
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
||||||
return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1]))
|
return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1]))
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet sec "Section marker" b
|
snippet sec "Section marker" b
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
def x(snip):
|
def x(snip):
|
||||||
if snip.ft.startswith("x"):
|
if snip.ft.startswith("x"):
|
||||||
snip.rv = '/'
|
snip.rv = '/'
|
||||||
else:
|
else:
|
||||||
snip.rv = ""
|
snip.rv = ""
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
############
|
############
|
||||||
|
@ -123,21 +125,21 @@ endsnippet
|
||||||
#############
|
#############
|
||||||
# HTML TAGS #
|
# HTML TAGS #
|
||||||
#############
|
#############
|
||||||
snippet input "Input with Label"
|
snippet input "Input with Label" w
|
||||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet input "XHTML <input>"
|
snippet input "XHTML <input>" w
|
||||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet opt "Option"
|
snippet opt "Option" w
|
||||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
<option${1: value="${2:option}"}>${3:$2}</option>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet select "Select Box"
|
snippet select "Select Box" w
|
||||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
|
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
|
||||||
<option${9: value="${10:option1}"}>${11:$10}</option>
|
<option${9: value="${10:option1}"}>${11:$10}</option>
|
||||||
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
|
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
|
||||||
|
@ -146,18 +148,22 @@ snippet select "Select Box"
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet textarea "XHTML <textarea>"
|
snippet textarea "XHTML <textarea>" w
|
||||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet mailto "XHTML <a mailto: >"
|
snippet mailto "XHTML <a mailto: >" w
|
||||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet base "XHTML <base>"
|
snippet base "XHTML <base>" w
|
||||||
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet img "XHTML <img>" w
|
||||||
|
<img src="${1:imgsrc}">
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet body "XHTML <body>"
|
snippet body "XHTML <body>"
|
||||||
<body id="${1:`!p
|
<body id="${1:`!p
|
||||||
snip.rv = snip.fn and 'Hallo' or 'Nothin'
|
snip.rv = snip.fn and 'Hallo' or 'Nothin'
|
||||||
|
@ -166,13 +172,13 @@ snip.rv = snip.fn and 'Hallo' or 'Nothin'
|
||||||
</body>
|
</body>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet div "XHTML <div>"
|
snippet div "XHTML <div>" w
|
||||||
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
|
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
|
||||||
$0
|
$0
|
||||||
</div>
|
</div>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet form "XHTML <form>"
|
snippet form "XHTML <form>" w
|
||||||
<form action="${1:`!p
|
<form action="${1:`!p
|
||||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||||
`}" method="${2:get}" accept-charset="utf-8">
|
`}" method="${2:get}" accept-charset="utf-8">
|
||||||
|
@ -182,7 +188,7 @@ snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||||
</form>
|
</form>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet h1 "XHTML <h1>"
|
snippet h1 "XHTML <h1>" w
|
||||||
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
|
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -194,71 +200,70 @@ snippet head "XHTML <head>"
|
||||||
</head>
|
</head>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet link "XHTML <link>"
|
snippet link "XHTML <link>" w
|
||||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
|
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet meta "XHTML <meta>"
|
snippet meta "XHTML <meta>" w
|
||||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet scriptsrc "XHTML <script src...>"
|
snippet scriptsrc "XHTML <script src...>" w
|
||||||
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
|
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet script "XHTML <script>"
|
snippet script "XHTML <script>" w
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$0
|
$0
|
||||||
</script>
|
</script>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet style "XHTML <style>"
|
snippet style "XHTML <style>" w
|
||||||
<style type="text/css" media="screen">
|
<style type="text/css" media="screen">
|
||||||
$0
|
$0
|
||||||
</style>
|
</style>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet table "XHTML <table>"
|
snippet table "XHTML <table>" w
|
||||||
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
|
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
|
||||||
<tr><th>${5:Header}</th></tr>
|
<tr><th>${5:Header}</th></tr>
|
||||||
<tr><td>${0:Data}</td></tr>
|
<tr><td>${0:Data}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet a "Link"
|
snippet a "Link" w
|
||||||
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
|
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet p "paragraph"
|
snippet p "paragraph" w
|
||||||
<p>$0</p>
|
<p>$0</p>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet li "list item"
|
snippet li "list item" w
|
||||||
<li></li>
|
<li>$0</li>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ul "unordered list"
|
snippet ul "unordered list" w
|
||||||
<ul>
|
<ul>
|
||||||
$0
|
$0
|
||||||
</ul>
|
</ul>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet td "table cell"
|
snippet td "table cell" w
|
||||||
<td>$0</td>
|
<td>$0</td>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet tr "table row"
|
snippet tr "table row" w
|
||||||
<tr>$0</tr>
|
<tr>$0</tr>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet title "XHTML <title>"
|
snippet title "XHTML <title>" w
|
||||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fieldset "Fieldset"
|
snippet fieldset "Fieldset" w
|
||||||
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
|
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
|
||||||
<legend>$1</legend>
|
<legend>$1</legend>
|
||||||
|
|
||||||
$0
|
$0
|
||||||
</fieldset>
|
</fieldset>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -282,7 +287,7 @@ snippet html5 "HTML5 Template"
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>${1}</title>
|
<title>${1}</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# more can be found in snippets/html_minimal.snippets
|
# more can be found in snippets/html_minimal.snippets
|
||||||
# these UltiSnips override snippets because nested placeholders are being used
|
# these UltiSnips override snippets because nested placeholders are being used
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet id
|
snippet id
|
||||||
id="${1}"${2}
|
id="${1}"${2}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
extends html, django
|
extends html, django
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
extends html, jinja2
|
|
@ -1,27 +1,75 @@
|
||||||
###########################################################################
|
priority -50
|
||||||
# TEXTMATE SNIPPETS #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
# Many of the snippets here use a global option called
|
# Many of the snippets here use a global option called
|
||||||
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
|
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
|
||||||
# before '{' braces.
|
# before '{' braces.
|
||||||
|
# Setting "g:ultisnips_java_junit" will change how the test method snippet
|
||||||
|
# looks, it is defaulted to junit4, setting this option to 3 will remove the
|
||||||
|
# @Test annotation from the method
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
|
def junit(snip):
|
||||||
|
if snip.opt("g:ultisnips_java_junit", "") == "3":
|
||||||
|
snip += ""
|
||||||
|
else:
|
||||||
|
snip.rv += "@Test\n\t"
|
||||||
|
|
||||||
def nl(snip):
|
def nl(snip):
|
||||||
if snip.opt("g:ultisnips_java_brace_style", "") == "nl":
|
if snip.opt("g:ultisnips_java_brace_style", "") == "nl":
|
||||||
snip += ""
|
snip += ""
|
||||||
else:
|
else:
|
||||||
snip.rv += " "
|
snip.rv += " "
|
||||||
|
def getArgs(group):
|
||||||
|
import re
|
||||||
|
word = re.compile('[a-zA-Z><.]+ \w+')
|
||||||
|
return [i.split(" ") for i in word.findall(group) ]
|
||||||
|
|
||||||
|
def camel(word):
|
||||||
|
return word[0].upper() + word[1:]
|
||||||
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
|
snippet sleep "try sleep catch" b
|
||||||
|
try {
|
||||||
|
Thread.sleep(${1:1000});
|
||||||
|
} catch (InterruptedException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet /i|n/ "new primitive or int" br
|
||||||
|
${1:int} ${2:i} = ${3:1};
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet /o|v/ "new Object or variable" br
|
||||||
|
${1:Object} ${2:var} = new $1(${3});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet f "field" b
|
||||||
|
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet ab "abstract" b
|
snippet ab "abstract" b
|
||||||
abstract
|
abstract $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet as "assert" b
|
snippet as "assert" b
|
||||||
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0
|
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet at "assert true" b
|
||||||
|
assertTrue(${1:actual});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet af "assert false" b
|
||||||
|
assertFalse(${1:actual});$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ae "assert equals" b
|
||||||
|
assertEquals(${1:expected}, ${2:actual});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet br "break"
|
snippet br "break"
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -39,19 +87,85 @@ catch (${1:Exception} ${2:e})`!p nl(snip)`{
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cl "class" b
|
snippet cle "class extends" b
|
||||||
class ${1:`!p
|
public class ${1:`!p
|
||||||
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
|
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet clc "class with constructor, fields, setter and getters" b
|
||||||
|
public class `!p
|
||||||
|
snip.rv = snip.basename or "untitled"` {
|
||||||
|
`!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
if len(args) == 0: snip.rv = ""
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||||
|
if len(args) > 0:
|
||||||
|
snip.rv += "\n"`
|
||||||
|
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";"
|
||||||
|
if len(args) == 0:
|
||||||
|
snip.rv += "\n"`
|
||||||
|
}$0
|
||||||
|
`!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
if len(args) == 0: snip.rv = ""
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
|
||||||
|
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
|
||||||
|
|
||||||
|
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\
|
||||||
|
\n\t\treturn " + i[1] + ";\n\t}\n"
|
||||||
|
`
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet clc "class with constructor, with field names" b
|
||||||
|
public class `!p
|
||||||
|
snip.rv = snip.basename or "untitled"` {
|
||||||
|
`!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||||
|
if len(args) > 0:
|
||||||
|
snip.rv += "\n"`
|
||||||
|
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1]
|
||||||
|
if len(args) == 0:
|
||||||
|
snip.rv += "\n"`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet clc "class and constructor" b
|
||||||
|
public class `!p
|
||||||
|
snip.rv = snip.basename or "untitled"` {
|
||||||
|
|
||||||
|
public `!p snip.rv = snip.basename or "untitled"`($2) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cl "class" b
|
||||||
|
public class ${1:`!p
|
||||||
|
snip.rv = snip.basename or "untitled"`} {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet cos "constant string" b
|
snippet cos "constant string" b
|
||||||
static public final String ${1:var} = "$2";$0
|
public static final String ${1:var} = "$2";$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet co "constant" b
|
snippet co "constant" b
|
||||||
static public final ${1:String} ${2:var} = $3;$0
|
public static final ${1:String} ${2:var} = $3;$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet de "default" b
|
snippet de "default" b
|
||||||
|
@ -59,7 +173,7 @@ default:
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet eif "else if" b
|
snippet elif "else if" b
|
||||||
else if ($1)`!p nl(snip)`{
|
else if ($1)`!p nl(snip)`{
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
|
@ -72,7 +186,7 @@ else`!p nl(snip)`{
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fi "final" b
|
snippet fi "final" b
|
||||||
final
|
final $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fore "for (each)" b
|
snippet fore "for (each)" b
|
||||||
|
@ -81,6 +195,12 @@ for ($1 : $2)`!p nl(snip)`{
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet fori "for" b
|
||||||
|
for (int ${1:i} = 0; $1 < ${2:10}; $1++)`!p nl(snip)`{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet for "for" b
|
snippet for "for" b
|
||||||
for ($1; $2; $3)`!p nl(snip)`{
|
for ($1; $2; $3)`!p nl(snip)`{
|
||||||
$0
|
$0
|
||||||
|
@ -99,7 +219,7 @@ $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet im "import" b
|
snippet im "import" b
|
||||||
import
|
import ${1:java}.${2:util}.$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet in "interface" b
|
snippet in "interface" b
|
||||||
|
@ -108,6 +228,48 @@ interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet cc "constructor call or setter body"
|
||||||
|
this.${1:var} = $1;
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet list "Collections List" b
|
||||||
|
List<${1:String}> ${2:list} = new ${3:Array}List<$1>();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet map "Collections Map" b
|
||||||
|
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet set "Collections Set" b
|
||||||
|
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet /Str?|str/ "String" br
|
||||||
|
String $0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cn "Constructor" b
|
||||||
|
public `!p snip.rv = snip.basename or "untitled"`(${1:}) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cn "constructor, \w fields + assigments" b
|
||||||
|
`!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||||
|
if len(args) > 0:
|
||||||
|
snip.rv += "\n"`
|
||||||
|
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
|
||||||
|
args = getArgs(t[1])
|
||||||
|
for i in args:
|
||||||
|
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1]
|
||||||
|
if len(args) == 0:
|
||||||
|
snip.rv += "\n"`
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet j.b "java_beans_" i
|
snippet j.b "java_beans_" i
|
||||||
java.beans.
|
java.beans.
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -134,15 +296,70 @@ public static void main(String[] args)`!p nl(snip)`{
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet m "method" b
|
snippet try "try/catch" b
|
||||||
${1:void} ${2:method}($3) ${4:throws $5 }{
|
try {
|
||||||
|
$1
|
||||||
|
} catch(${2:Exception} ${3:e}){
|
||||||
|
${4:e.printStackTrace();}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mt "method throws" b
|
||||||
|
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet m "method" b
|
||||||
|
${1:private} ${2:void} ${3:method}(${4}) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet md "Method With javadoc" b
|
||||||
|
/**
|
||||||
|
* ${7:Short Description}`!p
|
||||||
|
for i in getArgs(t[4]):
|
||||||
|
snip.rv += "\n\t * @param " + i[1] + " usage..."`
|
||||||
|
* `!p
|
||||||
|
if "throws" in t[5]:
|
||||||
|
snip.rv = "\n\t * @throws " + t[6]
|
||||||
|
else:
|
||||||
|
snip.rv = ""` `!p
|
||||||
|
if not "void" in t[2]:
|
||||||
|
snip.rv = "\n\t * @return object"
|
||||||
|
else:
|
||||||
|
snip.rv = ""`
|
||||||
|
**/
|
||||||
|
${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet /get(ter)?/ "getter" br
|
||||||
|
public ${1:String} get${2:Name}() {
|
||||||
|
return `!p snip.rv = t[2].lower()`;
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet /set(ter)?/ "setter" br
|
||||||
|
public void set${1:Name}(${2:String} $1) {
|
||||||
|
return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
||||||
|
public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) {
|
||||||
|
this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public $2 get$1() {
|
||||||
|
return `!p snip.rv = t[1].lower()`;
|
||||||
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pa "package" b
|
snippet pa "package" b
|
||||||
package
|
package $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet p "print" b
|
snippet p "print" b
|
||||||
|
@ -154,33 +371,33 @@ System.out.println($1);$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pr "private" b
|
snippet pr "private" b
|
||||||
private
|
private $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet po "protected" b
|
snippet po "protected" b
|
||||||
protected
|
protected $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pu "public" b
|
snippet pu "public" b
|
||||||
public
|
public $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet re "return" b
|
snippet re "return" b
|
||||||
return
|
return $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet st "static"
|
snippet st "static"
|
||||||
static
|
static $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sw "switch" b
|
snippet sw "switch" b
|
||||||
switch ($1)`!p nl(snip)`{
|
switch ($1)`!p nl(snip)`{
|
||||||
$0
|
case $2: $0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sy "synchronized"
|
snippet sy "synchronized"
|
||||||
synchronized
|
synchronized $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet tc "test case"
|
snippet tc "test case"
|
||||||
|
@ -190,17 +407,19 @@ public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCas
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet t "test" b
|
snippet t "test" b
|
||||||
public void test${1:Name}() throws Exception`!p nl(snip)`{
|
`!p junit(snip)`public void test${1:Name}() {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet tt "test throws" b
|
||||||
|
`!p junit(snip)`public void test${1:Name}() ${2:throws Exception }{
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet th "throw" b
|
snippet th "throw" b
|
||||||
throw $0
|
throw new $0
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet v "variable" b
|
|
||||||
${1:String} ${2:var}${3: = ${0:null}};
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wh "while" b
|
snippet wh "while" b
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -6,19 +8,19 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet '':f "object method string"
|
snippet '':f "object method string"
|
||||||
'${1:${2:#thing}:${3:click}}': function(element){
|
'${1:${2:#thing}:${3:click}}': function(element) {
|
||||||
$0
|
${VISUAL}$0
|
||||||
}${10:,}
|
}${10:,}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet :f "Object Method"
|
snippet :f "Object Method"
|
||||||
${1:method_name}: function(${3:attribute}){
|
${1:method_name}: function(${3:attribute}) {
|
||||||
$0
|
${VISUAL}$0
|
||||||
}${10:,}
|
}${10:,}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet :, "Object Value JS"
|
snippet :, "Object Value JS"
|
||||||
${1:value_name}:${0:value},
|
${1:value_name}: ${0:value},
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet : "Object key key: 'value'"
|
snippet : "Object key key: 'value'"
|
||||||
|
@ -26,47 +28,135 @@ ${1:key}: ${2:"${3:value}"}${4:, }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet proto "Prototype (proto)"
|
snippet proto "Prototype (proto)"
|
||||||
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{
|
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
||||||
${0}
|
${VISUAL}$0
|
||||||
}
|
};
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for "for (...) {...} (faster)"
|
snippet for "for (...) {...} (counting up)" b
|
||||||
for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){
|
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
|
||||||
${3:$1[$2]}$0
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for "for (...) {...}"
|
snippet ford "for (...) {...} (counting down, faster)" b
|
||||||
for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) {
|
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
|
||||||
${3:$1[$2]}$0
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fun "function (fun)"
|
snippet fun "function (fun)"
|
||||||
function ${1:function_name} (${2:argument}) {
|
function ${1:function_name}(${2:argument}) {
|
||||||
${0}
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# for one line if .. else you usually use a ? b : c
|
snippet iife "Immediately-Invoked Function Expression (iife)"
|
||||||
|
(function (${1:argument}) {
|
||||||
|
${VISUAL}$0
|
||||||
|
}(${2:$1}));
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet ife "if ___ else"
|
snippet ife "if ___ else"
|
||||||
if (${1}) {
|
if (${1:condition}) {
|
||||||
${2}
|
${2://code}
|
||||||
} else {
|
}
|
||||||
${3}
|
else {
|
||||||
|
${3://code}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "if"
|
snippet if "if"
|
||||||
if (${1}) {
|
if (${1:condition}) {
|
||||||
${2}
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet timeout "setTimeout function"
|
snippet timeout "setTimeout function"
|
||||||
setTimeout(function() {$0}${2:}, ${1:10})
|
setTimeout(function() {
|
||||||
|
${VISUAL}$0
|
||||||
|
}${2:.bind(${3:this})}, ${1:10});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# Snippets for Console Debug Output
|
||||||
|
|
||||||
|
snippet ca "console.assert" b
|
||||||
|
console.assert(${1:assertion}, ${2:"${3:message}"});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cclear "console.clear" b
|
||||||
|
console.clear();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cdir "console.dir" b
|
||||||
|
console.dir(${1:object});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cdirx "console.dirxml" b
|
||||||
|
console.dirxml(${1:object});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ce "console.error" b
|
||||||
|
console.error(${1:"${2:value}"});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cgroup "console.group" b
|
||||||
|
console.group("${1:label}");
|
||||||
|
${VISUAL}$0
|
||||||
|
console.groupEnd();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cgroupc "console.groupCollapsed" b
|
||||||
|
console.groupCollapsed("${1:label}");
|
||||||
|
${VISUAL}$0
|
||||||
|
console.groupEnd();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ci "console.info" b
|
||||||
|
console.info(${1:"${2:value}"});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cl "console.log" b
|
||||||
|
console.log(${1:"${2:value}"});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cprof "console.profile" b
|
||||||
|
console.profile("${1:label}");
|
||||||
|
${VISUAL}$0
|
||||||
|
console.profileEnd();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ctable "console.table" b
|
||||||
|
console.table(${1:"${2:value}"});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ctime "console.time" b
|
||||||
|
console.time("${1:label}");
|
||||||
|
${VISUAL}$0
|
||||||
|
console.timeEnd("$1");
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ctimestamp "console.timeStamp" b
|
||||||
|
console.timeStamp("${1:label}");
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ctrace "console.trace" b
|
||||||
|
console.trace();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cw "console.warn" b
|
||||||
|
console.warn(${1:"${2:value}"});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# AMD (Asynchronous Module Definition) snippets
|
||||||
|
|
||||||
|
snippet def "define an AMD module"
|
||||||
|
define(${1:optional_name, }[${2:'jquery'}], ${3:callback});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet req "require an AMD module"
|
||||||
|
require([${1:'dependencies'}], ${2:callback});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Ember snippets #
|
# Ember snippets #
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
# Application
|
# Application
|
||||||
snippet eapp "App.Name = Ember.Application.create({});"
|
snippet eapp "App.Name = Ember.Application.create({});"
|
||||||
${1:App.Name} = Ember.Application.create({});
|
${1:App.Name} = Ember.Application.create({});
|
||||||
|
@ -10,48 +12,48 @@ endsnippet
|
||||||
# Models
|
# Models
|
||||||
snippet emod "App.ModelName = Ember.Model.extend({...});"
|
snippet emod "App.ModelName = Ember.Model.extend({...});"
|
||||||
${1:model_name} = Ember.Model.extend({
|
${1:model_name} = Ember.Model.extend({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# View
|
# View
|
||||||
snippet eview "App.ViewName = Ember.Model.extend({...});"
|
snippet eview "App.ViewName = Ember.Model.extend({...});"
|
||||||
${1:view_name} = Ember.View.extend({
|
${1:view_name} = Ember.View.extend({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Controller
|
# Controller
|
||||||
snippet econtroller "App.ControllerName = Ember.Model.extend({...});"
|
snippet econtroller "App.ControllerName = Ember.Model.extend({...});"
|
||||||
${1:controller_name} = Ember.ObjectController.extend({
|
${1:controller_name} = Ember.ObjectController.extend({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Route
|
# Route
|
||||||
snippet eroute "App.RouteName = Ember.Route.extend({...});"
|
snippet eroute "App.RouteName = Ember.Route.extend({...});"
|
||||||
${1:route_name} = Ember.Route.extend({
|
${1:route_name} = Ember.Route.extend({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet eview "App.ViewName = Ember.Model.create({...});"
|
snippet eview "App.ViewName = Ember.Model.create({...});"
|
||||||
${1:view_name} = Ember.View.create({
|
${1:view_name} = Ember.View.create({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Object
|
# Object
|
||||||
snippet eobj "App.ObjectName = Ember.Object.extend({...});"
|
snippet eobj "App.ObjectName = Ember.Object.extend({...});"
|
||||||
${1:object_name} = Ember.Object.create({
|
${1:object_name} = Ember.Object.create({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Mixin
|
# Mixin
|
||||||
snippet emix "App.MixinName = Ember.Model.extend({...});"
|
snippet emix "App.MixinName = Ember.Model.extend({...});"
|
||||||
${1:view_name} = Ember.Mixin.create({
|
${1:view_name} = Ember.Mixin.create({
|
||||||
${0://Properties here...}
|
${0://Properties here...}
|
||||||
});
|
});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -67,13 +69,13 @@ endsnippet
|
||||||
# Computer properties
|
# Computer properties
|
||||||
snippet cpro "property_name: function() {...}.property(),"
|
snippet cpro "property_name: function() {...}.property(),"
|
||||||
${1:property_name}: function() {
|
${1:property_name}: function() {
|
||||||
${0://body...}
|
${0://body...}
|
||||||
}.property('${3:argumenet}'),
|
}.property('${3:argumenet}'),
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cpro ": function() {...}.property('property'),"
|
snippet cpro ": function() {...}.property('property'),"
|
||||||
${1:property_name}: function() {
|
${1:property_name}: function() {
|
||||||
${0://body...}
|
${0://body...}
|
||||||
}.property(),
|
}.property(),
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ endsnippet
|
||||||
# Observes
|
# Observes
|
||||||
snippet proo "property_name: function() {...}.property()"
|
snippet proo "property_name: function() {...}.property()"
|
||||||
${1:property_name}: function() {
|
${1:property_name}: function() {
|
||||||
${0://body...}
|
${0://body...}
|
||||||
}.observes('${3:property}'),
|
}.observes('${3:property}'),
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#
|
priority -50
|
||||||
|
|
||||||
# JavaScript versions -- from the TextMate bundle + some additions
|
# JavaScript versions -- from the TextMate bundle + some additions
|
||||||
# for jasmine-jquery matchers
|
# for jasmine-jquery matchers
|
||||||
#
|
#
|
||||||
extends javascript
|
|
||||||
|
|
||||||
snippet des "Describe (js)" b
|
snippet des "Describe (js)" b
|
||||||
describe('${1:description}', function() {
|
describe('${1:description}', function() {
|
||||||
|
@ -165,4 +165,3 @@ endsnippet
|
||||||
snippet noscw "expect was not called with (js)" b
|
snippet noscw "expect was not called with (js)" b
|
||||||
expect(${1:target}).wasNotCalledWith(${2:arguments});
|
expect(${1:target}).wasNotCalledWith(${2:arguments});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
# JSDoc snippets
|
||||||
|
|
||||||
|
snippet /* "A JSDoc comment" b
|
||||||
|
/**
|
||||||
|
* ${1:${VISUAL}}$0
|
||||||
|
*/
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @au "@author email (First Last)"
|
||||||
|
@author ${1:`!v g:snips_author_email`} (${2:`!v g:snips_author`})
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @li "@license Description"
|
||||||
|
@license ${1:MIT}$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @ver "@version Semantic version"
|
||||||
|
@version ${1:0.1.0}$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @fileo "@fileoverview Description" b
|
||||||
|
/**
|
||||||
|
* @fileoverview ${1:${VISUAL:A description of the file}}$0
|
||||||
|
*/
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @constr "@constructor"
|
||||||
|
@constructor
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @p "@param {Type} varname Description"
|
||||||
|
@param {${1:Type}} ${2:varname} ${3:Description}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @ret "@return {Type} Description"
|
||||||
|
@return {${1:Type}} ${2:Description}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @pri "@private"
|
||||||
|
@private
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @over "@override"
|
||||||
|
@override
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet @pro "@protected"
|
||||||
|
@protected
|
||||||
|
endsnippet
|
|
@ -1,3 +1,4 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
# http://jinja.pocoo.org/
|
# http://jinja.pocoo.org/
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
|
|
||||||
snippet block "block" b
|
snippet block "block" b
|
||||||
{% block ${1:name} %}
|
{% block ${1:name} %}
|
||||||
$2
|
$2
|
||||||
{% endblock $1 %}
|
{% endblock $1 %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ endsnippet
|
||||||
|
|
||||||
snippet raw "escaped block" b
|
snippet raw "escaped block" b
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$1
|
$1
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ endsnippet
|
||||||
|
|
||||||
snippet filter "filter" b
|
snippet filter "filter" b
|
||||||
{% filter ${1:filter} %}
|
{% filter ${1:filter} %}
|
||||||
$2
|
$2
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -78,57 +79,57 @@ endsnippet
|
||||||
|
|
||||||
snippet for "for" b
|
snippet for "for" b
|
||||||
{% for ${1:item} in ${2:sequence} %}
|
{% for ${1:item} in ${2:sequence} %}
|
||||||
$3
|
$3
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet for "for/else" b
|
snippet for "for/else" b
|
||||||
{% for ${1:item} in ${2:sequence} %}
|
{% for ${1:item} in ${2:sequence} %}
|
||||||
$3
|
$3
|
||||||
{% else %}
|
{% else %}
|
||||||
$4
|
$4
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet if "if" b
|
snippet if "if" b
|
||||||
{% if ${1:expr} %}
|
{% if ${1:expr} %}
|
||||||
$2
|
$2
|
||||||
{% endif %}
|
{% endif %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet if "if/else" b
|
snippet if "if/else" b
|
||||||
{% if ${1:expr} %}
|
{% if ${1:expr} %}
|
||||||
$2
|
$2
|
||||||
{% else %}
|
{% else %}
|
||||||
$3
|
$3
|
||||||
{% endif %}
|
{% endif %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet if "if/elif/else" b
|
snippet if "if/elif/else" b
|
||||||
{% if ${1:expr} %}
|
{% if ${1:expr} %}
|
||||||
$2
|
$2
|
||||||
{% elif %}
|
{% elif %}
|
||||||
$3
|
$3
|
||||||
{% else %}
|
{% else %}
|
||||||
$4
|
$4
|
||||||
{% endif %}
|
{% endif %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet macro "macro" b
|
snippet macro "macro" b
|
||||||
{% macro ${1:name}(${2:args}) %}
|
{% macro ${1:name}(${2:args}) %}
|
||||||
$3
|
$3
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet call "call" b
|
snippet call "call" b
|
||||||
{% call ${1:name}(${2:args}) %}
|
{% call ${1:name}(${2:args}) %}
|
||||||
$3
|
$3
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -140,21 +141,20 @@ endsnippet
|
||||||
|
|
||||||
snippet trans "translation" b
|
snippet trans "translation" b
|
||||||
{% trans %}
|
{% trans %}
|
||||||
$1
|
$1
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet with "with" b
|
snippet with "with" b
|
||||||
{% with %}
|
{% with %}
|
||||||
$1
|
$1
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet autoescape "autoescape" b
|
snippet autoescape "autoescape" b
|
||||||
{% autoescape ${1:true} %}
|
{% autoescape ${1:true} %}
|
||||||
$2
|
$2
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet s "String" b
|
snippet s "String" b
|
||||||
"${1:key}": "${0:value}",
|
"${1:key}": "${0:value}",
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -8,12 +10,11 @@ endsnippet
|
||||||
|
|
||||||
snippet a "Array" b
|
snippet a "Array" b
|
||||||
[
|
[
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
],
|
],
|
||||||
endsnippet
|
endsnippet
|
||||||
snippet o "Object" b
|
snippet o "Object" b
|
||||||
{
|
{
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
},
|
},
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
snippet t "Transaction" b
|
||||||
|
${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee}
|
||||||
|
${6:Expenses} \$${7:0.00}
|
||||||
|
${8:Assets:Checking}
|
||||||
|
$0
|
||||||
|
endsnippet
|
|
@ -0,0 +1,3 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
extends haskell
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Snippets for the Lua language #
|
# Snippets for the Lua language #
|
||||||
#################################
|
#################################
|
||||||
|
@ -8,25 +10,25 @@ endsnippet
|
||||||
|
|
||||||
snippet !fun(ction)?! "New function" br
|
snippet !fun(ction)?! "New function" br
|
||||||
function ${1:new_function}(${2:args})
|
function ${1:new_function}(${2:args})
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forp "pair for loop" b
|
snippet forp "pair for loop" b
|
||||||
for ${1:name},${2:val} in pairs(${3:table_name}) do
|
for ${1:name},${2:val} in pairs(${3:table_name}) do
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fori "ipair for foop" b
|
snippet fori "ipair for foop" b
|
||||||
for ${1:idx},${2:val} in ipairs(${3:table_name}) do
|
for ${1:idx},${2:val} in ipairs(${3:table_name}) do
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for "numeric for loop" b
|
snippet for "numeric for loop" b
|
||||||
for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do
|
for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# From snipmate #
|
# From snipmate #
|
||||||
#################
|
#################
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
###########################################################################
|
priority -50
|
||||||
# SNIPPETS for MARKDOWN #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Sections and Paragraphs #
|
# Sections and Paragraphs #
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -13,9 +15,9 @@ endsnippet
|
||||||
snippet cl "020 Class (objc)"
|
snippet cl "020 Class (objc)"
|
||||||
@interface ${1:`!p
|
@interface ${1:`!p
|
||||||
if len(fn):
|
if len(fn):
|
||||||
snip.rv = re.sub(r'\..*$', '', fn)
|
snip.rv = re.sub(r'\..*$', '', fn)
|
||||||
else:
|
else:
|
||||||
snip.rv = "object"
|
snip.rv = "object"
|
||||||
`} : ${2:NSObject}
|
`} : ${2:NSObject}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -189,7 +191,7 @@ if(choice == NSAlertDefaultReturn) // "$3"
|
||||||
}
|
}
|
||||||
else if(choice == NSAlertAlternateReturn) // "$4"
|
else if(choice == NSAlertAlternateReturn) // "$4"
|
||||||
{
|
{
|
||||||
|
$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -217,7 +219,7 @@ endsnippet
|
||||||
snippet responds "Responds to Selector"
|
snippet responds "Responds to Selector"
|
||||||
if ([${1:self} respondsToSelector:@selector(${2:someSelector:})])
|
if ([${1:self} respondsToSelector:@selector(${2:someSelector:})])
|
||||||
{
|
{
|
||||||
[$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}];
|
[$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}];
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet rs "raise" b
|
snippet rs "raise" b
|
||||||
raise (${1:Not_found})
|
raise (${1:Not_found})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet open "open"
|
snippet open "open"
|
||||||
let open ${1:module} in
|
let open ${1:module} in
|
||||||
${2}
|
${2:e}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet try "try"
|
snippet try "try"
|
||||||
try ${1}
|
try ${1:e}
|
||||||
with ${2:Not_found} -> ${3:()}
|
with ${2:Not_found} -> ${3:()}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ref "ref"
|
snippet ref "ref"
|
||||||
let ${1} = ref ${2} in
|
let ${1:name} = ref ${2:val} in
|
||||||
${3}
|
${3:e}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet matchl "pattern match on a list"
|
snippet matchl "pattern match on a list"
|
||||||
|
@ -24,83 +26,88 @@ match ${1:list} with
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet matcho "pattern match on an option type"
|
snippet matcho "pattern match on an option type"
|
||||||
match ${1} with
|
match ${1:x} with
|
||||||
| Some(${2}) -> ${3:()}
|
| Some(${2:y}) -> ${3:()}
|
||||||
| None -> ${4:()}
|
| None -> ${4:()}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fun "anonymous function"
|
snippet fun "anonymous function"
|
||||||
(fun ${1} -> ${2})
|
(fun ${1:x} -> ${2:x})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cc "commment"
|
snippet cc "commment"
|
||||||
(* ${1} *)
|
(* ${1:comment} *)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet let "let .. in binding"
|
snippet let "let .. in binding"
|
||||||
let ${1} = ${2} in
|
let ${1:x} = ${2:v} in
|
||||||
${3}
|
${3:e}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet lr "let rec"
|
snippet lr "let rec"
|
||||||
let rec ${1} =
|
let rec ${1:f} =
|
||||||
${2}
|
${2:expr}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ife "if"
|
snippet if "if"
|
||||||
if ${1} then
|
if ${1:(* condition *)} then
|
||||||
${2}
|
${2:(* A *)}
|
||||||
else
|
else
|
||||||
${3}
|
${3:(* B *)}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "If"
|
snippet If "If"
|
||||||
if ${1} then
|
if ${1:(* condition *)} then
|
||||||
${2}
|
${2:(* A *)}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wh "while"
|
snippet while "while"
|
||||||
while ${1} do
|
while ${1:(* condition *)} do
|
||||||
${2}
|
${2:(* A *)}
|
||||||
done
|
done
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for "for"
|
snippet for "for"
|
||||||
for ${1:i} = ${2:1} to ${3:10} do
|
for ${1:i} = ${2:1} to ${3:10} do
|
||||||
${4}
|
${4:(* BODY *)}
|
||||||
done
|
done
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet match "match"
|
snippet match "match"
|
||||||
match ${1} with
|
match ${1:(* e1 *)} with
|
||||||
| ${2} -> ${3}
|
| ${2:p} -> ${3:e2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet Match "match"
|
||||||
|
match ${1:(* e1 *)} with
|
||||||
|
| ${2:p} -> ${3:e2}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet class "class"
|
snippet class "class"
|
||||||
class ${1:name} = object
|
class ${1:name} = object
|
||||||
${2}
|
${2:methods}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet obj "obj"
|
snippet obj "obj"
|
||||||
object
|
object
|
||||||
${2}
|
${2:methods}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet Obj "object"
|
snippet Obj "object"
|
||||||
object (self)
|
object (self)
|
||||||
${2}
|
${2:methods}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet {{ "object functional update"
|
snippet {{ "object functional update"
|
||||||
{< ${1} = ${2} >}
|
{< ${1:x} = ${2:y} >}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet beg "beg"
|
snippet beg "beg"
|
||||||
begin
|
begin
|
||||||
${1}${VISUAL}
|
${1:block}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -110,19 +117,19 @@ endsnippet
|
||||||
|
|
||||||
snippet mod "module - no signature"
|
snippet mod "module - no signature"
|
||||||
module ${1:(* Name *)} = struct
|
module ${1:(* Name *)} = struct
|
||||||
${2}
|
${2:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet Mod "module with signature"
|
snippet Mod "module with signature"
|
||||||
module ${1:(* Name *)} : ${2:(* SIG *)} = struct
|
module ${1:(* Name *)} : ${2:(* SIG *)} = struct
|
||||||
${3}
|
${3:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sig "anonymous signature"
|
snippet sig "anonymous signature"
|
||||||
sig
|
sig
|
||||||
${2}
|
${2:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -132,36 +139,36 @@ endsnippet
|
||||||
|
|
||||||
snippet func "define functor - no signature"
|
snippet func "define functor - no signature"
|
||||||
module ${1:M} (${2:Arg} : ${3:ARG}) = struct
|
module ${1:M} (${2:Arg} : ${3:ARG}) = struct
|
||||||
${4}
|
${4:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet Func "define functor - with signature"
|
snippet Func "define functor - with signature"
|
||||||
module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct
|
module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct
|
||||||
${5}
|
${5:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet mot "Declare module signature"
|
snippet mot "Declare module signature"
|
||||||
module type ${1:(* Name *)} = sig
|
module type ${1:(* Name *)} = sig
|
||||||
${2}
|
${2:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet module "Module with anonymous signature"
|
snippet module "Module with anonymous signature"
|
||||||
module ${1:(* Name *)} : sig
|
module ${1:(* Name *)} : sig
|
||||||
${2}
|
${2:(* SIGNATURE *)}
|
||||||
end = struct
|
end = struct
|
||||||
${3}
|
${3:(* BODY *)}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet oo "odoc"
|
snippet oo "odoc"
|
||||||
(** ${1} *)
|
(** ${1:odoc} *)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet qt "inline qtest"
|
snippet qt "inline qtest"
|
||||||
(*$T ${1:name}
|
(*$T ${1:name}
|
||||||
${2:test}
|
${2:test}
|
||||||
*)
|
*)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
snippet ife "Conditional if..else (ife)"
|
snippet ife "Conditional if..else (ife)"
|
||||||
if ($1) {
|
if ($1) {
|
||||||
${2:# body...}
|
${2:# body...}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
${3:# else...}
|
${3:# else...}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +16,11 @@ endsnippet
|
||||||
snippet ifee "Conditional if..elsif..else (ifee)"
|
snippet ifee "Conditional if..elsif..else (ifee)"
|
||||||
if ($1) {
|
if ($1) {
|
||||||
${2:# body...}
|
${2:# body...}
|
||||||
} elsif ($3) {
|
}
|
||||||
|
elsif ($3) {
|
||||||
${4:# elsif...}
|
${4:# elsif...}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
${5:# else...}
|
${5:# else...}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +54,7 @@ ${1:expression} while ${2:condition};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet test "Test"
|
snippet test "Test"
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/env perl -w
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Test::More tests => ${1:1};
|
use Test::More tests => ${1:1};
|
||||||
|
@ -62,7 +67,7 @@ endsnippet
|
||||||
snippet class "class"
|
snippet class "class"
|
||||||
package ${1:ClassName};
|
package ${1:ClassName};
|
||||||
|
|
||||||
${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
|
${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
$class = ref $class if ref $class;
|
$class = ref $class if ref $class;
|
||||||
my $self = bless {}, $class;
|
my $self = bless {}, $class;
|
||||||
|
@ -74,11 +79,12 @@ ${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet eval "eval"
|
snippet eval "eval"
|
||||||
|
local $@;
|
||||||
eval {
|
eval {
|
||||||
${1:# do something risky...}
|
${1:# do something risky...}
|
||||||
};
|
};
|
||||||
if ($@) {
|
if (my $${2:exception} = $@) {
|
||||||
${2:# handle failure...}
|
${3:# handle failure...}
|
||||||
}
|
}
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -105,8 +111,7 @@ if ($1) {
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet slurp "slurp"
|
snippet slurp "slurp"
|
||||||
my $${1:var};
|
my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> };
|
||||||
{ local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = <FILE>; close FILE }
|
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -117,7 +122,7 @@ unless ($1) {
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wh "while"
|
snippet while "while"
|
||||||
while ($1) {
|
while ($1) {
|
||||||
${2:# body...}
|
${2:# body...}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,108 +1,264 @@
|
||||||
snippet <? "php open tag" b
|
priority -50
|
||||||
<?php
|
|
||||||
|
|
||||||
|
## Snippets from SnipMate, taken from
|
||||||
|
## https://github.com/scrooloose/snipmate-snippets.git
|
||||||
|
|
||||||
|
snippet array "array"
|
||||||
|
$${1:arrayName} = array('${2}' => ${3});${4}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet vdd "php var_dump and die"
|
snippet def "def"
|
||||||
var_dump(${1}); die();
|
define('${1}'${2});${3}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ns "php namespace" b
|
snippet do "do"
|
||||||
namespace ${1:`!p
|
do {
|
||||||
abspath = os.path.abspath(path)
|
${2:// code... }
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
} while (${1:/* condition */});"
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`};
|
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet nc "php namespace and class or interface" b
|
snippet doc_f "doc_f"
|
||||||
namespace ${1:`!p
|
|
||||||
abspath = os.path.abspath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${3:@author `whoami`}${4}
|
* $2
|
||||||
*/
|
* @return ${4:void}
|
||||||
`!p
|
* @author ${5:`!v g:snips_author`}
|
||||||
m = re.search(r'Abstract', path)
|
**/
|
||||||
if m:
|
${1:public }function ${2:someFunc}(${3})
|
||||||
snip.rv = 'abstract '
|
{${6}
|
||||||
``!p
|
|
||||||
if re.search(r'Interface', path):
|
|
||||||
snip.rv = 'interface'
|
|
||||||
elif re.search(r'Trait', path):
|
|
||||||
snip.rv = 'trait'
|
|
||||||
else:
|
|
||||||
snip.rv = 'class'
|
|
||||||
` ${2:`!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
`}
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet st "php static function" b
|
snippet doc_i "doc_i"
|
||||||
${1:public} static function $2($3)
|
|
||||||
{
|
|
||||||
${4}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet __ "php constructor" b
|
|
||||||
${1:public} function __construct($2)
|
|
||||||
{
|
|
||||||
${3}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sg "Setter and Getter" b
|
|
||||||
/**
|
/**
|
||||||
* @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`}
|
* $1
|
||||||
*
|
* @package ${2:default}
|
||||||
* ${4}
|
* @author ${3:`!v g:snips_author`}
|
||||||
|
**/
|
||||||
|
interface ${1:someClass}
|
||||||
|
{${4}
|
||||||
|
} // END interface $1"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet else "else"
|
||||||
|
else {
|
||||||
|
${1:// code...}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet for "for"
|
||||||
|
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||||
|
${4:// code...}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet foreachk "foreachk"
|
||||||
|
foreach ($${1:variable} as $${2:key} => $${3:value}){
|
||||||
|
${4:// code...}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet get "get"
|
||||||
|
$_GET['${1}']${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet if "if"
|
||||||
|
if (${1:/* condition */}) {
|
||||||
|
${2:// code...}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet inc "inc"
|
||||||
|
include '${1:file}';${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet log "log"
|
||||||
|
error_log(var_export(${1}, true));${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet post "post"
|
||||||
|
$_POST['${1}']${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet req1 "req1"
|
||||||
|
require_once '${1:file}';${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet session "session"
|
||||||
|
$_SESSION['${1}']${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet t "t"
|
||||||
|
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet var "var"
|
||||||
|
var_export(${1});${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet getter "PHP Class Getter" b
|
||||||
|
/*
|
||||||
|
* Getter for $1
|
||||||
*/
|
*/
|
||||||
${1:protected} $${2};
|
public function get${1/\w+\s*/\u$0/}()
|
||||||
|
|
||||||
public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p
|
|
||||||
if re.match(r'^(\\|[A-Z]).*', t[3]):
|
|
||||||
snip.rv = t[3] + ' '
|
|
||||||
else:
|
|
||||||
snip.rv = ''
|
|
||||||
`$$2)
|
|
||||||
{
|
{
|
||||||
$this->$2 = $$2;
|
return $this->$1;$2
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`()
|
|
||||||
{
|
|
||||||
return $this->$2;
|
|
||||||
}
|
}
|
||||||
|
$4
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "php if" !b
|
snippet setter "PHP Class Setter" b
|
||||||
if (${1}) {
|
/*
|
||||||
${2}
|
* Setter for $1
|
||||||
|
*/
|
||||||
|
public function set${1/\w+\s*/\u$0/}($$1)
|
||||||
|
{
|
||||||
|
$this->$1 = $$1;$3
|
||||||
|
${4:return $this;}
|
||||||
}
|
}
|
||||||
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ife "php ife" !b
|
snippet gs "PHP Class Getter Setter" b
|
||||||
if (${1}) {
|
/*
|
||||||
${2}
|
* Getter for ${1/(\w+)\s*;/$1/}
|
||||||
|
*/
|
||||||
|
public function get${1/(\w+)\s*;/\u$1/}()
|
||||||
|
{
|
||||||
|
return $this->${1/(\w+)\s*;/$1/};$2
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setter for ${1/(\w+)\s*;/$1/}
|
||||||
|
*/
|
||||||
|
public function set${1/(\w+)\s*;/\u$1/}($${1/(\w+)\s*;/$1/})
|
||||||
|
{
|
||||||
|
$this->${1/(\w+)\s*;/$1/} = $${1/(\w+)\s*;/$1/};$3
|
||||||
|
${4:return $this;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pub "Public function" b
|
||||||
|
public function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pro "Protected function" b
|
||||||
|
protected function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pri "Private function" b
|
||||||
|
private function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pubs "Public static function" b
|
||||||
|
public static function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pros "Protected static function" b
|
||||||
|
protected static function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pris "Private static function" b
|
||||||
|
private static function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet fu "Function snip" b
|
||||||
|
function ${1:name}(${2:$param})
|
||||||
|
{
|
||||||
|
${VISUAL}${3:return null;}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet fore "Foreach loop"
|
||||||
|
foreach ($${1:variable} as $${3:value}){
|
||||||
|
${VISUAL}${4}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet new "New class instance" b
|
||||||
|
$$1 = new $1($2);
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ife "if else"
|
||||||
|
if (${1:/* condition */}) {
|
||||||
|
${2:// code...}
|
||||||
} else {
|
} else {
|
||||||
|
${3:// code...}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet class "Class declaration template" b
|
||||||
|
/**
|
||||||
|
* Class ${1:`!p snip.rv=snip.fn.split('.')[0]`}
|
||||||
|
* @author ${2:`!v g:snips_author`}
|
||||||
|
*/
|
||||||
|
class $1
|
||||||
|
{
|
||||||
|
public function ${3:__construct}(${4:$options})
|
||||||
|
{
|
||||||
|
${4:// code}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet construct "__construct()" b
|
||||||
|
/**
|
||||||
|
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
||||||
|
*/
|
||||||
|
public function __construct(${1:$dependencies})
|
||||||
|
{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g}
|
||||||
|
}
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pr "Dumb debug helper in HTML"
|
||||||
|
echo '<pre>' . var_export($1, 1) . '</pre>';$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pc "Dumb debug helper in cli"
|
||||||
|
var_export($1);$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# Symfony 2 based snippets
|
||||||
|
snippet sfa "Symfony 2 Controller action"
|
||||||
|
/**
|
||||||
|
* @Route("/${1:route_name}", name="$1")
|
||||||
|
* @Template()
|
||||||
|
*/
|
||||||
|
public function $1Action($2)
|
||||||
|
{
|
||||||
|
$3
|
||||||
|
return ${4:array();}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /** "php comment block" b
|
# :vim:ft=snippets:
|
||||||
/**
|
|
||||||
* @${1}
|
|
||||||
*/
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# sugguestion? report bugs?
|
# suggestion? report bugs?
|
||||||
# please go to https://github.com/chrisyue/vim-snippets/issues
|
# please go to https://github.com/chrisyue/vim-snippets/issues
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet test "phpunit test class" b
|
snippet test "phpunit test class" b
|
||||||
namespace `!p
|
namespace `!p
|
||||||
abspath = os.path.abspath(path)
|
abspath = os.path.abspath(path)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue