Bladeren bron

fixed vim config

master
mort 9 jaren geleden
bovenliggende
commit
0a6f805e4e
38 gewijzigde bestanden met toevoegingen van 4113 en 2 verwijderingen
  1. 0
    1
      dotfiles/vim/bundle/Vundle.vim
  2. 111
    0
      dotfiles/vim/bundle/Vundle.vim/CONTRIBUTING.md
  3. 7
    0
      dotfiles/vim/bundle/Vundle.vim/LICENSE-MIT.txt
  4. 158
    0
      dotfiles/vim/bundle/Vundle.vim/README.md
  5. 83
    0
      dotfiles/vim/bundle/Vundle.vim/autoload/vundle.vim
  6. 278
    0
      dotfiles/vim/bundle/Vundle.vim/autoload/vundle/config.vim
  7. 534
    0
      dotfiles/vim/bundle/Vundle.vim/autoload/vundle/installer.vim
  8. 257
    0
      dotfiles/vim/bundle/Vundle.vim/autoload/vundle/scripts.vim
  9. 22
    0
      dotfiles/vim/bundle/Vundle.vim/changelog.md
  10. 38
    0
      dotfiles/vim/bundle/Vundle.vim/doc/tags
  11. 397
    0
      dotfiles/vim/bundle/Vundle.vim/doc/vundle.txt
  12. 20
    0
      dotfiles/vim/bundle/Vundle.vim/test/files/test.erl
  13. 8
    0
      dotfiles/vim/bundle/Vundle.vim/test/minirc.vim
  14. 81
    0
      dotfiles/vim/bundle/Vundle.vim/test/vimrc
  15. 0
    1
      dotfiles/vim/bundle/vim-coffee-script
  16. 15
    0
      dotfiles/vim/bundle/vim-coffee-script/Copying.md
  17. 25
    0
      dotfiles/vim/bundle/vim-coffee-script/Makefile
  18. 22
    0
      dotfiles/vim/bundle/vim-coffee-script/News.md
  19. 599
    0
      dotfiles/vim/bundle/vim-coffee-script/Readme.md
  20. 44
    0
      dotfiles/vim/bundle/vim-coffee-script/Thanks.md
  21. 1
    0
      dotfiles/vim/bundle/vim-coffee-script/Todo.md
  22. 33
    0
      dotfiles/vim/bundle/vim-coffee-script/after/indent/html.vim
  23. 13
    0
      dotfiles/vim/bundle/vim-coffee-script/after/syntax/haml.vim
  24. 11
    0
      dotfiles/vim/bundle/vim-coffee-script/after/syntax/html.vim
  25. 54
    0
      dotfiles/vim/bundle/vim-coffee-script/autoload/coffee.vim
  26. 15
    0
      dotfiles/vim/bundle/vim-coffee-script/compiler/cake.vim
  27. 82
    0
      dotfiles/vim/bundle/vim-coffee-script/compiler/coffee.vim
  28. 4
    0
      dotfiles/vim/bundle/vim-coffee-script/doc/coffee-script.txt
  29. 0
    0
      dotfiles/vim/bundle/vim-coffee-script/doc/tags
  30. 17
    0
      dotfiles/vim/bundle/vim-coffee-script/ftdetect/coffee.vim
  31. 405
    0
      dotfiles/vim/bundle/vim-coffee-script/ftplugin/coffee.vim
  32. 428
    0
      dotfiles/vim/bundle/vim-coffee-script/indent/coffee.vim
  33. 221
    0
      dotfiles/vim/bundle/vim-coffee-script/syntax/coffee.vim
  34. 3
    0
      dotfiles/vim/bundle/vim-coffee-script/test/test-interp.coffee
  35. 90
    0
      dotfiles/vim/bundle/vim-coffee-script/test/test-ops.coffee
  36. 27
    0
      dotfiles/vim/bundle/vim-coffee-script/test/test-reserved.coffee
  37. 3
    0
      dotfiles/vim/bundle/vim-coffee-script/test/test.haml
  38. 7
    0
      dotfiles/vim/bundle/vim-coffee-script/test/test.html

+ 0
- 1
dotfiles/vim/bundle/Vundle.vim

@@ -1 +0,0 @@
Subproject commit 0b28e334e65b6628b0a61c412fcb45204a2f2bab

+ 111
- 0
dotfiles/vim/bundle/Vundle.vim/CONTRIBUTING.md Bestand weergeven

@@ -0,0 +1,111 @@
Pull Requests
=============

1. Please squash your commits to minimize the log pollution. This is more of a convenience for the maintainer who pulls. If you are unfamiliar, see [here](http://ariejan.net/2011/07/05/git-squash-your-latests-commits-into-one/).

2. Clearly describe what you aim to fix or add to Vundle.

3. Try to minimize code changes and use existing style/functions.

Issues
======

## Check For Answers

Before submitting an issue, be sure to check the following places for answers.

1. Vundle docs at [`:h vundle`](https://github.com/gmarik/Vundle.vim/blob/master/doc/vundle.txt).

2. The [FAQ](https://github.com/gmarik/Vundle.vim/search).

3. [Search](https://github.com/gmarik/Vundle.vim/search) the repository for related issues.

## Try To Eliminate Your Vimrc

In order to make sure it isn't just `.vimrc` replace your own config file with the [minimal vimrc](https://github.com/gmarik/Vundle.vim/blob/master/test/minirc.vim). Clear out bundles and then try to reproduce.

If the problem stops, likely there is an issue in your user configuration. You can incrementally add back your user changes to the minimal file testing the bug each time. This will allow you to slowly bisect the issue. You may want to test one plugin at a time.

If you can still reproduce the problem, try to find the smallest `.vimrc` config file that creates the problem to include later.

## Guidelines

To better respond to issues please follow these general guidelines when explaining the problem.

1. Clearly describe what the error is, if relevant attach output/screenshots.

2. Describe how developers can reproduce the bug, the steps should be from starting Vim.

3. Include your OS, version and architecture. For example, Windows 7 64, Kubuntu 13.04 32, etc...

4. If relevant to reproducing the bug, include the smallest subset of your `.vimrc` that causes the issue. Put this in code tags.

5. At the end of your issue, please put the output of `vim --version` in code tags.

## Example Post

I am using Vim on Kubuntu 13.04 64 bit and I get the following error... (add further explanation here)

To reproduce the bug, use the vimrc file below and run `:BundleInstall`... (continue with steps)

Vimrc:
```
set nocompatible
syntax on
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
Bundle 'gmarik/Vundle.vim'
Bundle 'relevant/plugin'
filetype plugin indent on

.... more user configs here...
```

Vim Version:
```
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 15 2013 10:58:39)
Included patches: 1-5
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2 GUI. Features included (+) or not (-):
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
+balloon_eval +float +mouse_urxvt -tag_any_white
+browse +folding +mouse_xterm +tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
+clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra +toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui +lua +rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
+emacs_tags +mouseshape -sniff +xsmp_interact
+eval +mouse_dec +startuptime +xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop
+farsi +mouse_netterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/harfbuzz -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include/tcl8.5 -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_LARGEFILE64_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.1 -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.14/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/x86_64-linux-gnu -ltcl8.5 -ldl -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
```

+ 7
- 0
dotfiles/vim/bundle/Vundle.vim/LICENSE-MIT.txt Bestand weergeven

@@ -0,0 +1,7 @@
Copyright (C) 2010 http://github.com/gmarik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 158
- 0
dotfiles/vim/bundle/Vundle.vim/README.md Bestand weergeven

@@ -0,0 +1,158 @@
## [Help Maintain Vundle](https://github.com/gmarik/Vundle.vim/issues/383)

## About

[Vundle] is short for _Vim bundle_ and is a [Vim] plugin manager.

[Vundle] allows you to...

* keep track of and [configure] your plugins right in the `.vimrc`
* [install] configured plugins (a.k.a. scripts/bundle)
* [update] configured plugins
* [search] by name all available [Vim scripts]
* [clean] unused plugins up
* run the above actions in a *single keypress* with [interactive mode]

[Vundle] automatically...

* manages the [runtime path] of your installed scripts
* regenerates [help tags] after installing and updating

[Vundle] is undergoing an [interface change], please stay up to date to get latest changes.

[![Gitter-chat](https://badges.gitter.im/gmarik/Vundle.vim.png)](https://gitter.im/gmarik/Vundle.vim) for discussion and support.

![Vundle-installer](http://i.imgur.com/Rueh7Cc.png)

## Quick Start

1. Introduction:

Installation requires [Git] and triggers [`git clone`] for each configured repository to `~/.vim/bundle/` by default.
Curl is required for search.

If you are using Windows, go directly to [Windows setup]. If you run into any issues, please consult the [FAQ].
See [Tips] for some advanced configurations.

2. Set up [Vundle]:

`$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim`

3. Configure Plugins:

Put this at the top of your `.vimrc` to use Vundle. Remove plugins you don't need, they are for illustration purposes.

```vim
set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
```

4. Install Plugins:

Launch `vim` and run `:PluginInstall`

To install from command line: `vim +PluginInstall +qall`

## Docs

See the [`:h vundle`](https://github.com/gmarik/Vundle.vim/blob/master/doc/vundle.txt) Vimdoc for more details.

## Changelog

See the [changelog](https://github.com/gmarik/Vundle.vim/blob/master/changelog.md).

## People Using Vundle

see [Examples](https://github.com/gmarik/Vundle.vim/wiki/Examples)

## Contributors

see [Vundle contributors](https://github.com/gmarik/Vundle.vim/graphs/contributors)

*Thank you!*

## Inspiration & Ideas

* [pathogen.vim](http://github.com/tpope/vim-pathogen/)
* [Bundler](https://github.com/bundler/bundler)
* [Scott Bronson](http://github.com/bronson)

## Also

* Vundle was developed and tested with [Vim] 7.3 on OS X, Linux and Windows
* Vundle tries to be as [KISS](http://en.wikipedia.org/wiki/KISS_principle) as possible

## TODO:
[Vundle] is a work in progress, so any ideas and patches are appreciated.

* ✓ activate newly added bundles on `.vimrc` reload or after `:PluginInstall`
* ✓ use preview window for search results
* ✓ Vim documentation
* ✓ put Vundle in `bundles/` too (will fix Vundle help)
* ✓ tests
* ✓ improve error handling
* allow specifying revision/version?
* handle dependencies
* show description in search results
* search by description as well
* make it rock!

[Vundle]:http://github.com/gmarik/Vundle.vim
[Windows setup]:https://github.com/gmarik/Vundle.vim/wiki/Vundle-for-Windows
[FAQ]:https://github.com/gmarik/Vundle.vim/wiki
[Tips]:https://github.com/gmarik/Vundle.vim/wiki/Tips-and-Tricks
[Vim]:http://www.vim.org
[Git]:http://git-scm.com
[`git clone`]:http://gitref.org/creating/#clone

[Vim scripts]:http://vim-scripts.org/vim/scripts.html
[help tags]:http://vimdoc.sourceforge.net/htmldoc/helphelp.html#:helptags
[runtime path]:http://vimdoc.sourceforge.net/htmldoc/options.html#%27runtimepath%27

[configure]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L126-L233
[install]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L234-L254
[update]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L255-L265
[search]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L266-L295
[clean]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L303-L318
[interactive mode]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L319-L360
[interface change]:https://github.com/gmarik/Vundle.vim/blob/v0.10.2/doc/vundle.txt#L372-L396

+ 83
- 0
dotfiles/vim/bundle/Vundle.vim/autoload/vundle.vim Bestand weergeven

@@ -0,0 +1,83 @@
" Vundle is a shortcut for Vim Bundle and Is a simple plugin manager for Vim
" Author: gmarik
" HomePage: http://github.com/gmarik/Vundle.vim
" Readme: http://github.com/gmarik/Vundle.vim/blob/master/README.md
" Version: 0.10.2

" Plugin Commands
com! -nargs=+ -bar Plugin
\ call vundle#config#bundle(<args>)

com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginInstall
\ call vundle#installer#new('!' == '<bang>', <q-args>)

com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginSearch
\ call vundle#scripts#all('!' == '<bang>', <q-args>)

com! -nargs=0 -bang PluginList
\ call vundle#installer#list('!' == '<bang>')

com! -nargs=? -bang PluginClean
\ call vundle#installer#clean('!' == '<bang>')

com! -nargs=0 PluginDocs
\ call vundle#installer#helptags(g:bundles)

" Aliases
com! PluginUpdate PluginInstall!

" Vundle Aliases
com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall PluginInstall<bang> <args>
com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleSearch PluginSearch<bang> <args>
com! -nargs=? -bang VundleClean PluginClean<bang>
com! -nargs=0 VundleDocs PluginDocs
com! VundleUpdate PluginInstall!

" Deprecated Commands
com! -nargs=+ Bundle call vundle#config#bundle(<args>)
com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall PluginInstall<bang> <args>
com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleSearch PluginSearch<bang> <args>
com! -nargs=0 -bang BundleList PluginList<bang>
com! -nargs=? -bang BundleClean PluginClean<bang>
com! -nargs=0 BundleDocs PluginDocs
com! BundleUpdate PluginInstall!

" Set up the signs used in the installer window. (See :help signs)
if (has('signs'))
sign define Vu_error text=! texthl=Error
sign define Vu_active text=> texthl=Comment
sign define Vu_todate text=. texthl=Comment
sign define Vu_new text=+ texthl=Comment
sign define Vu_updated text=* texthl=Comment
sign define Vu_deleted text=- texthl=Comment
sign define Vu_helptags text=* texthl=Comment
sign define Vu_pinned text== texthl=Comment
endif

" Set up Vundle. This function has to be called from the users vimrc file.
" This will force Vim to source this file as a side effect which wil define
" the :Plugin command. After calling this function the user can use the
" :Plugin command in the vimrc. It is not possible to do this automatically
" because when loading the vimrc file no plugins where loaded yet.
func! vundle#rc(...) abort
let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1)
let g:updated_bundles = []
let g:vundle_log = []
let g:vundle_changelog = ['Updated Plugins:']
call vundle#config#init()
endf

" Alternative to vundle#rc, offers speed up by modifying rtp only when end()
" called later.
func! vundle#begin(...) abort
let g:vundle_lazy_load = 1
call call('vundle#rc', a:000)
endf

" Finishes putting plugins on the rtp.
func! vundle#end(...) abort
unlet g:vundle_lazy_load
call vundle#config#activate_bundles()
endf

" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl:

+ 278
- 0
dotfiles/vim/bundle/Vundle.vim/autoload/vundle/config.vim Bestand weergeven

@@ -0,0 +1,278 @@
" ---------------------------------------------------------------------------
" Add a plugin to the runtimepath.
"
" arg -- a string specifying the plugin
" ... -- a dictionary of options for the plugin
" return -- the return value from vundle#config#init_bundle()
" ---------------------------------------------------------------------------
func! vundle#config#bundle(arg, ...)
let bundle = vundle#config#init_bundle(a:arg, a:000)
if !s:check_bundle_name(bundle)
return
endif
if exists('g:vundle_lazy_load') && g:vundle_lazy_load
call add(g:bundles, bundle)
else
call s:rtp_rm_a()
call add(g:bundles, bundle)
call s:rtp_add_a()
call s:rtp_add_defaults()
endif
return bundle
endf


" ---------------------------------------------------------------------------
" When lazy bundle load is used (begin/end functions), add all configured
" bundles to runtimepath and reorder appropriately.
" ---------------------------------------------------------------------------
func! vundle#config#activate_bundles()
call s:rtp_add_a()
call s:rtp_add_defaults()
endf


" ---------------------------------------------------------------------------
" Initialize Vundle.
"
" Start a new bundles list and make sure the runtimepath does not contain
" directories from a previous call. In theory, this should only be called
" once.
" ---------------------------------------------------------------------------
func! vundle#config#init()
if !exists('g:bundles') | let g:bundles = [] | endif
call s:rtp_rm_a()
let g:bundles = []
let g:bundle_names = {}
endf


" ---------------------------------------------------------------------------
" Add a list of bundles to the runtimepath and source them.
"
" bundles -- a list of bundle objects
" ---------------------------------------------------------------------------
func! vundle#config#require(bundles) abort
for b in a:bundles
call s:rtp_add(b.rtpath)
call s:rtp_add(g:bundle_dir)
" TODO: it has to be relative rtpath, not bundle.name
exec 'runtime! '.b.name.'/plugin/*.vim'
exec 'runtime! '.b.name.'/after/*.vim'
call s:rtp_rm(g:bundle_dir)
endfor
call s:rtp_add_defaults()
endf


" ---------------------------------------------------------------------------
" Create a bundle object from a bundle specification.
"
" name -- the bundle specification as a string
" opts -- the options dictionary from then bundle definition
" return -- an initialized bundle object
" ---------------------------------------------------------------------------
func! vundle#config#init_bundle(name, opts)
if a:name != substitute(a:name, '^\s*\(.\{-}\)\s*$', '\1', '')
echo "Spurious leading and/or trailing whitespace found in plugin spec '" . a:name . "'"
endif
let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')), 'keep')
let b = extend(opts, copy(s:bundle))
let b.rtpath = s:rtpath(opts)
return b
endf


" ---------------------------------------------------------------------------
" Check if the current bundle name has already been used in this running
" instance and show an error to that effect.
"
" bundle -- a bundle object whose name is to be checked
" return -- 0 if the bundle's name has been seen before, 1 otherwise
" ---------------------------------------------------------------------------
funct! s:check_bundle_name(bundle)
if has_key(g:bundle_names, a:bundle.name)
echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec .
\ '. Plugin ' . g:bundle_names[a:bundle.name] .
\ ' previously used the name "' . a:bundle.name . '"' .
\ '. Skipping Plugin ' . a:bundle.name_spec . '.'
return 0
endif
let g:bundle_names[a:bundle.name] = a:bundle.name_spec
return 1
endf


" ---------------------------------------------------------------------------
" Parse the options which can be supplied with the bundle specification.
" Corresponding documentation: vundle-plugins-configure
"
" opts -- a dictionary with the user supplied options for the bundle
" return -- a dictionary with the user supplied options for the bundle, this
" will be merged with a s:bundle object into one dictionary.
" ---------------------------------------------------------------------------
func! s:parse_options(opts)
" TODO: improve this
if len(a:opts) != 1 | return {} | endif

if type(a:opts[0]) == type({})
return a:opts[0]
else
return {'rev': a:opts[0]}
endif
endf


" ---------------------------------------------------------------------------
" Parse the plugin specification. Corresponding documentation:
" vundle-plugins-uris
"
" arg -- the string supplied to identify the plugin
" return -- a dictionary with the folder name (key 'name') and the uri (key
" 'uri') for cloning the plugin and the original argument (key
" 'name_spec')
" ---------------------------------------------------------------------------
func! s:parse_name(arg)
let arg = a:arg
let git_proto = exists('g:vundle_default_git_proto') ? g:vundle_default_git_proto : 'https'

if arg =~? '^\s*\(gh\|github\):\S\+'
\ || arg =~? '^[a-z0-9][a-z0-9-]*/[^/]\+$'
let uri = git_proto.'://github.com/'.split(arg, ':')[-1]
if uri !~? '\.git$'
let uri .= '.git'
endif
let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i')
elseif arg =~? '^\s*\(git@\|git://\)\S\+'
\ || arg =~? '\(file\|https\?\)://'
\ || arg =~? '\.git\s*$'
let uri = arg
let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1]
else
let name = arg
let uri = git_proto.'://github.com/vim-scripts/'.name.'.git'
endif
return {'name': name, 'uri': uri, 'name_spec': arg }
endf


" ---------------------------------------------------------------------------
" Modify the runtimepath, after all bundles have been added, so that the
" directories that were in the default runtimepath appear first in the list
" (with their 'after' directories last).
" ---------------------------------------------------------------------------
func! s:rtp_add_defaults()
let current = &rtp
set rtp&vim
let default = &rtp
let &rtp = current
let default_rtp_items = split(default, ',')
if !empty(default_rtp_items)
let first_item = fnameescape(default_rtp_items[0])
exec 'set rtp-=' . first_item
exec 'set rtp^=' . first_item
endif
endf


" ---------------------------------------------------------------------------
" Remove all paths for the plugins which are managed by Vundle from the
" runtimepath.
" ---------------------------------------------------------------------------
func! s:rtp_rm_a()
let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
let appends = join(paths, '/after,').'/after'
exec 'set rtp-='.fnameescape(prepends)
exec 'set rtp-='.fnameescape(appends)
endf


" ---------------------------------------------------------------------------
" Add all paths for the plugins which are managed by Vundle to the
" runtimepath.
" ---------------------------------------------------------------------------
func! s:rtp_add_a()
let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
let appends = join(paths, '/after,').'/after'
exec 'set rtp^='.fnameescape(prepends)
exec 'set rtp+='.fnameescape(appends)
endf


" ---------------------------------------------------------------------------
" Remove a directory and the corresponding 'after' directory from runtimepath.
"
" dir -- the directory name to be removed as a string. The corresponding
" 'after' directory will also be removed.
" ---------------------------------------------------------------------------
func! s:rtp_rm(dir) abort
exec 'set rtp-='.fnameescape(expand(a:dir, 1))
exec 'set rtp-='.fnameescape(expand(a:dir.'/after', 1))
endf


" ---------------------------------------------------------------------------
" Add a directory and the corresponding 'after' directory to runtimepath.
"
" dir -- the directory name to be added as a string. The corresponding
" 'after' directory will also be added.
" ---------------------------------------------------------------------------
func! s:rtp_add(dir) abort
exec 'set rtp^='.fnameescape(expand(a:dir, 1))
exec 'set rtp+='.fnameescape(expand(a:dir.'/after', 1))
endf


" ---------------------------------------------------------------------------
" Expand and simplify a path.
"
" path -- the path to expand as a string
" return -- the expanded and simplified path
" ---------------------------------------------------------------------------
func! s:expand_path(path) abort
return simplify(expand(a:path, 1))
endf


" ---------------------------------------------------------------------------
" Find the actual path inside a bundle directory to be added to the
" runtimepath. It might be provided by the user with the 'rtp' option.
" Corresponding documentation: vundle-plugins-configure
"
" opts -- a bundle dict
" return -- expanded path to the corresponding plugin directory
" ---------------------------------------------------------------------------
func! s:rtpath(opts)
return has_key(a:opts, 'rtp') ? s:expand_path(a:opts.path().'/'.a:opts.rtp) : a:opts.path()
endf


" ---------------------------------------------------------------------------
" a bundle 'object'
" ---------------------------------------------------------------------------
let s:bundle = {}


" ---------------------------------------------------------------------------
" Return the absolute path to the directory inside the bundle directory
" (prefix) where thr bundle will be cloned.
"
" return -- the target location to clone this bundle to
" ---------------------------------------------------------------------------
func! s:bundle.path()
return s:expand_path(g:bundle_dir.'/'.self.name)
endf


" ---------------------------------------------------------------------------
" Determine if the bundle has the pinned attribute set in the config
"
" return -- 1 if the bundle is pinned, 0 otherwise
" ---------------------------------------------------------------------------
func! s:bundle.is_pinned()
return get(self, 'pinned')
endf

" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl:

+ 534
- 0
dotfiles/vim/bundle/Vundle.vim/autoload/vundle/installer.vim Bestand weergeven

@@ -0,0 +1,534 @@
" ---------------------------------------------------------------------------
" Try to clone all new bundles given (or all bundles in g:bundles by default)
" to g:bundle_dir. If a:bang is 1 it will also update all plugins (git pull).
"
" bang -- 1 or 0
" ... -- any number of bundle specifications (separate arguments)
" ---------------------------------------------------------------------------
func! vundle#installer#new(bang, ...) abort
let bundles = (a:1 == '') ?
\ g:bundles :
\ map(copy(a:000), 'vundle#config#bundle(v:val, {})')

let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec'))
call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:bundle_dir, 1)], names + ['Helptags'])

" This calls 'add' as a normal mode command. This is a buffer local mapping
" defined in vundle#scripts#view(). The mapping will call a buffer local
" command InstallPlugin which in turn will call vundle#installer#run() with
" vundle#installer#install().
call s:process(a:bang, (a:bang ? 'add!' : 'add'))

call vundle#config#require(bundles)
endf


" ---------------------------------------------------------------------------
" Iterate over all lines in a Vundle window and execute the given command for
" every line. Used by the installation and cleaning functions.
"
" bang -- not used (FIXME)
" cmd -- the (normal mode) command to execute for every line as a string
" ---------------------------------------------------------------------------
func! s:process(bang, cmd)
let msg = ''

redraw
sleep 1m

let lines = (getline('.','$')[0:-2])

for line in lines
redraw

exec ':norm '.a:cmd

if 'error' == g:vundle_last_status
let msg = 'With errors; press l to view log'
endif

if 'updated' == g:vundle_last_status && empty(msg)
let msg = 'Plugins updated; press u to view changelog'
endif

" goto next one
exec ':+1'

setl nomodified
endfor

redraw
echo 'Done! '.msg
endf


" ---------------------------------------------------------------------------
" Call another function in the different Vundle windows.
"
" func_name -- the function to call
" name -- the bundle name to call func_name for (string)
" ... -- the argument to be used when calling func_name (only the first
" optional argument will be used)
" return -- the status returned by the call to func_name
" ---------------------------------------------------------------------------
func! vundle#installer#run(func_name, name, ...) abort
let n = a:name

echo 'Processing '.n
call s:sign('active')

sleep 1m

let status = call(a:func_name, a:1)

call s:sign(status)

redraw

if 'new' == status
echo n.' installed'
elseif 'updated' == status
echo n.' updated'
elseif 'todate' == status
echo n.' already installed'
elseif 'deleted' == status
echo n.' deleted'
elseif 'helptags' == status
echo n.' regenerated'
elseif 'pinned' == status
echo n.' pinned'
elseif 'error' == status
echohl Error
echo 'Error processing '.n
echohl None
sleep 1
else
throw 'whoops, unknown status:'.status
endif

let g:vundle_last_status = status

return status
endf


" ---------------------------------------------------------------------------
" Put a sign on the current line, indicating the status of the installation
" step.
"
" status -- string describing the status
" ---------------------------------------------------------------------------
func! s:sign(status)
if (!has('signs'))
return
endif

exe ":sign place ".line('.')." line=".line('.')." name=Vu_". a:status ." buffer=" . bufnr("%")
endf


" ---------------------------------------------------------------------------
" Install a plugin, then add it to the runtimepath and source it.
"
" bang -- 1 or 0, passed directly to vundle#installer#install()
" name -- the name of a bundle (string)
" return -- the return value from vundle#installer#install()
" ---------------------------------------------------------------------------
func! vundle#installer#install_and_require(bang, name) abort
let result = vundle#installer#install(a:bang, a:name)
let b = vundle#config#bundle(a:name, {})
call vundle#installer#helptags([b])
call vundle#config#require([b])
return result
endf


" ---------------------------------------------------------------------------
" Install or update a bundle given by its name.
"
" bang -- 1 or 0, passed directly to s:sync()
" name -- the name of a bundle (string)
" return -- the return value from s:sync()
" ---------------------------------------------------------------------------
func! vundle#installer#install(bang, name) abort
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif

let n = substitute(a:name,"['".'"]\+','','g')
let matched = filter(copy(g:bundles), 'v:val.name_spec == n')

if len(matched) > 0
let b = matched[0]
else
let b = vundle#config#init_bundle(a:name, {})
endif

return s:sync(a:bang, b)
endf


" ---------------------------------------------------------------------------
" Call :helptags for all bundles in g:bundles.
"
" return -- 'error' if an error occurred, else return 'helptags'
" ---------------------------------------------------------------------------
func! vundle#installer#docs() abort
let error_count = vundle#installer#helptags(g:bundles)
if error_count > 0
return 'error'
endif
return 'helptags'
endf


" ---------------------------------------------------------------------------
" Call :helptags for a list of bundles.
"
" bundles -- a list of bundle dictionaries for which :helptags should be
" called.
" return -- the number of directories where :helptags failed
" ---------------------------------------------------------------------------
func! vundle#installer#helptags(bundles) abort
let bundle_dirs = map(copy(a:bundles),'v:val.rtpath')
let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)')

call s:log('')
call s:log('Helptags:')

let statuses = map(copy(help_dirs), 's:helptags(v:val)')
let errors = filter(statuses, 'v:val == 0')

call s:log('Helptags: '.len(help_dirs).' plugins processed')

return len(errors)
endf


" ---------------------------------------------------------------------------
" List all installed plugins.
" Corresponding documentation: vundle-plugins-list
"
" bang -- not used
" ---------------------------------------------------------------------------
func! vundle#installer#list(bang) abort
let bundles = vundle#scripts#bundle_names(map(copy(g:bundles), 'v:val.name_spec'))
call vundle#scripts#view('list', ['" My Plugins'], bundles)
redraw
echo len(g:bundles).' plugins configured'
endf


" ---------------------------------------------------------------------------
" List and remove all directories in the bundle directory which are not
" activated (added to the bundle list).
"
" bang -- 0 if the user should be asked to confirm every deletion, 1 if they
" should be removed unconditionally
" ---------------------------------------------------------------------------
func! vundle#installer#clean(bang) abort
let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
let all_dirs = (v:version > 702 || (v:version == 702 && has("patch51")))
\ ? split(globpath(g:bundle_dir, '*', 1), "\n")
\ : split(globpath(g:bundle_dir, '*'), "\n")
let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')

if empty(x_dirs)
let headers = ['" All clean!']
let names = []
else
let headers = ['" Removing Plugins:']
let names = vundle#scripts#bundle_names(map(copy(x_dirs), 'fnamemodify(v:val, ":t")'))
end

call vundle#scripts#view('clean', headers, names)
redraw

if (a:bang || empty(names))
call s:process(a:bang, 'D')
else
call inputsave()
let response = input('Continue? [Y/n]: ')
call inputrestore()
if (response =~? 'y' || response == '')
call s:process(a:bang, 'D')
endif
endif
endf


" ---------------------------------------------------------------------------
" Delete to directory for a plugin.
"
" bang -- not used
" dir_name -- the bundle directory to be deleted (as a string)
" return -- 'error' if an error occurred, 'deleted' if the plugin folder was
" successfully deleted
" ---------------------------------------------------------------------------
func! vundle#installer#delete(bang, dir_name) abort

let cmd = ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) ?
\ 'rmdir /S /Q' :
\ 'rm -rf'

let bundle = vundle#config#init_bundle(a:dir_name, {})
let cmd .= ' '.vundle#installer#shellesc(bundle.path())

let out = s:system(cmd)

call s:log('')
call s:log('Plugin '.a:dir_name)
call s:log(cmd, '$ ')
call s:log(out, '> ')

if 0 != v:shell_error
return 'error'
else
return 'deleted'
endif
endf


" ---------------------------------------------------------------------------
" Check if a bundled plugin has any documentation.
"
" rtp -- a path (string) where the plugin is installed
" return -- 1 if some documentation was found, 0 otherwise
" ---------------------------------------------------------------------------
func! s:has_doc(rtp) abort
return isdirectory(a:rtp.'/doc')
\ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags'))
\ && (v:version > 702 || (v:version == 702 && has("patch51")))
\ ? !(empty(glob(a:rtp.'/doc/*.txt', 1)) && empty(glob(a:rtp.'/doc/*.??x', 1)))
\ : !(empty(glob(a:rtp.'/doc/*.txt')) && empty(glob(a:rtp.'/doc/*.??x')))
endf


" ---------------------------------------------------------------------------
" Update the helptags for a plugin.
"
" rtp -- the path to the plugin's root directory (string)
" return -- 1 if :helptags succeeded, 0 otherwise
" ---------------------------------------------------------------------------
func! s:helptags(rtp) abort
" it is important to keep trailing slash here
let doc_path = resolve(a:rtp . '/doc/')
call s:log(':helptags '.doc_path)
try
execute 'helptags ' . doc_path
catch
call s:log("> Error running :helptags ".doc_path)
return 0
endtry
return 1
endf


" ---------------------------------------------------------------------------
" Get the URL for the remote called 'origin' on the repository that
" corresponds to a given bundle.
"
" bundle -- a bundle object to check the repository for
" return -- the URL for the origin remote (string)
" ---------------------------------------------------------------------------
func! s:get_current_origin_url(bundle) abort
let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url'
let cmd = vundle#installer#shellesc_cd(cmd)
let out = s:strip(s:system(cmd))
return out
endf


" ---------------------------------------------------------------------------
" Get a short sha of the HEAD of the repository for a given bundle
"
" bundle -- a bundle object
" return -- A 15 character log sha for the current HEAD
" ---------------------------------------------------------------------------
func! s:get_current_sha(bundle)
let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD'
let cmd = vundle#installer#shellesc_cd(cmd)
let out = s:system(cmd)[0:15]
return out
endf


" ---------------------------------------------------------------------------
" Create the appropriate sync command to run according to the current state of
" the local repository (clone, pull, reset, etc).
"
" In the case of a pull (update), also return the current sha, so that we can
" later check that there has been an upgrade.
"
" bang -- 0 if only new plugins should be installed, 1 if existing plugins
" should be updated
" bundle -- a bundle object to create the sync command for
" return -- A list containing the command to run and the sha for the current
" HEAD
" ---------------------------------------------------------------------------
func! s:make_sync_command(bang, bundle) abort
let git_dir = expand(a:bundle.path().'/.git/', 1)
if isdirectory(git_dir) || filereadable(expand(a:bundle.path().'/.git', 1))

let current_origin_url = s:get_current_origin_url(a:bundle)
if current_origin_url != a:bundle.uri
call s:log('Plugin URI change detected for Plugin ' . a:bundle.name)
call s:log('> Plugin ' . a:bundle.name . ' old URI: ' . current_origin_url)
call s:log('> Plugin ' . a:bundle.name . ' new URI: ' . a:bundle.uri)
" Directory names match but the origin remotes are not the same
let cmd_parts = [
\ 'cd '.vundle#installer#shellesc(a:bundle.path()) ,
\ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri),
\ 'git fetch',
\ 'git reset --hard origin/HEAD',
\ 'git submodule update --init --recursive',
\ ]
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)
let initial_sha = ''
return [cmd, initial_sha]
endif

if !(a:bang)
" The repo exists, and no !, so leave as it is.
return ['', '']
endif

let cmd_parts = [
\ 'cd '.vundle#installer#shellesc(a:bundle.path()),
\ 'git pull',
\ 'git submodule update --init --recursive',
\ ]
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)

let initial_sha = s:get_current_sha(a:bundle)
else
let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path())
let initial_sha = ''
endif
return [cmd, initial_sha]
endf


" ---------------------------------------------------------------------------
" Install or update a given bundle object with git.
"
" bang -- 0 if only new plugins should be installed, 1 if existing plugins
" should be updated
" bundle -- a bundle object (dictionary)
" return -- a string indicating the status of the bundle installation:
" - todate : Nothing was updated or the repository was up to date
" - new : The plugin was newly installed
" - updated : Some changes where pulled via git
" - error : An error occurred in the shell command
" - pinned : The bundle is marked as pinned
" ---------------------------------------------------------------------------
func! s:sync(bang, bundle) abort
" Do not sync if this bundle is pinned
if a:bundle.is_pinned()
return 'pinned'
endif

let [ cmd, initial_sha ] = s:make_sync_command(a:bang, a:bundle)
if empty(cmd)
return 'todate'
endif

let out = s:system(cmd)
call s:log('')
call s:log('Plugin '.a:bundle.name_spec)
call s:log(cmd, '$ ')
call s:log(out, '> ')

if 0 != v:shell_error
return 'error'
end

if empty(initial_sha)
return 'new'
endif

let updated_sha = s:get_current_sha(a:bundle)

if initial_sha == updated_sha
return 'todate'
endif

call add(g:updated_bundles, [initial_sha, updated_sha, a:bundle])
return 'updated'
endf


" ---------------------------------------------------------------------------
" Escape special characters in a string to be able to use it as a shell
" command with system().
"
" cmd -- the string holding the shell command
" return -- a string with the relevant characters escaped
" ---------------------------------------------------------------------------
func! vundle#installer#shellesc(cmd) abort
if ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh')))
return '"' . substitute(a:cmd, '"', '\\"', 'g') . '"'
endif
return shellescape(a:cmd)
endf


" ---------------------------------------------------------------------------
" Fix a cd shell command to be used on Windows.
"
" cmd -- the command to be fixed (string)
" return -- the fixed command (string)
" ---------------------------------------------------------------------------
func! vundle#installer#shellesc_cd(cmd) abort
if ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh')))
let cmd = substitute(a:cmd, '^cd ','cd /d ','') " add /d switch to change drives
return cmd
else
return a:cmd
endif
endf


" ---------------------------------------------------------------------------
" Make a system call. This can be used to change the way system calls
" are made during developing, without searching the whole code base for
" actual system() calls.
"
" cmd -- the command passed to system() (string)
" return -- the return value from system()
" ---------------------------------------------------------------------------
func! s:system(cmd) abort
return system(a:cmd)
endf


" ---------------------------------------------------------------------------
" Add a log message to Vundle's internal logging variable.
"
" str -- the log message (string)
" prefix -- optional prefix for multi-line entries (string)
" return -- a:str
" ---------------------------------------------------------------------------
func! s:log(str, ...) abort
let prefix = a:0 > 0 ? a:1 : ''
let fmt = '%Y-%m-%d %H:%M:%S'
let lines = split(a:str, '\n', 1)
let time = strftime(fmt)
for line in lines
call add(g:vundle_log, '['. time .'] '. prefix . line)
endfor
return a:str
endf


" ---------------------------------------------------------------------------
" Remove leading and trailing whitespace from a string
"
" str -- The string to rid of trailing and leading spaces
" return -- A string stripped of side spaces
" ---------------------------------------------------------------------------
func! s:strip(str)
return substitute(a:str, '\%^\_s*\(.\{-}\)\_s*\%$', '\1', '')
endf

" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl:

+ 257
- 0
dotfiles/vim/bundle/Vundle.vim/autoload/vundle/scripts.vim Bestand weergeven

@@ -0,0 +1,257 @@
" ---------------------------------------------------------------------------
" Search the database from vim-script.org for a matching plugin. If no
" argument is given, list all plugins. This function is used by the :Plugins
" and :PluginSearch commands.
"
" bang -- if 1 refresh the script name cache, if 0 don't
" ... -- a plugin name to search for
" ---------------------------------------------------------------------------
func! vundle#scripts#all(bang, ...)
let b:match = ''
let info = ['"Keymap: i - Install plugin; c - Cleanup; s - Search; R - Reload list']
let matches = s:load_scripts(a:bang)
if !empty(a:1)
let matches = filter(matches, 'v:val =~? "'.escape(a:1,'"').'"')
let info += ['"Search results for: '.a:1]
" TODO: highlight matches
let b:match = a:1
endif
call vundle#scripts#view('search',info, vundle#scripts#bundle_names(reverse(matches)))
redraw
echo len(matches).' plugins found'
endf


" ---------------------------------------------------------------------------
" Repeat the search for bundles.
" ---------------------------------------------------------------------------
func! vundle#scripts#reload() abort
silent exec ':PluginSearch! '.(exists('b:match') ? b:match : '')
redraw
endf


" ---------------------------------------------------------------------------
" Complete names for bundles in the command line.
"
" a, c, d -- see :h command-completion-custom
" return -- all valid plugin names from vim-scripts.org as completion
" candidates, see also :h command-completion-custom
" ---------------------------------------------------------------------------
func! vundle#scripts#complete(a,c,d)
return join(s:load_scripts(0),"\n")
endf


" ---------------------------------------------------------------------------
" View the logfile after an update or installation.
" ---------------------------------------------------------------------------
func! s:view_log()
if !exists('g:vundle_log_file')
let g:vundle_log_file = tempname()
endif

call writefile(g:vundle_log, g:vundle_log_file)
execute 'silent pedit ' . g:vundle_log_file

wincmd P | wincmd H
endf


" ---------------------------------------------------------------------------
" Parse the output from git log after an update to create a change log for the
" user.
" ---------------------------------------------------------------------------
func! s:create_changelog() abort
for bundle_data in g:updated_bundles
let initial_sha = bundle_data[0]
let updated_sha = bundle_data[1]
let bundle = bundle_data[2]

let cmd = 'cd '.vundle#installer#shellesc(bundle.path()).
\ ' && git log --pretty=format:"%s %an, %ar" --graph '.
\ initial_sha.'..'.updated_sha

let cmd = vundle#installer#shellesc_cd(cmd)

let updates = system(cmd)

call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Plugin: '.bundle.name)

if bundle.uri =~ "https://github.com"
call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha)
endif

for update in split(updates, '\n')
let update = substitute(update, '\s\+$', '', '')
call add(g:vundle_changelog, ' '.update)
endfor
endfor
endf


" ---------------------------------------------------------------------------
" View the change log after an update or installation.
" ---------------------------------------------------------------------------
func! s:view_changelog()
call s:create_changelog()

if !exists('g:vundle_changelog_file')
let g:vundle_changelog_file = tempname()
endif

call writefile(g:vundle_changelog, g:vundle_changelog_file)
execute 'silent pedit ' . g:vundle_changelog_file

wincmd P | wincmd H
endf


" ---------------------------------------------------------------------------
" Create a list of 'Plugin ...' lines from a list of bundle names.
"
" names -- a list of names (strings) of plugins
" return -- a list of 'Plugin ...' lines suitable to be written to a buffer
" ---------------------------------------------------------------------------
func! vundle#scripts#bundle_names(names)
return map(copy(a:names), ' printf("Plugin ' ."'%s'".'", v:val) ')
endf


" ---------------------------------------------------------------------------
" Open a buffer to display information to the user. Several special commands
" are defined in the new buffer.
"
" title -- a title for the new buffer
" headers -- a list of header lines to be displayed at the top of the buffer
" results -- the main information to be displayed in the buffer (list of
" strings)
" ---------------------------------------------------------------------------
func! vundle#scripts#view(title, headers, results)
if exists('g:vundle_view') && bufloaded(g:vundle_view)
exec g:vundle_view.'bd!'
endif

exec 'silent pedit [Vundle] '.a:title

wincmd P | wincmd H

let g:vundle_view = bufnr('%')
"
" make buffer modifiable
" to append without errors
set modifiable

call append(0, a:headers + a:results)

setl buftype=nofile
setl noswapfile

setl cursorline
setl nonu ro noma
if (exists('&relativenumber')) | setl norelativenumber | endif

setl ft=vundle
setl syntax=vim
syn keyword vimCommand Plugin
syn keyword vimCommand Bundle
syn keyword vimCommand Helptags

com! -buffer -bang -nargs=1 DeletePlugin
\ call vundle#installer#run('vundle#installer#delete', split(<q-args>,',')[0], ['!' == '<bang>', <args>])

com! -buffer -bang -nargs=? InstallAndRequirePlugin
\ call vundle#installer#run('vundle#installer#install_and_require', split(<q-args>,',')[0], ['!' == '<bang>', <q-args>])

com! -buffer -bang -nargs=? InstallPlugin
\ call vundle#installer#run('vundle#installer#install', split(<q-args>,',')[0], ['!' == '<bang>', <q-args>])

com! -buffer -bang -nargs=0 InstallHelptags
\ call vundle#installer#run('vundle#installer#docs', 'helptags', [])

com! -buffer -nargs=0 VundleLog call s:view_log()

com! -buffer -nargs=0 VundleChangelog call s:view_changelog()

nnoremap <buffer> q :silent bd!<CR>
nnoremap <buffer> D :exec 'Delete'.getline('.')<CR>

nnoremap <buffer> add :exec 'Install'.getline('.')<CR>
nnoremap <buffer> add! :exec 'Install'.substitute(getline('.'), '^Plugin ', 'Plugin! ', '')<CR>

nnoremap <buffer> i :exec 'InstallAndRequire'.getline('.')<CR>
nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(getline('.'), '^Plugin ', 'Plugin! ', '')<CR>

nnoremap <buffer> l :VundleLog<CR>
nnoremap <buffer> u :VundleChangelog<CR>
nnoremap <buffer> h :h vundle<CR>
nnoremap <buffer> ? :norm h<CR>

nnoremap <buffer> c :PluginClean<CR>
nnoremap <buffer> C :PluginClean!<CR>

nnoremap <buffer> s :PluginSearch
nnoremap <buffer> R :call vundle#scripts#reload()<CR>

" goto first line after headers
exec ':'.(len(a:headers) + 1)
endf


" ---------------------------------------------------------------------------
" Load the plugin database from vim-scripts.org .
"
" to -- the filename (string) to save the database to
" return -- 0 on success, 1 if an error occurred
" ---------------------------------------------------------------------------
func! s:fetch_scripts(to)
let scripts_dir = fnamemodify(expand(a:to, 1), ":h")
if !isdirectory(scripts_dir)
call mkdir(scripts_dir, "p")
endif

let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json'
if executable("curl")
let cmd = 'curl --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json
elseif executable("wget")
let temp = vundle#installer#shellesc(tempname())
let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to)
if (has('win32') || has('win64'))
let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag
let cmd = vundle#installer#shellesc(cmd)
end
else
echoerr 'Error curl or wget is not available!'
return 1
endif

call system(cmd)

if (0 != v:shell_error)
echoerr 'Error fetching scripts!'
return v:shell_error
endif
return 0
endf


" ---------------------------------------------------------------------------
" Load the plugin database and return a list of all plugins.
"
" bang -- if 1 download the redatabase, else only download if it is not
" readable on disk (i.e. does not exist)
" return -- a list of strings, these are the names (valid bundle
" specifications) of all plugins from vim-scripts.org
" ---------------------------------------------------------------------------
func! s:load_scripts(bang)
let f = expand(g:bundle_dir.'/.vundle/script-names.vim-scripts.org.json', 1)
if a:bang || !filereadable(f)
if 0 != s:fetch_scripts(f)
return []
end
endif
return eval(readfile(f, 'b')[0])
endf

" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl:

+ 22
- 0
dotfiles/vim/bundle/Vundle.vim/changelog.md Bestand weergeven

@@ -0,0 +1,22 @@
Change Log
==========
F = Feature, B = Bug Fix, D = Doc Change

### Version 0.10.2

- B: #430 Put user script directories before system directories in rtp
- B: #455 Rename functions that start with `g:` + lowercase letter (Vim patch 7.4.264)

### Version 0.10.1
- B: #451 Escape spaces when handling rtp directories

### Version 0.10
- F: #415 Support plugin pinning (for non-git repos & preventing updates)
- F: #440 Detect plugin name collisions
- F: #418 Deferred rtp manipulation (speeds up start)
- B: #418 Leave default rtp directories (i.e. ~/.vim) where they should be
- B: #429 Fix newline character in log
- B: #440 Detect changed remotes & update repos
- D: #435 Image update in README.md
- D: #419 Add function documentation
- D: #436 Rename vundle to Vundle.vim, add modelines, quickstart update

+ 38
- 0
dotfiles/vim/bundle/Vundle.vim/doc/tags Bestand weergeven

@@ -0,0 +1,38 @@
:Bundle vundle.txt /*:Bundle*
:BundleClean! vundle.txt /*:BundleClean!*
:BundleInstall! vundle.txt /*:BundleInstall!*
:BundleList vundle.txt /*:BundleList*
:BundleSearch vundle.txt /*:BundleSearch*
:BundleUpdate vundle.txt /*:BundleUpdate*
:Plugin vundle.txt /*:Plugin*
:PluginClean vundle.txt /*:PluginClean*
:PluginClean! vundle.txt /*:PluginClean!*
:PluginInstall vundle.txt /*:PluginInstall*
:PluginInstall! vundle.txt /*:PluginInstall!*
:PluginList vundle.txt /*:PluginList*
:PluginSearch vundle.txt /*:PluginSearch*
:PluginSearch! vundle.txt /*:PluginSearch!*
:PluginUpdate vundle.txt /*:PluginUpdate*
:VundleClean! vundle.txt /*:VundleClean!*
:VundleInstall! vundle.txt /*:VundleInstall!*
:VundleList vundle.txt /*:VundleList*
:VundleSearch vundle.txt /*:VundleSearch*
:VundleUpdate vundle.txt /*:VundleUpdate*
vundle vundle.txt /*vundle*
vundle-about vundle.txt /*vundle-about*
vundle-faq vundle.txt /*vundle-faq*
vundle-interactive vundle.txt /*vundle-interactive*
vundle-interface-change vundle.txt /*vundle-interface-change*
vundle-keymappings vundle.txt /*vundle-keymappings*
vundle-options vundle.txt /*vundle-options*
vundle-plugins vundle.txt /*vundle-plugins*
vundle-plugins-cleanup vundle.txt /*vundle-plugins-cleanup*
vundle-plugins-configure vundle.txt /*vundle-plugins-configure*
vundle-plugins-install vundle.txt /*vundle-plugins-install*
vundle-plugins-list vundle.txt /*vundle-plugins-list*
vundle-plugins-search vundle.txt /*vundle-plugins-search*
vundle-plugins-update vundle.txt /*vundle-plugins-update*
vundle-plugins-uris vundle.txt /*vundle-plugins-uris*
vundle-quickstart vundle.txt /*vundle-quickstart*
vundle-windows vundle.txt /*vundle-windows*
vundle.txt vundle.txt /*vundle.txt*

+ 397
- 0
dotfiles/vim/bundle/Vundle.vim/doc/vundle.txt Bestand weergeven

@@ -0,0 +1,397 @@
*vundle.txt* Vundle, a plug-in manager for Vim. *vundle*

VUNDLE MANUAL

1. About Vundle |vundle-about|
2. Quick Start |vundle-quickstart|
3. Plugins |vundle-plugins|
3.1. Configuring Plugins |vundle-plugins-configure|
3.2. Supported URIs |vundle-plugins-uris|
3.3. Installing Plugins |vundle-plugins-install|
3.4. Updating Plugins |vundle-plugins-update|
3.5. Searching Plugins |vundle-plugins-search|
3.6. Listing Plugins |vundle-plugins-list|
3.7. Cleaning Up |vundle-plugins-cleanup|
4. Interactive Mode |vundle-interactive|
5. Key Mappings |vundle-keymappings|
6. Options |vundle-options|
7. Plugin Interface Change |vundle-interface-change|

=============================================================================
1. ABOUT VUNDLE ~
*vundle-about*

Vundle is short for Vim bundle and is a Vim plugin manager.

Vundle allows you to...

- keep track of and configure your scripts right in the `.vimrc`
- install configured scripts (a.k.a. bundle)
- update configured scripts
- search by name all available Vim scripts
- clean unused scripts up
- run the above actions in a single keypress with interactive mode

Vundle automatically...

- manages the runtime path of your installed scripts
- regenerates help tags after installing and updating

Vundle's search uses http://vim-scripts.org to provide a list of all
available Vim scripts.

Vundle is undergoing an interface change, see |vundle-interface-change| for
more information.

=============================================================================
2. QUICK START ~
*vundle-quickstart*

1. Introduction:

Installation requires `Git` and triggers git clone for each configured
repository to `~/.vim/bundle/` by default. Curl is required for search.

*vundle-windows*
If you are using Windows, see instructions on the Wiki
https://github.com/gmarik/Vundle.vim/wiki/Vundle-for-Windows.

*vundle-faq*
If you run into any issues, please consult the FAQ at
https://github.com/gmarik/Vundle.vim/wiki

2. Setup Vundle:
>
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
<
3. Configure bundles:

Put this at the top of your `.vimrc` to use Vundle. Remove bundles you
don't need, they are for illustration purposes.
>
set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

4. Install configured bundles:

Launch vim and run
>
:PluginInstall
<
To install from command line:
>
vim +PluginInstall +qall

=============================================================================
3. PLUGINS ~
*vundle-plugins*

3.1 CONFIGURING PLUGINS ~
*vundle-plugins-configure* *:Plugin*

Vundle tracks what plugins you want configured by the `Plugin` commands in your
`.vimrc`. Each `Plugin` command tells Vundle to activate the script on startup
adding it to your |runtimepath|. Commenting out or removing the line will
disable the `Plugin`.

Each `Plugin` command takes a URI pointing to the script. No comments should
follow on the same line as the command. Example:
>
Plugin 'git_URI'

The `Plugin` command can optionally take a second argument after the URI. It
has to be a dictionary, separated from the URI by a comma. Each key-value pair
in the dictionary is a configuration option.

The following per-script configuration options are available.

The 'rtp' option
----------------

Specifies a directory inside the repository (relative path from the root of
the repository) where the vim plugin resides. It determines the path that will
be added to the |runtimepath|.

For example:
>
Plugin 'git_URI', {'rtp': 'some/subdir/'}

This can be used with git repositories that put the vim plugin inside a
subdirectory.

The 'name' option
-----------------

The name of the directory that will hold the local clone of the configured
script.

For example:
>
Plugin 'git_URI', {'name': 'newPluginName'}

This can be used to prevent name collisions between plugins that Vundle would
otherwise try to clone into the same directory. It also provides an additional
level of customisation.

The 'pinned' option
-------------------

A flag that, when set to a value of 1, tells Vundle not to perform any git
operations on the plugin, while still adding the existing plugin under the
`bundles` directories to the |runtimepath|.

For example:
>
Plugin 'mylocalplugin', {'pinned': 1}

This allows the users to include, with Vundle, plugins tracked with version
control systems other than git, but the user is responsible for cloning and
keeping up to date. It also allows the users to stay in the current version of
a plugin that might have previously been updated by Vundle.

Please note that the URI will be treated the same as for any other plugins, so
only the last part of it will be added to the |runtimepath|. The user is
advised to use this flag only with single word URIs to avoid confusion.

3.2 SUPPORTED URIS ~
*vundle-plugins-uris*

`Vundle` integrates very well with both GitHub and vim-scripts.org
(http://vim-scripts.org/vim/scripts.html) allowing short URIs. It also allows
the use of any URI `git` recognizes. In all of the following cases (except
local) the 'https' protocol is used, see Vundle's options to override this.

More information on `git`'s protocols can be found at:
http://git-scm.com/book/ch4-1.html

GitHub
------
GitHub is used when a user/repo is passed to `Plugin`.
>
Plugin 'gmarik/Vundle.vim' => https://github.com/gmarik/Vundle.vim

Vim Scripts
-----------
Any single word without a slash '/' is assumed to be from Vim Scripts.
>
Plugin 'ctrlp.vim' => https://github.com/vim-scripts/ctrlp.vim

Other Git URIs
--------------
No modification is performed on valid URIs that point outside the above
URLs.
>
Plugin 'git://git.wincent.com/command-t.git'

Local Plugins
-------------
The git protocol supports local installation using the 'file://' protocol.
This is handy when developing plugins locally. Follow the protocol with an
absolute path to the script directory.
>
Plugin 'file:///path/from/root/to/plugin'

3.3 INSTALLING PLUGINS ~
*vundle-plugins-install* *:PluginInstall*
>
:PluginInstall

Will install all plugins configured in your `.vimrc`. Newly installed
plugins will be automatically enabled. Some plugins may require extra steps
such as compilation or external programs, refer to their documentation.

PluginInstall allows installation of plugins by name:
>
:PluginInstall unite.vim

Installs and activates unite.vim. You can use Tab to auto-complete known
script names. Note that the installation just described isn't permanent. To
finish, you must put `Plugin 'unite.vim'` at the appropriate place in your
`.vimrc` to tell Vundle to load the plugin at startup.

After installing plugins press 'l' (lowercase 'L') to see the log of commands
if any errors occurred.

3.4 UPDATING PLUGINS ~
*vundle-plugins-update* *:PluginUpdate* *:PluginInstall!*
>
:PluginInstall! " NOTE: bang(!)
or >
:PluginUpdate

Installs or updates the configured plugins. Press 'u' after updates complete
to see the change log of all updated bundles. Press 'l' (lowercase 'L') to
see the log of commands if any errors occurred.

3.5 SEARCHING PLUGINS ~
*vundle-plugins-search* *:PluginSearch*
>
:PluginSearch

Search requires that `curl` be available on the system. The command searches
Vim Scripts (http://vim-scripts.org/vim/scripts.html) for matching
plugins. Results display in a new split window. For example:
>
PluginSearch foo

displays:
>
"Search results for: foo
Plugin 'MarkdownFootnotes'
Plugin 'VimFootnotes'
Plugin 'foo.vim'
<
*:PluginSearch!*
Alternatively, you can refresh the script list before searching by adding a
bang to the command.
>
:PluginSearch! foo

If the command is run without argument:
>
:PluginSearch!

it will display all known plugins in the new split.

3.6 LISTING BUNDLES ~
*vundle-plugins-list* *:PluginList*
>
:PluginList

Displays a list of installed bundles.

3.7 CLEANING UP ~
*vundle-plugins-cleanup* *:PluginClean*
>
:PluginClean

Requests confirmation for the removal of all plugins no longered configured
in your `.vimrc` but present in your bundle installation directory
(default: `.vim/bundle/`).

*:PluginClean!*
>
:PluginClean!

Automatically confirm removal of unused bundles.

=============================================================================
4. INTERACTIVE MODE ~
*vundle-interactive*

Vundle provides a simple interactive mode to help you explore new plugins
easily. Interactive mode is available after any command that lists `Plugins`
such as PluginSearch, PluginList or Plugins. For instance:
>
:PluginSearch! unite

Searches for plugins matching 'unite' and yields a split window with:
>
"Keymap: i - Install bundle; c - Cleanup; s - Search; R - Reload list
"Search results for: unite
Plugin 'unite-scriptenames'
Plugin 'unite.vim'
Plugin 'unite-yarm'
Plugin 'unite-gem'
Plugin 'unite-locate'
Plugin 'unite-font'
Plugin 'unite-colorscheme'

To install a bundle, move your cursor to the Plugin of interest and then
select a command. To install 'unite.vim' put your cursor on the line and
then push `i`. For a more complete list see |vundle-keymappings|. After
unite.vim is installed the `:Unite file` command should be available.

Note: Interactive installation doesn't update your `.vimrc`.

=============================================================================
5. KEY MAPPINGS ~
*vundle-keymappings*

KEY | DESCRIPTION
----|-------------------------- >
i | run :PluginInstall with name taken from line cursor is positioned on
I | same as i, but runs :PluginInstall! to update bundle
D | delete selected bundle (be careful not to remove local modifications)
c | run :PluginClean
s | run :PluginSearch
R | fetch fresh script list from server

=============================================================================
6. OPTIONS ~
*vundle-options*
>
let g:vundle_default_git_proto = 'git'
<
This option makes Vundle use `git` instead of `https` when building
absolute URIs. For example:
>
Plugin 'sjl/gundo.vim' -> git@github.com:sjl/gundo.git

=============================================================================
7. VUNDLE INTERFACE CHANGE ~
*vundle-interface-change* *:Bundle* *:BundleInstall!*
*:BundleUpdate* *:BundleSearch* *:BundleList* *:BundleClean!*
*:VundleInstall!* *:VundleUpdate* *:VundleSearch*
*:VundleList* *:VundleClean!*

In order to bring in new changes, Vundle is adopting a new interface.
Going forward we will support primarily the Plugin namespace, additionally
for convenience we will also alias some commands to the Vundle namespace.
The following table summarizes the interface changes.

Deprecated Names | New Names
-----------------------------
Bundle | Plugin
BundleInstall(!) | PluginInstall(!), VundleInstall(!)
BundleUpdate | PluginUpdate, VundleUpdate
BundleSearch(!) | PluginSearch(!), VundleSearch(!)
BundleClean | PluginClean(!), VundleClean(!)
BundleList | PluginList

Note: The Bundle commands will be deprecated. You may continue using them,
but they may not get all future updates. For instance, we have enabled
comments on Plugin lines but not Bundle, since it requires a change in
command declaration.

" vim: set expandtab sts=2 ts=2 sw=2 tw=78 ft=help norl:

+ 20
- 0
dotfiles/vim/bundle/Vundle.vim/test/files/test.erl Bestand weergeven

@@ -0,0 +1,20 @@
-module(mmc_logmon_sup).
-behaviour(supervisor).
-export([init/1]).

init(_) ->
{ok, {
{one_for_one, 5, 1},
[
{listener,
{aaa, start_link, []},
permanent, 100, worker,
[aaa]
},
{server,
{bbb, start_link, []},
permanent, 100, worker,
[bbb]
}
]
}}.

+ 8
- 0
dotfiles/vim/bundle/Vundle.vim/test/minirc.vim Bestand weergeven

@@ -0,0 +1,8 @@
set nocompatible
syntax on
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
Bundle 'gmarik/Vundle.vim'
filetype plugin indent on


+ 81
- 0
dotfiles/vim/bundle/Vundle.vim/test/vimrc Bestand weergeven

@@ -0,0 +1,81 @@
" vim -u test/vimrc
set nocompatible

set nowrap

let bundle_dir = '/tmp/vundle-test/bundles/'
" let src = 'http://github.com/gmarik/vundle.git'

" Vundle Options
" let g:vundle_default_git_proto = 'git'

silent execute '!mkdir -p '.bundle_dir
silent execute '!ln -f -s ~/.vim/bundle/Vundle.vim '.bundle_dir

filetype off
syntax on

runtime macros/matchit.vim

" This test should be executed in "test" directory
exec 'set rtp^='.bundle_dir.'Vundle.vim/'

call vundle#rc(bundle_dir)


Plugin 'molokai' " vim-scripts name

" github username with dashes
Bundle 'vim-scripts/ragtag.vim'

" original repo
Bundle 'altercation/vim-colors-solarized'
" with extension
Bundle 'nelstrom/vim-mac-classic-theme.git'
"
" invalid uri
"Bundle 'nonexistinguser/yupppierepo.git'

" full uri
Bundle 'https://github.com/vim-scripts/vim-game-of-life'
" full uri
Bundle 'git@github.com:gmarik/ingretu.git'
" short uri
Bundle 'gh:gmarik/snipmate.vim.git'
Bundle 'github:mattn/gist-vim.git'

" local uri stuff
Bundle '~/Dropbox/.gitrepos/utilz.vim.git'
" Bundle 'file://Dropbox/.gitrepos/utilz.vim.git'

" with options
Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'}
Bundle 'matchit.zip', {'name': 'matchit'}

" Camel case
Bundle 'vim-scripts/RubySinatra'

" syntax issue #203
Bundle 'jimenezrick/vimerl'

" Static bundle: Same name as a valid vim-scripts bundle
Bundle 'latte', {'pinned' : 1}
if !isdirectory(expand(bundle_dir) . '/latte')
call mkdir(expand(bundle_dir) . '/latte', 'p')
endif


filetype plugin indent on " Automatically detect file types.

set wildignore+=doc " should not break helptags
set wildignore+=.git " should not break clone
set wildignore+=.git/* " should not break clone
set wildignore+=*/.git/*
" TODO: helptags fails with this
" set wildignore+=doc/* " should not break clone
" set wildignore+=*/doc/*

au VimEnter * BundleInstall

" e test/files/erlang.erl
" vim: set expandtab sts=2 ts=2 sw=2 tw=78:

+ 0
- 1
dotfiles/vim/bundle/vim-coffee-script

@@ -1 +0,0 @@
Subproject commit 827e4a38b07479433b619091469a7495a392df8a

+ 15
- 0
dotfiles/vim/bundle/vim-coffee-script/Copying.md Bestand weergeven

@@ -0,0 +1,15 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2010 to 2014 Mick Koch <mick@kochm.co>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.



+ 25
- 0
dotfiles/vim/bundle/vim-coffee-script/Makefile Bestand weergeven

@@ -0,0 +1,25 @@
REF = HEAD
VERSION = $(shell git describe --always $(REF))

ARCHIVE = vim-coffee-script-$(VERSION).zip
ARCHIVE_DIRS = after autoload compiler doc ftdetect ftplugin indent syntax

# Don't do anything by default.
all:

# Make vim.org zipball.
archive:
git archive $(REF) -o $(ARCHIVE) -- $(ARCHIVE_DIRS)

# Remove zipball.
clean:
-rm -f $(ARCHIVE)

# Build the list of syntaxes for @coffeeAll.
coffeeAll:
@grep -E 'syn (match|region)' syntax/coffee.vim |\
grep -v 'contained' |\
awk '{print $$3}' |\
uniq

.PHONY: all archive clean hash coffeeAll

+ 22
- 0
dotfiles/vim/bundle/vim-coffee-script/News.md Bestand weergeven

@@ -0,0 +1,22 @@
### Version 003 (October 10, 2014)

Almost 3 years' worth of fixes and (hopefully) improvements.

### Version 002 (December 5, 2011)

Added binary numbers (0b0101) and fixed some bugs (#9, #62, #63, #65).

### Version 001 (October 18, 2011)

Removed deprecated `coffee_folding` option, added `coffee_compile_vert` option,
split out compiler, fixed indentation and syntax bugs, and added Haml support
and omnicompletion.

- The coffee compiler is now a proper vim compiler that can be loaded with
`:compiler coffee`.
- The `coffee_compile_vert` option can now be set to split the CoffeeCompile
buffer vertically by default.
- CoffeeScript is now highlighted inside the `:coffeescript` filter in Haml.
- Omnicompletion (`:help compl-omni`) now uses JavaScript's dictionary to
complete words.
- We now have a fancy version number.

+ 599
- 0
dotfiles/vim/bundle/vim-coffee-script/Readme.md Bestand weergeven

@@ -0,0 +1,599 @@
This project adds [CoffeeScript] support to vim. It covers syntax, indenting,
compiling, and more.

![Screenshot](http://i.imgur.com/j1BhpZQ.png)

[CoffeeScript]: http://coffeescript.org/

## Table of Contents

- Installation
- [Requirements](#requirements)
- [Install using Pathogen](#install-using-pathogen)
- [Install using Vundle](#install-using-vundle)
- [Install from a Zip File](#install-from-a-zip-file)
- Coffee Commands
- [Compile to JavaScript](#compile-to-javascript)
- [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets)
- [Live Preview Compiling](#coffeewatch-live-preview-compiling)
- [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets)
- [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript)
- Extras
- [Literate CoffeeScript](#literate-coffeescript)
- [CoffeeScript in HTML](#coffeescript-in-html)
- [CoffeeScript in Haml](#coffeescript-in-haml)
- Configuration
- [Custom Autocmds](#custom-autocmds)
- [Configuration Variables](#configuration-variables)
- [Configure Syntax Highlighting](#configure-syntax-highlighting)
- [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript)

## Requirements

- vim 7.4 or later
- coffee 1.2.0 or later

## Install using Pathogen

This project uses rolling releases based on git commits, so pathogen is a
natural fit for it. If you're already using pathogen, you can skip to step 4.

1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's
readme][install-pathogen] for more information.)

[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332
[install-pathogen]: https://github.com/tpope/vim-pathogen#installation

2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables
all the features of `vim-coffee-script`:

```vim
call pathogen#infect()
syntax enable
filetype plugin indent on
```

If you already have a vimrc built up, just make sure it contains these calls,
in this order.

3. Create the directory `~/.vim/bundle/`:

mkdir ~/.vim/bundle

4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`:

git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/

Updating takes two steps:

1. Change into `~/.vim/bundle/vim-coffee-script/`:

cd ~/.vim/bundle/vim-coffee-script

2. Pull in the latest changes:

git pull

## Install using Vundle

1. [Install Vundle] into `~/.vim/bundle/`.

[Install Vundle]: https://github.com/gmarik/vundle#quick-start

2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all
the features of `vim-coffee-script`:


```vim
set nocompatible
filetype off

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Plugin 'kchmck/vim-coffee-script'

syntax enable
filetype plugin indent on
```

If you're adding Vundle to a built-up vimrc, just make sure all these calls
are in there and that they occur in this order.

3. Open vim and run `:PluginInstall`.

To update, open vim and run `:PluginInstall!` (notice the bang!)

## Install from a Zip File

1. Download the latest zip file from [vim.org][zip].

2. Extract the archive into `~/.vim/`:

unzip -od ~/.vim/ ARCHIVE.zip

This should create the files `~/.vim/autoload/coffee.vim`,
`~/.vim/compiler/coffee.vim`, etc.

You can update the plugin using the same steps.

[zip]: http://www.vim.org/scripts/script.php?script_id=3590

## Compile to JavaScript

A `coffee` wrapper for use with `:make` is enabled automatically for coffee
files if no other compiler is loaded. To enable it manually, run

:compiler coffee

The `:make` command is then configured to use the `coffee` compiler and
recognize its errors. I've included a quick reference here but be sure to check
out [`:help :make`][make] for a full reference of the command.

![make](http://i.imgur.com/scUXmxR.png)

![make Result](http://i.imgur.com/eGIjEdn.png)

[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg

Consider the full signature of a `:make` call as

:[silent] make[!] [COFFEE-OPTIONS]...

By default `:make` shows all compiler output and jumps to the first line
reported as an error. Compiler output can be hidden with a leading `:silent`:

:silent make

Line-jumping can be turned off by adding a bang:

:make!

`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also
[`coffee_make_options`](#coffee_make_options)):

:make --bare --output /some/dir

See the [full table of options](http://coffeescript.org/#usage) for a
list of all the options that `coffee` recognizes.

*Configuration*: [`coffee_compiler`](#coffee_compiler),
[`coffee_make_options`](#coffee_make_options)

#### The quickfix window

Compiler errors are added to the [quickfix] list by `:make`, but the quickfix
window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up
the quickfix window if there are any errors:

:make
:cwindow

This is usually the desired behavior, so you may want to add an autocmd to your
vimrc to do this automatically:

autocmd QuickFixCmdPost * nested cwindow | redraw!

The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but
can removed for gVim.

[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow

#### Recompile on write

To recompile a file when it's written, add a `BufWritePost` autocmd to your
vimrc:

autocmd BufWritePost *.coffee silent make!

#### Cake and Cakefiles

A `cake` compiler is also available with the call

:compiler cake

You can then use `:make` as above to run your Cakefile and capture any `coffee`
errors:

:silent make build

It runs within the current directory, so make sure you're in the directory of
your Cakefile before calling it.

*Configuration*: [`coffee_cake`](#coffee_cake),
[`coffee_cake_options`](#coffee_cake_options)

## CoffeeCompile: Compile CoffeeScript Snippets

CoffeeCompile shows how the current file or a snippet of CoffeeScript is
compiled to JavaScript.

:[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE]

Calling `:CoffeeCompile` without a range compiles the whole file:

![CoffeeCompile](http://i.imgur.com/0zFG0l0.png)

![CoffeeCompile Result](http://i.imgur.com/bpiAxaa.png)

Calling it with a range, like in visual mode, compiles only the selected snippet
of CoffeeScript:

![CoffeeCompile Snippet](http://i.imgur.com/x3OT3Ay.png)

![Compiled Snippet](http://i.imgur.com/J02j4T8.png)

Each file gets its own CoffeeCompile buffer, and the same buffer is used for all
future calls of `:CoffeeCompile` on that file. It can be quickly closed by
hitting `q` in normal mode.

Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally
(see also [`coffee_compile_vert`](#coffee_compile_vert)):

:CoffeeCompile vert

By default the CoffeeCompile buffer splits the source buffer in half, but this
can be overridden by passing in a `WINDOW-SIZE`:

:CoffeeCompile 4

*Configuration*: [`coffee_compiler`](#coffee_compiler`),
[`coffee_compile_vert`](#coffee_compile_vert)

#### Quick syntax checking

If compiling a snippet results in a compiler error, CoffeeCompile adds that
error to the [quickfix] list.

[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix

![Syntax Checking](http://i.imgur.com/RC8accF.png)

![Syntax Checking Result](http://i.imgur.com/gi1ON75.png)

You can use this to quickly check the syntax of a snippet.

## CoffeeWatch: Live Preview Compiling

CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript
homepage][CoffeeScript].

![CoffeeWatch](http://i.imgur.com/TRHdIMG.png)

![CoffeeWatch Result](http://i.imgur.com/rJbOeeS.png)

CoffeeWatch takes the same options as CoffeeCompile:

:CoffeeWatch [vert[ical]] [WINDOW-SIZE]

After a source buffer is watched, leaving insert mode or saving the file fires
off a recompile of the CoffeeScript:

![Insert Mode](http://i.imgur.com/SBVcf4k.png)

![Recompile](http://i.imgur.com/pbPMog7.png)

You can force recompilation by calling `:CoffeeWatch`.

To get synchronized scrolling of the source buffer and CoffeeWatch buffer, set
[`'scrollbind'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'scrollbind')
on each:

:setl scrollbind

*Configuration*: [`coffee_compiler`](#coffee_compiler),
[`coffee_watch_vert`](#coffee_watch_vert)

## CoffeeRun: Run CoffeeScript Snippets

CoffeeRun compiles the current file or selected snippet and runs the resulting
JavaScript.

![CoffeeRun](http://i.imgur.com/YSkHUuQ.png)

![CoffeeRun Output](http://i.imgur.com/wZQbggN.png)

The command has two forms:

:CoffeeRun [PROGRAM-OPTIONS]...

This form applies when no `RANGE` is given or when the given range is `1,$`
(first line to last line). It allows passing `PROGRAM-OPTIONS` to your compiled
program. The filename is passed directly to `coffee` so you must save the file
for your changes to take effect.

:RANGE CoffeeRun [COFFEE-OPTIONS]...

This form applies with all other ranges. It compiles and runs the lines within
the given `RANGE` and any extra `COFFEE-OPTIONS` are passed to `coffee`.

*Configuration*: [`coffee_compiler`](#coffee_compiler),
[`coffee_run_vert`](#coffee_run_vert)

## CoffeeLint: Lint your CoffeeScript

CoffeeLint runs [coffeelint](http://www.coffeelint.org/) (version 1.4.0 or later
required) on the current file and adds any issues to the [quickfix] list.

![CoffeeLint](http://i.imgur.com/UN8Nr5N.png)

![CoffeeLint Result](http://i.imgur.com/9hSIj3W.png)

:[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]... [ | cwindow]

If a `RANGE` is given, only those lines are piped to `coffeelint`. Options given
in `COFFEELINT-OPTIONS` are passed to `coffeelint` (see also
[`coffee_lint_options`](#coffee_lint_options)):

:CoffeeLint -f lint.json

It behaves very similar to `:make`, described [above](#compile-to-javascript).

:CoffeeLint! | cwindow

*Configuration*: [`coffee_linter`](#coffee_linter),
[`coffee_lint_options`](#coffee_lint_options)

## Literate CoffeeScript

Literate CoffeeScript syntax and indent support is provided by
[vim-literate-coffeescript]. The `Coffee` commands detect when they're running
on a litcoffee file and pass the `--literate` flag to their respective tools,
but at this time the commands are not automatically loaded when a litcoffee file
is opened.

[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript

To load them, run

runtime ftplugin/coffee.vim

while inside a litcoffee buffer. To do this automatically, add

autocmd FileType litcoffee runtime ftplugin/coffee.vim

to your vimrc.

## CoffeeScript in HTML

CoffeeScript is highlighted and indented within

```html
<script type="text/coffeescript">
</script>
```

blocks in html files.

## CoffeeScript in Haml

CoffeeScript is highlighted within the `:coffeescript` filter in haml files:

```haml
:coffeescript
console.log "hullo"
```

At this time, coffee indenting doesn't work in these blocks.

## Custom Autocmds

You can [define commands][autocmd-explain] to be ran automatically on these
custom events.

In all cases, the name of the command running the event (`CoffeeCompile`,
`CoffeeWatch`, or `CoffeeRun`) is matched by the [`{pat}`][autocmd] argument.
You can match all commands with a `*` or only specific commands by separating
them with a comma: `CoffeeCompile,CoffeeWatch`.

[autocmd-explain]: http://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.3
[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd

#### CoffeeBufNew

CoffeeBufNew is ran when a new scratch buffer is created. It's called from the
new buffer, so it can be used to do additional set up.

```vim
augroup CoffeeBufNew
autocmd User * set wrap
augroup END
```

*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun

#### CoffeeBufUpdate

CoffeeBufUpdate is ran when a scratch buffer is updated with output from
`coffee`. It's called from the scratch buffer, so it can be used to alter the
compiled output.

```vim
" Switch back to the source buffer after updating.
augroup CoffeeBufUpdate
autocmd User CoffeeCompile,CoffeeRun exec bufwinnr(b:coffee_src_buf) 'wincmd w'
augroup END
```

For example, to strip off the "Generated by" comment on the first line, put this
in your vimrc:

```vim
function! s:RemoveGeneratedBy()
" If there was an error compiling, there's no comment to remove.
if v:shell_error
return
endif

" Save cursor position.
let pos = getpos('.')

" Remove first line.
set modifiable
1 delete _
set nomodifiable

" Restore cursor position.
call setpos('.', pos)
endfunction

augroup CoffeeBufUpdate
autocmd User CoffeeCompile,CoffeeWatch call s:RemoveGeneratedBy()
augroup END
```

*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun

## Configuration Variables

This is the full list of configuration variables available, with example
settings and default values. Use these in your vimrc to control the default
behavior.

#### coffee\_indent\_keep\_current

By default, the indent function matches the indent of the previous line if it
doesn't find a reason to indent or outdent. To change this behavior so it
instead keeps the [current indent of the cursor][98], use

let coffee_indent_keep_current = 1

[98]: https://github.com/kchmck/vim-coffee-script/pull/98

*Default*: `unlet coffee_indent_keep_current`

Note that if you change this after a coffee file has been loaded, you'll have to
reload the indent script for the change to take effect:

unlet b:did_indent | runtime indent/coffee.vim

#### coffee\_compiler

Path to the `coffee` executable used by the `Coffee` commands:

let coffee_compiler = '/usr/bin/coffee'

*Default*: `'coffee'` (search `$PATH` for executable)

#### coffee\_make\_options

Options to pass to `coffee` with `:make`:

let coffee_make_options = '--bare'

*Default*: `''` (nothing)

Note that `coffee_make_options` is embedded into `'makeprg'`, so `:compiler
coffee` must be ran after changing `coffee_make_options` for the changes to take
effect.

#### coffee\_cake

Path to the `cake` executable:

let coffee_cake = '/opt/bin/cake'

*Default*: `'cake'` (search `$PATH` for executable)

#### coffee\_cake\_options

Options to pass to `cake` with `:make`:

let coffee_cake_options = 'build'

*Default*: `''` (nothing)

#### coffee\_linter

Path to the `coffeelint` executable:

let coffee_linter = '/opt/bin/coffeelint'

*Default*: `'coffeelint'` (search `$PATH` for executable)

#### coffee\_lint\_options

Options to pass to `coffeelint`:

let coffee_lint_options = '-f lint.json'

*Default*: `''` (nothing)

#### coffee\_compile\_vert

Open the CoffeeCompile buffer with a vertical split instead of a horizontal
one:

let coffee_compile_vert = 1

*Default*: `unlet coffee_compile_vert`

#### coffee\_watch\_vert

Open the CoffeeWatch buffer with a vertical split instead of a horizontal
one:

let coffee_watch_vert = 1

*Default*: `unlet coffee_watch_vert`

#### coffee\_run\_vert

Open the CoffeeRun buffer with a vertical split instead of a horizontal
one:

let coffee_run_vert = 1

*Default*: `unlet coffee_run_vert`

## Configure Syntax Highlighting

Add these lines to your vimrc to disable the relevant syntax group.

#### Disable trailing whitespace error

Trailing whitespace is highlighted as an error by default. This can be disabled
with:

hi link coffeeSpaceError NONE

#### Disable trailing semicolon error

Trailing semicolons are considered an error (for help transitioning from
JavaScript.) This can be disabled with:

hi link coffeeSemicolonError NONE

#### Disable reserved words error

Reserved words like `function` and `var` are highlighted as an error where
they're not allowed in CoffeeScript. This can be disabled with:

hi link coffeeReservedError NONE

## Tune Vim for CoffeeScript

Changing these core settings can make vim more CoffeeScript friendly.

#### Fold by indentation

Folding by indentation works well for CoffeeScript functions and classes:

![Folding](http://i.imgur.com/gDgUBdO.png)

To fold by indentation in CoffeeScript files, add this line to your vimrc:

autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable

With this, folding is disabled by default but can be quickly toggled per-file
by hitting `zi`. To enable folding by default, remove `nofoldenable`:

autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent

#### Two-space indentation

To get standard two-space indentation in CoffeeScript files, add this line to
your vimrc:

autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab

+ 44
- 0
dotfiles/vim/bundle/vim-coffee-script/Thanks.md Bestand weergeven

@@ -0,0 +1,44 @@
Thanks to all bug reporters, and special thanks to those who have contributed
code:

Brian Egan (brianegan):
Initial compiling support

Ches Martin (ches):
Initial vim docs

Chris Hoffman (cehoffman):
Add new keywoards from, to, and do
Highlight the - in negative integers
Add here regex highlighting, increase fold level for here docs

David Wilhelm (bigfish):
CoffeeRun command

Jay Adkisson (jayferd):
Support for eco templates

Karl Guertin (grayrest)
Cakefiles are coffeescript

Maciej Konieczny (narfdotpl):
Fix funny typo

Matt Sacks (mattsa):
Javascript omni-completion
coffee_compile_vert option

Nick Stenning (nickstenning):
Fold by indentation for coffeescript

Simon Lipp (sloonz):
Trailing spaces are not error on lines containing only spaces

Stéphan Kochen (stephank):
Initial HTML CoffeeScript highlighting

Sven Felix Oberquelle (Svelix):
Haml CoffeeScript highlighting

Wei Dai (clvv):
Fix the use of Vim built-in make command.

+ 1
- 0
dotfiles/vim/bundle/vim-coffee-script/Todo.md Bestand weergeven

@@ -0,0 +1 @@
- Don't highlight bad operator combinations

+ 33
- 0
dotfiles/vim/bundle/vim-coffee-script/after/indent/html.vim Bestand weergeven

@@ -0,0 +1,33 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" Load the coffee and html indent functions.
silent! unlet b:did_indent
runtime indent/coffee.vim
let s:coffeeIndentExpr = &l:indentexpr

" Load html last so it can overwrite coffee settings.
silent! unlet b:did_indent
runtime indent/html.vim
let s:htmlIndentExpr = &l:indentexpr

" Inject our wrapper indent function.
setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)

function! GetCoffeeHtmlIndent(curlinenum)
" See if we're inside a coffeescript block.
let scriptlnum = searchpair('<script [^>]*type="text/coffeescript"[^>]*>', '',
\ '</script>', 'bWn')
let prevlnum = prevnonblank(a:curlinenum)

" If we're in the script block and the previous line isn't the script tag
" itself, use coffee indenting.
if scriptlnum && scriptlnum != prevlnum
exec 'return ' s:coffeeIndentExpr
endif

" Otherwise use html indenting.
exec 'return ' s:htmlIndentExpr
endfunction

+ 13
- 0
dotfiles/vim/bundle/vim-coffee-script/after/syntax/haml.vim Bestand weergeven

@@ -0,0 +1,13 @@
" Language: CoffeeScript
" Maintainer: Sven Felix Oberquelle <Svelix.Github@gmail.com>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" Inherit coffee from html so coffeeComment isn't redefined and given higher
" priority than hamlInterpolation.
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
syn region hamlCoffeescriptFilter matchgroup=hamlFilter
\ start="^\z(\s*\):coffee\z(script\)\?\s*$"
\ end="^\%(\z1 \| *$\)\@!"
\ contains=@hamlCoffeeScript,hamlInterpolation
\ keepend

+ 11
- 0
dotfiles/vim/bundle/vim-coffee-script/after/syntax/html.vim Bestand weergeven

@@ -0,0 +1,11 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" Syntax highlighting for text/coffeescript script tags
syn include @htmlCoffeeScript syntax/coffee.vim
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
\ end=#</script>#me=s-1 keepend
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
\ containedin=htmlHead

+ 54
- 0
dotfiles/vim/bundle/vim-coffee-script/autoload/coffee.vim Bestand weergeven

@@ -0,0 +1,54 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" Set up some common global/buffer variables.
function! coffee#CoffeeSetUpVariables()
" Path to coffee executable
if !exists('g:coffee_compiler')
let g:coffee_compiler = 'coffee'
endif

" Options passed to coffee with make
if !exists('g:coffee_make_options')
let g:coffee_make_options = ''
endif

" Path to cake executable
if !exists('g:coffee_cake')
let g:coffee_cake = 'cake'
endif

" Extra options passed to cake
if !exists('g:coffee_cake_options')
let g:coffee_cake_options = ''
endif

" Path to coffeelint executable
if !exists('g:coffee_linter')
let g:coffee_linter = 'coffeelint'
endif

" Options passed to CoffeeLint
if !exists('g:coffee_lint_options')
let g:coffee_lint_options = ''
endif

" Pass the litcoffee flag to tools in this buffer if a litcoffee file is open.
" Let the variable be overwritten so it can be updated if a different filetype
" is set.
if &filetype == 'litcoffee'
let b:coffee_litcoffee = '--literate'
else
let b:coffee_litcoffee = ''
endif
endfunction

function! coffee#CoffeeSetUpErrorFormat()
CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l,
\Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m,
\SyntaxError:\ In\ %f\\,\ %m,
\%f:%l:%c:\ error:\ %m,
\%-G%.%#
endfunction

+ 15
- 0
dotfiles/vim/bundle/vim-coffee-script/compiler/cake.vim Bestand weergeven

@@ -0,0 +1,15 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

if exists('current_compiler')
finish
endif

let current_compiler = 'cake'
call coffee#CoffeeSetUpVariables()

exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' .
\ g:coffee_cake_options . ' $*', ' ')
call coffee#CoffeeSetUpErrorFormat()

+ 82
- 0
dotfiles/vim/bundle/vim-coffee-script/compiler/coffee.vim Bestand weergeven

@@ -0,0 +1,82 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" All this is needed to support compiling filenames with spaces, quotes, and
" such. The filename is escaped and embedded into the `makeprg` setting.
"
" Because of this, `makeprg` must be updated on every file rename. And because
" of that, `CompilerSet` can't be used because it doesn't exist when the
" rename autocmd is ran. So, we have to do some checks to see whether `compiler`
" was called locally or globally, and respect that in the rest of the script.

if exists('current_compiler')
finish
endif

let current_compiler = 'coffee'
call coffee#CoffeeSetUpVariables()

" Pattern to check if coffee is the compiler
let s:pat = '^' . current_compiler

" Get a `makeprg` for the current filename.
function! s:GetMakePrg()
return g:coffee_compiler .
\ ' -c' .
\ ' ' . b:coffee_litcoffee .
\ ' ' . g:coffee_make_options .
\ ' $*' .
\ ' ' . fnameescape(expand('%'))
endfunction

" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
function! s:SetMakePrg()
if &l:makeprg =~ s:pat
let &l:makeprg = s:GetMakePrg()
elseif &g:makeprg =~ s:pat
let &g:makeprg = s:GetMakePrg()
else
return 0
endif

return 1
endfunction

" Set a dummy compiler so we can check whether to set locally or globally.
exec 'CompilerSet makeprg=' . current_compiler
" Then actually set the compiler.
call s:SetMakePrg()
call coffee#CoffeeSetUpErrorFormat()

function! s:CoffeeMakeDeprecated(bang, args)
echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' .
\ 'is identical.'
sleep 5
exec 'make' . a:bang a:args
endfunction

" Compile the current file.
command! -bang -bar -nargs=* CoffeeMake
\ call s:CoffeeMakeDeprecated(<q-bang>, <q-args>)

" Set `makeprg` on rename since we embed the filename in the setting.
augroup CoffeeUpdateMakePrg
autocmd!

" Update `makeprg` if coffee is still the compiler, else stop running this
" function.
function! s:UpdateMakePrg()
if !s:SetMakePrg()
autocmd! CoffeeUpdateMakePrg
endif
endfunction

" Set autocmd locally if compiler was set locally.
if &l:makeprg =~ s:pat
autocmd BufWritePre,BufFilePost <buffer> call s:UpdateMakePrg()
else
autocmd BufWritePre,BufFilePost call s:UpdateMakePrg()
endif
augroup END

+ 4
- 0
dotfiles/vim/bundle/vim-coffee-script/doc/coffee-script.txt Bestand weergeven

@@ -0,0 +1,4 @@
Please see the project readme for up-to-date docs:
https://github.com/kchmck/vim-coffee-script

vim:tw=78:ts=8:ft=help:norl:

+ 0
- 0
dotfiles/vim/bundle/vim-coffee-script/doc/tags Bestand weergeven


+ 17
- 0
dotfiles/vim/bundle/vim-coffee-script/ftdetect/coffee.vim Bestand weergeven

@@ -0,0 +1,17 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

autocmd BufNewFile,BufRead *.coffee set filetype=coffee
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
autocmd BufNewFile,BufRead *._coffee set filetype=coffee

function! s:DetectCoffee()
if getline(1) =~ '^#!.*\<coffee\>'
set filetype=coffee
endif
endfunction

autocmd BufNewFile,BufRead * call s:DetectCoffee()

+ 405
- 0
dotfiles/vim/bundle/vim-coffee-script/ftplugin/coffee.vim Bestand weergeven

@@ -0,0 +1,405 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

if exists('b:did_ftplugin')
finish
endif

let b:did_ftplugin = 1
call coffee#CoffeeSetUpVariables()

setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:# commentstring=#\ %s
setlocal omnifunc=javascriptcomplete#CompleteJS
setlocal suffixesadd+=coffee

" Create custom augroups.
augroup CoffeeBufUpdate | augroup END
augroup CoffeeBufNew | augroup END

" Enable coffee compiler if a compiler isn't set already.
if !len(&l:makeprg)
compiler coffee
endif

" Switch to the window for buf.
function! s:SwitchWindow(buf)
exec bufwinnr(a:buf) 'wincmd w'
endfunction

" Create a new scratch buffer and return the bufnr of it. After the function
" returns, vim remains in the scratch buffer so more set up can be done.
function! s:ScratchBufBuild(src, vert, size)
if a:size <= 0
if a:vert
let size = winwidth(bufwinnr(a:src)) / 2
else
let size = winheight(bufwinnr(a:src)) / 2
endif
endif

if a:vert
vertical belowright new
exec 'vertical resize' size
else
belowright new
exec 'resize' size
endif

setlocal bufhidden=wipe buftype=nofile nobuflisted noswapfile nomodifiable
nnoremap <buffer> <silent> q :hide<CR>

return bufnr('%')
endfunction

" Replace buffer contents with text and delete the last empty line.
function! s:ScratchBufUpdate(buf, text)
" Move to the scratch buffer.
call s:SwitchWindow(a:buf)

" Double check we're in the scratch buffer before overwriting.
if bufnr('%') != a:buf
throw 'unable to change to scratch buffer'
endif

setlocal modifiable
silent exec '% delete _'
silent put! =a:text
silent exec '$ delete _'
setlocal nomodifiable
endfunction

" Parse the output of coffee into a qflist entry for src buffer.
function! s:ParseCoffeeError(output, src, startline)
" Coffee error is always on first line?
let match = matchlist(a:output,
\ '^\(\f\+\|\[stdin\]\):\(\d\):\(\d\): error: \(.\{-}\)' . "\n")

if !len(match)
return
endif

" Consider the line number from coffee as relative and add it to the beginning
" line number of the range the command was called on, then subtract one for
" zero-based relativity.
call setqflist([{'bufnr': a:src, 'lnum': a:startline + str2nr(match[2]) - 1,
\ 'type': 'E', 'col': str2nr(match[3]), 'text': match[4]}], 'r')
endfunction

" Reset source buffer variables.
function! s:CoffeeCompileResetVars()
" Variables defined in source buffer:
" b:coffee_compile_buf: bufnr of output buffer
" Variables defined in output buffer:
" b:coffee_src_buf: bufnr of source buffer
" b:coffee_compile_pos: previous cursor position in output buffer

let b:coffee_compile_buf = -1
endfunction

function! s:CoffeeWatchResetVars()
" Variables defined in source buffer:
" b:coffee_watch_buf: bufnr of output buffer
" Variables defined in output buffer:
" b:coffee_src_buf: bufnr of source buffer
" b:coffee_watch_pos: previous cursor position in output buffer

let b:coffee_watch_buf = -1
endfunction

function! s:CoffeeRunResetVars()
" Variables defined in CoffeeRun source buffer:
" b:coffee_run_buf: bufnr of output buffer
" Variables defined in CoffeeRun output buffer:
" b:coffee_src_buf: bufnr of source buffer
" b:coffee_run_pos: previous cursor position in output buffer

let b:coffee_run_buf = -1
endfunction

" Clean things up in the source buffers.
function! s:CoffeeCompileClose()
" Switch to the source buffer if not already in it.
silent! call s:SwitchWindow(b:coffee_src_buf)
call s:CoffeeCompileResetVars()
endfunction

function! s:CoffeeWatchClose()
silent! call s:SwitchWindow(b:coffee_src_buf)
silent! autocmd! CoffeeAuWatch * <buffer>
call s:CoffeeWatchResetVars()
endfunction

function! s:CoffeeRunClose()
silent! call s:SwitchWindow(b:coffee_src_buf)
call s:CoffeeRunResetVars()
endfunction

" Compile the lines between startline and endline and put the result into buf.
function! s:CoffeeCompileToBuf(buf, startline, endline)
let src = bufnr('%')
let input = join(getline(a:startline, a:endline), "\n")

" Coffee doesn't like empty input.
if !len(input)
" Function should still return within output buffer.
call s:SwitchWindow(a:buf)
return
endif

" Pipe lines into coffee.
let output = system(g:coffee_compiler .
\ ' -scb' .
\ ' ' . b:coffee_litcoffee .
\ ' 2>&1', input)

" Paste output into output buffer.
call s:ScratchBufUpdate(a:buf, output)

" Highlight as JavaScript if there were no compile errors.
if v:shell_error
call s:ParseCoffeeError(output, src, a:startline)
setlocal filetype=
else
" Clear the quickfix list.
call setqflist([], 'r')
setlocal filetype=javascript
endif
endfunction

" Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this
" to prevent the cursor from being moved (and its position saved) before the
" function is called.
function! s:CoffeeCompile(startline, endline, args)
if a:args =~ '\<watch\>'
echoerr 'CoffeeCompile watch is deprecated! Please use CoffeeWatch instead'
sleep 5
call s:CoffeeWatch(a:args)
return
endif

" Switch to the source buffer if not already in it.
silent! call s:SwitchWindow(b:coffee_src_buf)

" Bail if not in source buffer.
if !exists('b:coffee_compile_buf')
return
endif

" Build the output buffer if it doesn't exist.
if bufwinnr(b:coffee_compile_buf) == -1
let src = bufnr('%')

let vert = exists('g:coffee_compile_vert') || a:args =~ '\<vert\%[ical]\>'
let size = str2nr(matchstr(a:args, '\<\d\+\>'))

" Build the output buffer and save the source bufnr.
let buf = s:ScratchBufBuild(src, vert, size)
let b:coffee_src_buf = src

" Set the buffer name.
exec 'silent! file [CoffeeCompile ' . src . ']'

" Clean up the source buffer when the output buffer is closed.
autocmd BufWipeout <buffer> call s:CoffeeCompileClose()
" Save the cursor when leaving the output buffer.
autocmd BufLeave <buffer> let b:coffee_compile_pos = getpos('.')

" Run user-defined commands on new buffer.
silent doautocmd CoffeeBufNew User CoffeeCompile

" Switch back to the source buffer and save the output bufnr. This also
" triggers BufLeave above.
call s:SwitchWindow(src)
let b:coffee_compile_buf = buf
endif

" Fill the scratch buffer.
call s:CoffeeCompileToBuf(b:coffee_compile_buf, a:startline, a:endline)
" Reset cursor to previous position.
call setpos('.', b:coffee_compile_pos)

" Run any user-defined commands on the scratch buffer.
silent doautocmd CoffeeBufUpdate User CoffeeCompile
endfunction

" Update the scratch buffer and switch back to the source buffer.
function! s:CoffeeWatchUpdate()
call s:CoffeeCompileToBuf(b:coffee_watch_buf, 1, '$')
call setpos('.', b:coffee_watch_pos)
silent doautocmd CoffeeBufUpdate User CoffeeWatch
call s:SwitchWindow(b:coffee_src_buf)
endfunction

" Continually compile a source buffer.
function! s:CoffeeWatch(args)
silent! call s:SwitchWindow(b:coffee_src_buf)

if !exists('b:coffee_watch_buf')
return
endif

if bufwinnr(b:coffee_watch_buf) == -1
let src = bufnr('%')

let vert = exists('g:coffee_watch_vert') || a:args =~ '\<vert\%[ical]\>'
let size = str2nr(matchstr(a:args, '\<\d\+\>'))

let buf = s:ScratchBufBuild(src, vert, size)
let b:coffee_src_buf = src

exec 'silent! file [CoffeeWatch ' . src . ']'

autocmd BufWipeout <buffer> call s:CoffeeWatchClose()
autocmd BufLeave <buffer> let b:coffee_watch_pos = getpos('.')

silent doautocmd CoffeeBufNew User CoffeeWatch

call s:SwitchWindow(src)
let b:coffee_watch_buf = buf
endif

" Make sure only one watch autocmd is defined on this buffer.
silent! autocmd! CoffeeAuWatch * <buffer>

augroup CoffeeAuWatch
autocmd InsertLeave <buffer> call s:CoffeeWatchUpdate()
autocmd BufWritePost <buffer> call s:CoffeeWatchUpdate()
augroup END

call s:CoffeeWatchUpdate()
endfunction

" Run a snippet of CoffeeScript between startline and endline.
function! s:CoffeeRun(startline, endline, args)
silent! call s:SwitchWindow(b:coffee_src_buf)

if !exists('b:coffee_run_buf')
return
endif

if bufwinnr(b:coffee_run_buf) == -1
let src = bufnr('%')

let buf = s:ScratchBufBuild(src, exists('g:coffee_run_vert'), 0)
let b:coffee_src_buf = src

exec 'silent! file [CoffeeRun ' . src . ']'

autocmd BufWipeout <buffer> call s:CoffeeRunClose()
autocmd BufLeave <buffer> let b:coffee_run_pos = getpos('.')

silent doautocmd CoffeeBufNew User CoffeeRun

call s:SwitchWindow(src)
let b:coffee_run_buf = buf
endif

if a:startline == 1 && a:endline == line('$')
let output = system(g:coffee_compiler .
\ ' ' . b:coffee_litcoffee .
\ ' ' . fnameescape(expand('%')) .
\ ' ' . a:args)
else
let input = join(getline(a:startline, a:endline), "\n")

if !len(input)
return
endif

let output = system(g:coffee_compiler .
\ ' -s' .
\ ' ' . b:coffee_litcoffee .
\ ' ' . a:args, input)
endif

call s:ScratchBufUpdate(b:coffee_run_buf, output)
call setpos('.', b:coffee_run_pos)

silent doautocmd CoffeeBufUpdate User CoffeeRun
endfunction

" Run coffeelint on a file, and add any errors between startline and endline
" to the quickfix list.
function! s:CoffeeLint(startline, endline, bang, args)
let input = join(getline(a:startline, a:endline), "\n")

if !len(input)
return
endif

let output = system(g:coffee_linter .
\ ' -s --reporter csv' .
\ ' ' . b:coffee_litcoffee .
\ ' ' . g:coffee_lint_options .
\ ' ' . a:args .
\ ' 2>&1', input)

" Convert output into an array and strip off the csv header.
let lines = split(output, "\n")[1:]
let buf = bufnr('%')
let qflist = []

for line in lines
let match = matchlist(line, '^stdin,\(\d\+\),\d*,\(error\|warn\),\(.\+\)$')

" Ignore unmatched lines.
if !len(match)
continue
endif

" The 'type' will result in either 'E' or 'W'.
call add(qflist, {'bufnr': buf, 'lnum': a:startline + str2nr(match[1]) - 1,
\ 'type': toupper(match[2][0]), 'text': match[3]})
endfor

" Replace the quicklist with our items.
call setqflist(qflist, 'r')

" If not given a bang, jump to first error.
if !len(a:bang)
silent! cc 1
endif
endfunction

" Complete arguments for Coffee* commands.
function! s:CoffeeComplete(cmd, cmdline, cursor)
let args = ['vertical']

" If no partial command, return all possibilities.
if !len(a:cmd)
return args
endif

let pat = '^' . a:cmd

for arg in args
if arg =~ pat
return [arg]
endif
endfor
endfunction

" Set initial state variables if they don't exist
if !exists('b:coffee_compile_buf')
call s:CoffeeCompileResetVars()
endif

if !exists('b:coffee_watch_buf')
call s:CoffeeWatchResetVars()
endif

if !exists('b:coffee_run_buf')
call s:CoffeeRunResetVars()
endif

command! -buffer -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete
\ CoffeeCompile call s:CoffeeCompile(<line1>, <line2>, <q-args>)
command! -buffer -bar -nargs=* -complete=customlist,s:CoffeeComplete
\ CoffeeWatch call s:CoffeeWatch(<q-args>)
command! -buffer -range=% -bar -nargs=* CoffeeRun
\ call s:CoffeeRun(<line1>, <line2>, <q-args>)
command! -buffer -range=% -bang -bar -nargs=* CoffeeLint
\ call s:CoffeeLint(<line1>, <line2>, <q-bang>, <q-args>)

+ 428
- 0
dotfiles/vim/bundle/vim-coffee-script/indent/coffee.vim Bestand weergeven

@@ -0,0 +1,428 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

if exists('b:did_indent')
finish
endif

let b:did_indent = 1

setlocal autoindent
setlocal indentexpr=GetCoffeeIndent(v:lnum)
" Make sure GetCoffeeIndent is run when these are typed so they can be
" indented or outdented.
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally

" If no indenting or outdenting is needed, either keep the indent of the cursor
" (use autoindent) or match the indent of the previous line.
if exists('g:coffee_indent_keep_current')
let s:DEFAULT_LEVEL = '-1'
else
let s:DEFAULT_LEVEL = 'indent(prevnlnum)'
endif

" Only define the function once.
if exists('*GetCoffeeIndent')
finish
endif

" Keywords that begin a block
let s:BEGIN_BLOCK_KEYWORD = '\C^\%(if\|unless\|else\|for\|while\|until\|'
\ . 'loop\|switch\|when\|try\|catch\|finally\|'
\ . 'class\)\>\%(\s*:\)\@!'

" An expression that uses the result of a statement
let s:COMPOUND_EXPRESSION = '\C\%([^-]-\|[^+]+\|[^/]/\|[:=*%&|^<>]\)\s*'
\ . '\%(if\|unless\|for\|while\|until\|loop\|switch\|'
\ . 'try\|class\)\>'

" Combine the two above
let s:BEGIN_BLOCK = s:BEGIN_BLOCK_KEYWORD . '\|' . s:COMPOUND_EXPRESSION

" Operators that begin a block but also count as a continuation
let s:BEGIN_BLOCK_OP = '[([{:=]$'

" Begins a function block
let s:FUNCTION = '[-=]>$'

" Operators that continue a line onto the next line
let s:CONTINUATION_OP = '\C\%(\<\%(is\|isnt\|and\|or\)\>\|'
\ . '[^-]-\|[^+]+\|[^-=]>\|[^.]\.\|[<*/%&|^,]\)$'

" Ancestor operators that prevent continuation indenting
let s:CONTINUATION = s:CONTINUATION_OP . '\|' . s:BEGIN_BLOCK_OP

" A closing bracket by itself on a line followed by a continuation
let s:BRACKET_CONTINUATION = '^\s*[}\])]\s*' . s:CONTINUATION_OP

" A continuation dot access
let s:DOT_ACCESS = '^\.'

" Keywords that break out of a block
let s:BREAK_BLOCK_OP = '\C^\%(return\|break\|continue\|throw\)\>'

" A condition attached to the end of a statement
let s:POSTFIX_CONDITION = '\C\S\s\+\zs\<\%(if\|unless\|when\|while\|until\)\>'

" A then contained in brackets
let s:CONTAINED_THEN = '\C[(\[].\{-}\<then\>.\{-\}[)\]]'

" An else with a condition attached
let s:ELSE_COND = '\C^\s*else\s\+\<\%(if\|unless\)\>'

" A single-line else statement (without a condition attached)
let s:SINGLE_LINE_ELSE = '\C^else\s\+\%(\<\%(if\|unless\)\>\)\@!'

" Pairs of starting and ending keywords, with an initial pattern to match
let s:KEYWORD_PAIRS = [
\ ['\C^else\>', '\C\<\%(if\|unless\|when\|else\s\+\%(if\|unless\)\)\>',
\ '\C\<else\>'],
\ ['\C^catch\>', '\C\<try\>', '\C\<catch\>'],
\ ['\C^finally\>', '\C\<try\>', '\C\<finally\>']
\]

" Pairs of starting and ending brackets
let s:BRACKET_PAIRS = {']': '\[', '}': '{', ')': '('}

" Max lines to look back for a match
let s:MAX_LOOKBACK = 50

" Syntax names for strings
let s:SYNTAX_STRING = 'coffee\%(String\|AssignString\|Embed\|Regex\|Heregex\|'
\ . 'Heredoc\)'

" Syntax names for comments
let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)'

" Syntax names for strings and comments
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT

" Compatibility code for shiftwidth() as recommended by the docs, but modified
" so there isn't as much of a penalty if shiftwidth() exists.
if exists('*shiftwidth')
let s:ShiftWidth = function('shiftwidth')
else
function! s:ShiftWidth()
return &shiftwidth
endfunction
endif

" Get the linked syntax name of a character.
function! s:SyntaxName(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name')
endfunction

" Check if a character is in a comment.
function! s:IsComment(lnum, col)
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_COMMENT
endfunction

" Check if a character is in a string.
function! s:IsString(lnum, col)
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING
endfunction

" Check if a character is in a comment or string.
function! s:IsCommentOrString(lnum, col)
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING_COMMENT
endfunction

" Search a line for a regex until one is found outside a string or comment.
function! s:SearchCode(lnum, regex)
" Start at the first column and look for an initial match (including at the
" cursor.)
call cursor(a:lnum, 1)
let pos = search(a:regex, 'c', a:lnum)

while pos
if !s:IsCommentOrString(a:lnum, col('.'))
return 1
endif

" Move to the match and continue searching (don't accept matches at the
" cursor.)
let pos = search(a:regex, '', a:lnum)
endwhile

return 0
endfunction

" Search for the nearest previous line that isn't a comment.
function! s:GetPrevNormalLine(startlnum)
let curlnum = a:startlnum

while curlnum
let curlnum = prevnonblank(curlnum - 1)

" Return the line if the first non-whitespace character isn't a comment.
if !s:IsComment(curlnum, indent(curlnum) + 1)
return curlnum
endif
endwhile

return 0
endfunction

function! s:SearchPair(startlnum, lookback, skip, open, close)
" Go to the first column so a:close will be matched even if it's at the
" beginning of the line.
call cursor(a:startlnum, 1)
return searchpair(a:open, '', a:close, 'bnW', a:skip, max([1, a:lookback]))
endfunction

" Skip if a match
" - is in a string or comment
" - is a single-line statement that isn't immediately
" adjacent
" - has a postfix condition and isn't an else statement or compound
" expression
function! s:ShouldSkip(startlnum, lnum, col)
return s:IsCommentOrString(a:lnum, a:col) ||
\ s:SearchCode(a:lnum, '\C\<then\>') && a:startlnum - a:lnum > 1 ||
\ s:SearchCode(a:lnum, s:POSTFIX_CONDITION) &&
\ getline(a:lnum) !~ s:ELSE_COND &&
\ !s:SearchCode(a:lnum, s:COMPOUND_EXPRESSION)
endfunction

" Search for the nearest and farthest match for a keyword pair.
function! s:SearchMatchingKeyword(startlnum, open, close)
let skip = 's:ShouldSkip(' . a:startlnum . ", line('.'), line('.'))"

" Search for the nearest match.
let nearestlnum = s:SearchPair(a:startlnum, a:startlnum - s:MAX_LOOKBACK,
\ skip, a:open, a:close)

if !nearestlnum
return []
endif

" Find the nearest previous line with indent less than or equal to startlnum.
let ind = indent(a:startlnum)
let lookback = s:GetPrevNormalLine(a:startlnum)

while lookback && indent(lookback) > ind
let lookback = s:GetPrevNormalLine(lookback)
endwhile

" Search for the farthest match. If there are no other matches, then the
" nearest match is also the farthest one.
let matchlnum = nearestlnum

while matchlnum
let lnum = matchlnum
let matchlnum = s:SearchPair(matchlnum, lookback, skip, a:open, a:close)
endwhile

return [nearestlnum, lnum]
endfunction

" Strip a line of a trailing comment and surrounding whitespace.
function! s:GetTrimmedLine(lnum)
" Try to find a comment starting at the first column.
call cursor(a:lnum, 1)
let pos = search('#', 'c', a:lnum)

" Keep searching until a comment is found or search returns 0.
while pos
if s:IsComment(a:lnum, col('.'))
break
endif

let pos = search('#', '', a:lnum)
endwhile

if !pos
" No comment was found so use the whole line.
let line = getline(a:lnum)
else
" Subtract 1 to get to the column before the comment and another 1 for
" column indexing -> zero-based indexing.
let line = getline(a:lnum)[:col('.') - 2]
endif

return substitute(substitute(line, '^\s\+', '', ''),
\ '\s\+$', '', '')
endfunction

" Get the indent policy when no special rules are used.
function! s:GetDefaultPolicy(curlnum)
" Check whether equalprg is being ran on existing lines.
if strlen(getline(a:curlnum)) == indent(a:curlnum)
" If not indenting an existing line, use the default policy.
return s:DEFAULT_LEVEL
else
" Otherwise let autoindent determine what to do with an existing line.
return '-1'
endif
endfunction

function! GetCoffeeIndent(curlnum)
" Get the previous non-blank line (may be a comment.)
let prevlnum = prevnonblank(a:curlnum - 1)

" Bail if there's no code before.
if !prevlnum
return -1
endif

" Bail if inside a multiline string.
if s:IsString(a:curlnum, 1)
let prevnlnum = prevlnum
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif

" Get the code part of the current line.
let curline = s:GetTrimmedLine(a:curlnum)
" Get the previous non-comment line.
let prevnlnum = s:GetPrevNormalLine(a:curlnum)

" Check if the current line is the closing bracket in a bracket pair.
if has_key(s:BRACKET_PAIRS, curline[0])
" Search for a matching opening bracket.
let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK,
\ "s:IsCommentOrString(line('.'), col('.'))",
\ s:BRACKET_PAIRS[curline[0]], curline[0])

if matchlnum
" Match the indent of the opening bracket.
return indent(matchlnum)
else
" No opening bracket found (bad syntax), so bail.
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif
endif

" Check if the current line is the closing keyword in a keyword pair.
for pair in s:KEYWORD_PAIRS
if curline =~ pair[0]
" Find the nearest and farthest matches within the same indent level.
let matches = s:SearchMatchingKeyword(a:curlnum, pair[1], pair[2])

if len(matches)
" Don't force indenting/outdenting as long as line is already lined up
" with a valid match
return max([min([indent(a:curlnum), indent(matches[0])]),
\ indent(matches[1])])
else
" No starting keyword found (bad syntax), so bail.
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif
endif
endfor

" Check if the current line is a `when` and not the first in a switch block.
if curline =~ '\C^when\>' && !s:SearchCode(prevnlnum, '\C\<switch\>')
" Look back for a `when`.
while prevnlnum
if getline(prevnlnum) =~ '\C^\s*when\>'
" Indent to match the found `when`, but don't force indenting (for when
" indenting nested switch blocks.)
return min([indent(a:curlnum), indent(prevnlnum)])
endif

let prevnlnum = s:GetPrevNormalLine(prevnlnum)
endwhile

" No matching `when` found (bad syntax), so bail.
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif

" If the previous line is a comment, use its indentation, but don't force
" indenting.
if prevlnum != prevnlnum
return min([indent(a:curlnum), indent(prevlnum)])
endif

let prevline = s:GetTrimmedLine(prevnlnum)

" Always indent after these operators.
if prevline =~ s:BEGIN_BLOCK_OP
return indent(prevnlnum) + s:ShiftWidth()
endif

" Indent if the previous line starts a function block, but don't force
" indenting if the line is non-blank (for empty function bodies.)
if prevline =~ s:FUNCTION
if strlen(getline(a:curlnum)) > indent(a:curlnum)
return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)])
else
return indent(prevnlnum) + s:ShiftWidth()
endif
endif

" Check if continuation indenting is needed. If the line ends in a slash, make
" sure it isn't a regex.
if prevline =~ s:CONTINUATION_OP &&
\ !(prevline =~ '/$' && s:IsString(prevnlnum, col([prevnlnum, '$']) - 1))
" Don't indent if the continuation follows a closing bracket.
if prevline =~ s:BRACKET_CONTINUATION
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif

let prevprevnlnum = s:GetPrevNormalLine(prevnlnum)

" Don't indent if not the first continuation.
if prevprevnlnum && s:GetTrimmedLine(prevprevnlnum) =~ s:CONTINUATION
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif

" Continuation indenting seems to vary between programmers, so if the line
" is non-blank, don't override the indentation
if strlen(getline(a:curlnum)) > indent(a:curlnum)
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif

" Otherwise indent a level.
return indent(prevnlnum) + s:ShiftWidth()
endif

" Check if the previous line starts with a keyword that begins a block.
if prevline =~ s:BEGIN_BLOCK
" Indent if the current line doesn't start with `then` and the previous line
" isn't a single-line statement.
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
\ prevline !~ s:SINGLE_LINE_ELSE
return indent(prevnlnum) + s:ShiftWidth()
else
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif
endif

" Indent a dot access if it's the first.
if curline =~ s:DOT_ACCESS
if prevline !~ s:DOT_ACCESS
return indent(prevnlnum) + s:ShiftWidth()
else
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif
endif

" Outdent if a keyword breaks out of a block as long as it doesn't have a
" postfix condition (and the postfix condition isn't a single-line statement.)
if prevline =~ s:BREAK_BLOCK_OP
if !s:SearchCode(prevnlnum, s:POSTFIX_CONDITION) ||
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
" Don't force indenting.
return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()])
else
exec 'return' s:GetDefaultPolicy(a:curlnum)
endif
endif

" Check if inside brackets.
let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK,
\ "s:IsCommentOrString(line('.'), col('.'))",
\ '\[\|(\|{', '\]\|)\|}')

" If inside brackets, indent relative to the brackets, but don't outdent an
" already indented line.
if matchlnum
return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()])
endif

" No special rules applied, so use the default policy.
exec 'return' s:GetDefaultPolicy(a:curlnum)
endfunction

+ 221
- 0
dotfiles/vim/bundle/vim-coffee-script/syntax/coffee.vim Bestand weergeven

@@ -0,0 +1,221 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" Bail if our syntax is already loaded.
if exists('b:current_syntax') && b:current_syntax == 'coffee'
finish
endif

" Include JavaScript for coffeeEmbed.
syn include @coffeeJS syntax/javascript.vim
silent! unlet b:current_syntax

" Highlight long strings.
syntax sync fromstart

" These are `matches` instead of `keywords` because vim's highlighting
" priority for keywords is higher than matches. This causes keywords to be
" highlighted inside matches, even if a match says it shouldn't contain them --
" like with coffeeAssign and coffeeDot.
syn match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/ display
hi def link coffeeStatement Statement

syn match coffeeRepeat /\<\%(for\|while\|until\|loop\)\>/ display
hi def link coffeeRepeat Repeat

syn match coffeeConditional /\<\%(if\|else\|unless\|switch\|when\|then\)\>/
\ display
hi def link coffeeConditional Conditional

syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
hi def link coffeeException Exception

syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\)\>/
\ display
" The `own` keyword is only a keyword after `for`.
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
\ display
hi def link coffeeKeyword Keyword

syn match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/ display
hi def link coffeeOperator Operator

" The first case matches symbol operators only if they have an operand before.
syn match coffeeExtendedOp /\%(\S\s*\)\@<=[+\-*/%&|\^=!<>?.]\{-1,}\|[-=]>\|--\|++\|:/
\ display
syn match coffeeExtendedOp /\<\%(and\|or\)=/ display
hi def link coffeeExtendedOp coffeeOperator

" This is separate from `coffeeExtendedOp` to help differentiate commas from
" dots.
syn match coffeeSpecialOp /[,;]/ display
hi def link coffeeSpecialOp SpecialChar

syn match coffeeBoolean /\<\%(true\|on\|yes\|false\|off\|no\)\>/ display
hi def link coffeeBoolean Boolean

syn match coffeeGlobal /\<\%(null\|undefined\)\>/ display
hi def link coffeeGlobal Type

" A special variable
syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display
hi def link coffeeSpecialVar Special

" An @-variable
syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display
hi def link coffeeSpecialIdent Identifier

" A class-like name that starts with a capital letter
syn match coffeeObject /\<\u\w*\>/ display
hi def link coffeeObject Structure

" A constant-like name in SCREAMING_CAPS
syn match coffeeConstant /\<\u[A-Z0-9_]\+\>/ display
hi def link coffeeConstant Constant

" A variable name
syn cluster coffeeIdentifier contains=coffeeSpecialVar,coffeeSpecialIdent,
\ coffeeObject,coffeeConstant

" A non-interpolated string
syn cluster coffeeBasicString contains=@Spell,coffeeEscape
" An interpolated string
syn cluster coffeeInterpString contains=@coffeeBasicString,coffeeInterp

" Regular strings
syn region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/
\ contains=@coffeeInterpString
syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/
\ contains=@coffeeBasicString
hi def link coffeeString String

" A integer, including a leading plus or minus
syn match coffeeNumber /\%(\i\|\$\)\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/ display
" A hex, binary, or octal number
syn match coffeeNumber /\<0[xX]\x\+\>/ display
syn match coffeeNumber /\<0[bB][01]\+\>/ display
syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display
hi def link coffeeNumber Number

" A floating-point number, including a leading plus or minus
syn match coffeeFloat /\%(\i\|\$\)\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
\ display
hi def link coffeeFloat Float

" An error for reserved keywords, taken from the RESERVED array:
" http://coffeescript.org/documentation/docs/lexer.html#section-67
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\|implements\|interface\|package\|private\|protected\|public\|static\|yield\)\>/
\ display
hi def link coffeeReservedError Error

" A normal object assignment
syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display
hi def link coffeeObjAssign Identifier

syn keyword coffeeTodo TODO FIXME XXX contained
hi def link coffeeTodo Todo

syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo
hi def link coffeeComment Comment

syn region coffeeBlockComment start=/####\@!/ end=/###/
\ contains=@Spell,coffeeTodo
hi def link coffeeBlockComment coffeeComment

" A comment in a heregex
syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained
\ contains=@Spell,coffeeTodo
hi def link coffeeHeregexComment coffeeComment

" Embedded JavaScript
syn region coffeeEmbed matchgroup=coffeeEmbedDelim
\ start=/`/ skip=/\\\\\|\\`/ end=/`/ keepend
\ contains=@coffeeJS
hi def link coffeeEmbedDelim Delimiter

syn region coffeeInterp matchgroup=coffeeInterpDelim start=/#{/ end=/}/ contained
\ contains=@coffeeAll
hi def link coffeeInterpDelim PreProc

" A string escape sequence
syn match coffeeEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained display
hi def link coffeeEscape SpecialChar

" A regex -- must not follow a parenthesis, number, or identifier, and must not
" be followed by a number
syn region coffeeRegex start=#\%(\%()\|\%(\i\|\$\)\@<!\d\)\s*\|\i\)\@<!/=\@!\s\@!#
\ end=#/[gimy]\{,4}\d\@!#
\ oneline contains=@coffeeBasicString,coffeeRegexCharSet
syn region coffeeRegexCharSet start=/\[/ end=/]/ contained
\ contains=@coffeeBasicString
hi def link coffeeRegex String
hi def link coffeeRegexCharSet coffeeRegex

" A heregex
syn region coffeeHeregex start=#///# end=#///[gimy]\{,4}#
\ contains=@coffeeInterpString,coffeeHeregexComment,
\ coffeeHeregexCharSet
\ fold
syn region coffeeHeregexCharSet start=/\[/ end=/]/ contained
\ contains=@coffeeInterpString
hi def link coffeeHeregex coffeeRegex
hi def link coffeeHeregexCharSet coffeeHeregex

" Heredoc strings
syn region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString
\ fold
syn region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeBasicString
\ fold
hi def link coffeeHeredoc String

" An error for trailing whitespace, as long as the line isn't just whitespace
syn match coffeeSpaceError /\S\@<=\s\+$/ display
hi def link coffeeSpaceError Error

" An error for trailing semicolons, for help transitioning from JavaScript
syn match coffeeSemicolonError /;$/ display
hi def link coffeeSemicolonError Error

" Ignore reserved words in dot accesses.
syn match coffeeDotAccess /\.\@<!\.\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+1 contains=@coffeeIdentifier
hi def link coffeeDotAccess coffeeExtendedOp

" Ignore reserved words in prototype accesses.
syn match coffeeProtoAccess /::\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+2 contains=@coffeeIdentifier
hi def link coffeeProtoAccess coffeeExtendedOp

" This is required for interpolations to work.
syn region coffeeCurlies matchgroup=coffeeCurly start=/{/ end=/}/
\ contains=@coffeeAll
syn region coffeeBrackets matchgroup=coffeeBracket start=/\[/ end=/\]/
\ contains=@coffeeAll
syn region coffeeParens matchgroup=coffeeParen start=/(/ end=/)/
\ contains=@coffeeAll

" These are highlighted the same as commas since they tend to go together.
hi def link coffeeBlock coffeeSpecialOp
hi def link coffeeBracket coffeeBlock
hi def link coffeeCurly coffeeBlock
hi def link coffeeParen coffeeBlock

" This is used instead of TOP to keep things coffee-specific for good
" embedding. `contained` groups aren't included.
syn cluster coffeeAll contains=coffeeStatement,coffeeRepeat,coffeeConditional,
\ coffeeException,coffeeKeyword,coffeeOperator,
\ coffeeExtendedOp,coffeeSpecialOp,coffeeBoolean,
\ coffeeGlobal,coffeeSpecialVar,coffeeSpecialIdent,
\ coffeeObject,coffeeConstant,coffeeString,
\ coffeeNumber,coffeeFloat,coffeeReservedError,
\ coffeeObjAssign,coffeeComment,coffeeBlockComment,
\ coffeeEmbed,coffeeRegex,coffeeHeregex,
\ coffeeHeredoc,coffeeSpaceError,
\ coffeeSemicolonError,coffeeDotAccess,
\ coffeeProtoAccess,coffeeCurlies,coffeeBrackets,
\ coffeeParens

if !exists('b:current_syntax')
let b:current_syntax = 'coffee'
endif

+ 3
- 0
dotfiles/vim/bundle/vim-coffee-script/test/test-interp.coffee Bestand weergeven

@@ -0,0 +1,3 @@
# Nested curlies
" >> #{ == { { { } } } == } << "
" >> #{ == { abc: { def: 42 } } == } << "

+ 90
- 0
dotfiles/vim/bundle/vim-coffee-script/test/test-ops.coffee Bestand weergeven

@@ -0,0 +1,90 @@
# Various operators
abc instanceof def
typeof abc
delete abc
abc::def

abc + def
abc - def
abc * def
abc / def
abc % def
abc & def
abc | def
abc ^ def
abc >> def
abc << def
abc >>> def
abc ? def
abc && def
abc and def
abc || def
abc or def

abc += def
abc -= def
abc *= def
abc /= def
abc %= def
abc &= def
abc |= def
abc ^= def
abc >>= def
abc <<= def
abc >>>= def
abc ?= def
abc &&= def
abc ||= def

abc and= def
abc or= def

abc.def.ghi
abc?.def?.ghi

abc < def
abc > def
abc = def
abc == def
abc != def
abc <= def
abc >= def

abc++
abc--
++abc
--abc

# Nested operators
abc[def] = ghi
abc[def[ghi: jkl]] = 42
@abc[def] = ghi

abc["#{def = 42}"] = 42
abc["#{def.ghi = 42}"] = 42
abc["#{def[ghi] = 42}"] = 42
abc["#{def['ghi']}"] = 42

# Object assignments
abc =
def: 123
DEF: 123
@def: 123
Def: 123
'def': 123
42: 123

# Operators shouldn't be highlighted
vector=
wand=

abc+++
abc---
abc ** def
abc &&& def
abc ^^ def
abc ===== def
abc <==== def
abc >==== def
abc +== def
abc =^= def

+ 27
- 0
dotfiles/vim/bundle/vim-coffee-script/test/test-reserved.coffee Bestand weergeven

@@ -0,0 +1,27 @@
# Should be an error
function = 42
var = 42

# Shouldn't be an error
abc.with = 42
function: 42
var: 42

# Keywords shouldn't be highlighted
abc.function
abc.do
abc.break
abc.true

abc::function
abc::do
abc::break
abc::true

abc:: function
abc. function

# Numbers should be highlighted
def.42
def .42
def::42

+ 3
- 0
dotfiles/vim/bundle/vim-coffee-script/test/test.haml Bestand weergeven

@@ -0,0 +1,3 @@
:coffeescript
class Hello
# test

+ 7
- 0
dotfiles/vim/bundle/vim-coffee-script/test/test.html Bestand weergeven

@@ -0,0 +1,7 @@
<head>
<script type="text/coffeescript">
abc = {
def: 42
}
</script>
</head>

Laden…
Annuleren
Opslaan