diff options
| author | Teddy Wing | 2017-05-04 22:07:51 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-05-04 22:07:51 +0200 | 
| commit | 30d907fd205daa02fd32a4c367602a457fe9b399 (patch) | |
| tree | b8127e6d5541e2e64a188ca36a137a8c32665dd9 /bundle | |
| parent | 7617675981dc0f2d77cd1449536d4284de46ec5d (diff) | |
| download | dotvim-30d907fd205daa02fd32a4c367602a457fe9b399.tar.bz2 | |
Add 'whitespace-chain' plugin
A new plugin to split method chains onto multiple lines.
For example:
    scope.line.result(distinct: true).paginate
becomes:
    scope
      .line
      .result(distinct: true)
      .paginate
Diffstat (limited to 'bundle')
| -rw-r--r-- | bundle/whitespace-chain/plugin/whitespace_chain.vim | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/bundle/whitespace-chain/plugin/whitespace_chain.vim b/bundle/whitespace-chain/plugin/whitespace_chain.vim new file mode 100644 index 0000000..5ba523d --- /dev/null +++ b/bundle/whitespace-chain/plugin/whitespace_chain.vim @@ -0,0 +1,12 @@ +function! SplitMethodChainToMultipleLines() +	normal! m` + +	let line = getline('.') +	let indent = matchstr(line, '\v^\s+') + +	" Replace '.' with newlines and the correct amount of indentation +	substitute/\V./\='
' . indent . '.'/g + +	" Indent new lines +	'`+1,.> +endfunction | 
