1
0
Fork 0
mirror of synced 2024-12-26 00:33:20 -05:00

Removed not used plugins

This commit is contained in:
Mirosław Pragłowski 2015-06-04 22:10:53 +02:00
parent 04043cac04
commit 6ae10d97c5
128 changed files with 0 additions and 22032 deletions

View file

@ -1,19 +0,0 @@
This project is a colleciton of vim scripts that relate to the Mako templating
engine for python. Most of thse are not at all written by me, just packaged
here from the vim-script site. The purpose is to make them easy to use with
pathogen.vim.
About mako: http://www.makotemplates.org/
Original scripts:
Externally sourced scripts:
* indent/mako.vim (vim script 2663) by Scott Torborg
http://www.vim.org/scripts/script.php?script_id=2663
version used here: 0.4
* syntax/mako.vim (vim script 1858) by Armin Ronacher
http://www.vim.org/scripts/script.php?script_id=1858
version used here: 0.6.1

View file

@ -1 +0,0 @@
au BufRead,BufNewFile *.mako set filetype=mako

View file

@ -1,11 +0,0 @@
" Vim filetype plugin file
" Language: Mako
" Maintainer: Randy Stauner <randy@magnificent-tears.com>
" Last Change: 2014-02-07
" Version: 0.1
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
setlocal comments=:##
setlocal commentstring=##%s

View file

@ -1,354 +0,0 @@
" Vim indent file
" Language: Mako
" Author: Scott Torborg <storborg@mit.edu>
" Version: 0.4
" License: Do What The Fuck You Want To Public License (WTFPL)
"
" ---------------------------------------------------------------------------
"
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
" Version 2, December 2004
"
" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
"
" 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.
"
" ---------------------------------------------------------------------------
"
" This script does more useful indenting for Mako HTML templates. It indents
" inside of control blocks, defs, etc. Note that this indenting style will
" sacrifice readability of the output text for the sake of readability of the
" template.
"
" We'll use HTML indenting globally, python inside <% %> blocks. Inspired by
" the excellent PHP + HTML indentation files such as php.vim by Pim Snel.
"
" Changelog:
" 0.4 - 5 March 2010
" - Added license information
" 0.3 - 15 September 2009
" - Added explicit indenting for ## comments, fixed unindenting count,
" thanks to Mike Lewis (@MikeRLewis) for this
" 0.2 - 15 June 2009
" - Fixed issue where opening and closing mako tags on the same line
" would cause incorrect indenting
" 0.1 - 06 June 2009
" - Initial public release of mako indent file
let sw=2 " default shiftwidth of 2 spaces
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nosmartindent
setlocal noautoindent
setlocal nocindent
setlocal nolisp
setlocal indentexpr=GetMakoIndent()
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:
" Only define the function once.
if exists("*GetMakoIndent")
finish
endif
if exists('g:html_indent_tags')
unlet g:html_indent_tags
endif
function IsInsidePythonBlock(startline)
" Loop until we get a line that's either <% or %>
let lnum = a:startline
while getline(lnum) !~ '\(%>\|<%\)$' && lnum > 0
let lnum = lnum - 1
endwhile
" lnum points to the last control. If it's a <% then we're inside an
" embedded python block, otherwise we're not.
return getline(lnum) =~ '<%$'
endfunction
function GetMakoIndent()
" Find a non-empty line above the current line
let lnum = prevnonblank(v:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let line = getline(lnum) " last line
let cline = getline(v:lnum) " current line
let pline = getline(lnum - 1) " previous to last line
let ind = indent(lnum)
if line =~ '^\s*##'
return indent(lnum)
end
let restore_ic=&ic
let &ic=1 " ignore case
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
let &ic=restore_ic
let ind = indent(lnum) + (&sw * ind)
" Indent after %anything: or <%anything NOT ending in />
if line =~ '^\s*%.*:\s*$'
let ind = ind + &sw
endif
" Unindent before %end* or </%anything
if cline =~ '^\s*%\s*end'
let ind = ind - &sw
endif
"
" Unindent before %else, %except, and %elif
if cline =~ '^\s*%\s*else' || cline =~ '^\s*%\s*except' || cline =~ '^\s*%\s*elif'
let ind = ind - &sw
endif
" Indent at the beginning of a python control block
if line =~ '<%$'
let ind = ind + &sw
endif
"
" Unindent at the end of the python block.
if cline =~ '^\s*%>$'
let scanlnum = lnum
" Scan backwards until we find the beginning of this python block.
while getline(scanlnum) !~ '<%$' && scanlnum > 0
let scanlnum = scanlnum - 1
endwhile
let ind = indent(scanlnum)
endif
" If we're inside a python block and the previous line ends in a colon,
" indent.
if IsInsidePythonBlock(lnum - 1)
" Indent after :
if line =~ '\:$'
let ind = ind + &sw
endif
endif
return ind
endfunction
" [-- helper function to assemble tag list --]
fun! <SID>HtmlIndentPush(tag)
if exists('g:html_indent_tags')
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
else
let g:html_indent_tags = a:tag
endif
endfun
fun! <SID>MakoIndentPush(tag)
if exists('g:mako_indent_tags')
let g:mako_indent_tags = g:mako_indent_tags.'\|'.a:tag
else
let g:mako_indent_tags = a:tag
endif
endfun
" [-- <ELEMENT ? - - ...> --]
call <SID>HtmlIndentPush('a')
call <SID>HtmlIndentPush('abbr')
call <SID>HtmlIndentPush('acronym')
call <SID>HtmlIndentPush('address')
call <SID>HtmlIndentPush('b')
call <SID>HtmlIndentPush('bdo')
call <SID>HtmlIndentPush('big')
call <SID>HtmlIndentPush('blockquote')
call <SID>HtmlIndentPush('button')
call <SID>HtmlIndentPush('caption')
call <SID>HtmlIndentPush('center')
call <SID>HtmlIndentPush('cite')
call <SID>HtmlIndentPush('code')
call <SID>HtmlIndentPush('colgroup')
call <SID>HtmlIndentPush('del')
call <SID>HtmlIndentPush('dfn')
call <SID>HtmlIndentPush('dir')
call <SID>HtmlIndentPush('div')
call <SID>HtmlIndentPush('dl')
call <SID>HtmlIndentPush('em')
call <SID>HtmlIndentPush('fieldset')
call <SID>HtmlIndentPush('font')
call <SID>HtmlIndentPush('form')
call <SID>HtmlIndentPush('frameset')
call <SID>HtmlIndentPush('h1')
call <SID>HtmlIndentPush('h2')
call <SID>HtmlIndentPush('h3')
call <SID>HtmlIndentPush('h4')
call <SID>HtmlIndentPush('h5')
call <SID>HtmlIndentPush('h6')
call <SID>HtmlIndentPush('i')
call <SID>HtmlIndentPush('iframe')
call <SID>HtmlIndentPush('ins')
call <SID>HtmlIndentPush('kbd')
call <SID>HtmlIndentPush('label')
call <SID>HtmlIndentPush('legend')
call <SID>HtmlIndentPush('map')
call <SID>HtmlIndentPush('menu')
call <SID>HtmlIndentPush('noframes')
call <SID>HtmlIndentPush('noscript')
call <SID>HtmlIndentPush('object')
call <SID>HtmlIndentPush('ol')
call <SID>HtmlIndentPush('optgroup')
call <SID>HtmlIndentPush('pre')
call <SID>HtmlIndentPush('q')
call <SID>HtmlIndentPush('s')
call <SID>HtmlIndentPush('samp')
call <SID>HtmlIndentPush('script')
call <SID>HtmlIndentPush('select')
call <SID>HtmlIndentPush('small')
call <SID>HtmlIndentPush('span')
call <SID>HtmlIndentPush('strong')
call <SID>HtmlIndentPush('style')
call <SID>HtmlIndentPush('sub')
call <SID>HtmlIndentPush('sup')
call <SID>HtmlIndentPush('table')
call <SID>HtmlIndentPush('textarea')
call <SID>HtmlIndentPush('title')
call <SID>HtmlIndentPush('tt')
call <SID>HtmlIndentPush('u')
call <SID>HtmlIndentPush('ul')
call <SID>HtmlIndentPush('var')
" For some reason the default HTML indentation script doesn't consider these
" elements to be worthy of indentation.
call <SID>HtmlIndentPush('p')
call <SID>HtmlIndentPush('dt')
call <SID>HtmlIndentPush('dd')
" [-- <ELEMENT ? O O ...> --]
if !exists('g:html_indent_strict')
call <SID>HtmlIndentPush('body')
call <SID>HtmlIndentPush('head')
call <SID>HtmlIndentPush('html')
call <SID>HtmlIndentPush('tbody')
endif
" [-- <ELEMENT ? O - ...> --]
if !exists('g:html_indent_strict_table')
call <SID>HtmlIndentPush('th')
call <SID>HtmlIndentPush('td')
call <SID>HtmlIndentPush('tr')
call <SID>HtmlIndentPush('tfoot')
call <SID>HtmlIndentPush('thead')
endif
" [-- <Mako Elements> --]
call <SID>MakoIndentPush('%def')
call <SID>MakoIndentPush('%block')
call <SID>MakoIndentPush('%call')
call <SID>MakoIndentPush('%doc')
call <SID>MakoIndentPush('%text')
call <SID>MakoIndentPush('%.\+:.\+')
delfun <SID>HtmlIndentPush
delfun <SID>MakoIndentPush
set cpo-=C
" [-- get number of regex matches in a string --]
fun! <SID>MatchCount(expr, pat)
let mpos = 0
let mcount = 0
let expr = a:expr
while (mpos > -1)
let mend = matchend(expr, a:pat)
if mend > -1
let mcount = mcount + 1
endif
if mend == mpos
let mpos = mpos + 1
else
let mpos = mend
endif
let expr = strpart(expr, mpos)
endwhile
return mcount
endfun
" [-- count indent-increasing tags of line a:lnum --]
fun! <SID>HtmlIndentOpen(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing tags of line a:lnum --]
fun! <SID>HtmlIndentClose(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-increasing mako tags of line a:lnum --]
fun! <SID>MakoIndentOpen(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.g:mako_indent_tags.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing mako tags of line a:lnum --]
fun! <SID>MakoIndentClose(lnum)
let mcount = <SID>MatchCount(getline(a:lnum), '</\('.g:mako_indent_tags.'\)>')
let mcount = mcount + <SID>MatchCount(getline(a:lnum), '<\('.g:mako_indent_tags.'\)[^>]*/>')
return mcount
endfun
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentOpenAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
endfun
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentCloseAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
endfun
" [-- return the sum of indents respecting the syntax of a:lnum --]
fun! <SID>HtmlIndentSum(lnum, style)
let open = <SID>HtmlIndentOpen(a:lnum) + <SID>MakoIndentOpen(a:lnum)
let close = <SID>HtmlIndentClose(a:lnum) + <SID>MakoIndentClose(a:lnum)
if a:style == match(getline(a:lnum), '^\s*</')
if a:style == match(getline(a:lnum), '^\s*</\('.g:html_indent_tags.'\|'.g:mako_indent_tags.'\)')
if 0 != open || 0 != close
return open - close
endif
endif
endif
if '' != &syntax &&
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
\ =~ '\(css\|java\).*'
if a:style == match(getline(a:lnum), '^\s*}')
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
endif
endif
return 0
endfun
" vim: set ts=4 sw=4:

View file

@ -1,92 +0,0 @@
" Vim syntax file
" Language: Mako
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
" URL: http://lucumr.pocoo.org/
" Last Change: 2013-05-01
" Version: 0.6.1+
"
" Thanks to Brine Rue <brian@lolapps.com> who noticed a bug in the
" delimiter handling.
"
" Known Limitations
" the <%text> block does not have correct attributes
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = "html"
endif
"Source the html syntax file
ru! syntax/html.vim
unlet b:current_syntax
" tell html.vim what syntax groups should take precedence (see :help html.vim)
syn cluster htmlPreproc add=makoLine,makoVariable,makoTag,makoDocComment,makoDefEnd,makoText,makoDelim,makoEnd,makoComment,makoEscape
"Put the python syntax file in @pythonTop
syn include @pythonTop syntax/python.vim
" End keywords
syn keyword makoEnd contained endfor endwhile endif endtry enddef
" Block rules
syn region makoLine matchgroup=makoDelim start=#^\s*%# end=#$# keepend contains=@pythonTop,makoEnd
syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
" Variables
syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
" Comments
syn region makoComment start="^\s*##" end="$"
syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
" Literal Blocks
syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
" Attribute Sublexing
syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
" Tags
syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)\>" end="/\?>"
syn match makoDelim "</%\(def\|call\|namespace\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)>"
syn region makoJavaScript matchgroup=makoDelim start=+<%block .*js.*>+ keepend end=+</%block>+ contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc,makoLine,makoBlock,makoVariable
syn region makoCssStyle matchgroup=makoDelim start=+<%block .*css.*>+ keepend end=+</%block>+ contains=@htmlCss,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc,makoLine,makoBlock,makoVariable
" Newline Escapes
syn match makoEscape /\\$/
" Default highlighting links
if version >= 508 || !exists("did_mako_syn_inits")
if version < 508
let did_mako_syn_inits = 1
com -nargs=+ HiLink hi link <args>
else
com -nargs=+ HiLink hi def link <args>
endif
HiLink makoDocComment makoComment
HiLink makoDefEnd makoDelim
HiLink makoAttributeKey Type
HiLink makoAttributeValue String
HiLink makoText Normal
HiLink makoDelim Preproc
HiLink makoEnd Keyword
HiLink makoComment Comment
HiLink makoEscape Special
delc HiLink
endif
let b:current_syntax = "html"

View file

@ -1,267 +0,0 @@
---
Title: Solarized Colorscheme for Vim
Description: Precision colors for machines and people
Author: Ethan Schoonover
Colors: light yellow
Created: 2011 Mar 15
Modified: 2011 Apr 16
---
Solarized Colorscheme for Vim
=============================
Developed by Ethan Schoonover <es@ethanschoonover.com>
Visit the [Solarized homepage]
------------------------------
See the [Solarized homepage] for screenshots,
details and colorscheme versions for Vim, Mutt, popular terminal emulators and
other applications.
Screenshots
-----------
![solarized dark](https://github.com/altercation/solarized/raw/master/img/solarized-vim.png)
Downloads
---------
If you have come across this colorscheme via the [Vim-only repository] on
github, or the [vim.org script] page see the link above to the Solarized
homepage or visit the main [Solarized repository].
The [Vim-only repository] is kept in sync with the main [Solarized repository]
and is for installation convenience only (with [Pathogen] or [Vundle], for
instance). Issues, bug reports, changelogs are centralized at the main
[Solarized repository].
[Solarized homepage]: http://ethanschoonover.com/solarized
[Solarized repository]: https://github.com/altercation/solarized
[Vim-only repository]: https://github.com/altercation/vim-colors-solarized
[vimorg-script]: http://vim.org/script
[Pathogen]: https://github.com/tpope/vim-pathogen
[Vundle]: https://github.com/gmarik/vundle
Installation
------------
### Option 1: Manual installation
1. Move `solarized.vim` to your `.vim/colors` directory. After downloading the
vim script or package:
$ cd vim-colors-solarized/colors
$ mv solarized.vim ~/.vim/colors/
### Option 2: Pathogen installation ***(recommended)***
1. Download and install Tim Pope's [Pathogen].
2. Next, move or clone the `vim-colors-solarized` directory so that it is
a subdirectory of the `.vim/bundle` directory.
a. **Clone:**
$ cd ~/.vim/bundle
$ git clone git://github.com/altercation/vim-colors-solarized.git
b. **Move:**
In the parent directory of vim-colors-solarized:
$ mv vim-colors-solarized ~/.vim/bundle/
### Modify .vimrc
After either Option 1 or Option 2 above, put the following two lines in your
.vimrc:
syntax enable
set background=dark
colorscheme solarized
or, for the light background mode of Solarized:
syntax enable
set background=light
colorscheme solarized
I like to have a different background in GUI and terminal modes, so I can use
the following if-then. However, I find vim's background autodetection to be
pretty good and, at least with MacVim, I can leave this background value
assignment out entirely and get the same results.
if has('gui_running')
set background=light
else
set background=dark
endif
See the [Solarized homepage] for screenshots which will help you
select either the light or dark background.
### IMPORTANT NOTE FOR TERMINAL USERS:
If you are going to use Solarized in Terminal mode (i.e. not in a GUI version
like gvim or macvim), **please please please** consider setting your terminal
emulator's colorscheme to used the Solarized palette. I've included palettes
for some popular terminal emulator as well as Xdefaults in the official
Solarized download available from [Solarized homepage]. If you use
Solarized *without* these colors, Solarized will need to be told to degrade its
colorscheme to a set compatible with the limited 256 terminal palette (whereas
by using the terminal's 16 ansi color values, you can set the correct, specific
values for the Solarized palette).
If you do use the custom terminal colors, solarized.vim should work out of the
box for you. If you are using a terminal emulator that supports 256 colors and
don't want to use the custom Solarized terminal colors, you will need to use
the degraded 256 colorscheme. To do so, simply add the following line *before*
the `colorschem solarized` line:
let g:solarized_termcolors=256
Again, I recommend just changing your terminal colors to Solarized values
either manually or via one of the many terminal schemes available for import.
Advanced Configuration
----------------------
Solarized will work out of the box with just the two lines specified above but
does include several other options that can be set in your .vimrc file.
Set these in your vimrc file prior to calling the colorscheme.
"
option name default optional
------------------------------------------------
g:solarized_termcolors= 16 | 256
g:solarized_termtrans = 0 | 1
g:solarized_degrade = 0 | 1
g:solarized_bold = 1 | 0
g:solarized_underline = 1 | 0
g:solarized_italic = 1 | 0
g:solarized_contrast = "normal"| "high" or "low"
g:solarized_visibility= "normal"| "high" or "low"
------------------------------------------------
### Option Details
* g:solarized_termcolors
This is set to *16* by default, meaning that Solarized will attempt to use
the standard 16 colors of your terminal emulator. You will need to set
those colors to the correct Solarized values either manually or by
importing one of the many colorscheme available for popular terminal
emulators and Xdefaults.
* g:solarized_termtrans
If you use a terminal emulator with a transparent background and Solarized
isn't displaying the background color transparently, set this to 1 and
Solarized will use the default (transparent) background of the terminal
emulator. *urxvt* required this in my testing; iTerm2 did not.
Note that on Mac OS X Terminal.app, solarized_termtrans is set to 1 by
default as this is almost always the best option. The only exception to
this is if the working terminfo file supports 256 colors (xterm-256color).
* g:solarized_degrade
For test purposes only; forces Solarized to use the 256 degraded color mode
to test the approximate color values for accuracy.
* g:solarized_bold | g:solarized_underline | g:solarized_italic
If you wish to stop Solarized from displaying bold, underlined or
italicized typefaces, simply assign a zero value to the appropriate
variable, for example: `let g:solarized_italic=0`
* g:solarized_contrast
Stick with normal! It's been carefully tested. Setting this option to high
or low does use the same Solarized palette but simply shifts some values up
or down in order to expand or compress the tonal range displayed.
* g:solarized_visibility
Special characters such as trailing whitespace, tabs, newlines, when
displayed using `:set list` can be set to one of three levels depending on
your needs. Default value is `normal` with `high` and `low` options.
Toggle Background Function
--------------------------
Solarized comes with a Toggle Background plugin that by default will map to
<F5> if that mapping is available. If it is not available you will need to
either map the function manually or change your current <F5> mapping to
something else.
To set your own mapping in your .vimrc file, simply add the following line to
support normal, insert and visual mode usage, changing the "<F5>" value to the
key or key combination you wish to use:
call togglebg#map("<F5>")
Note that you'll want to use a single function key or equivalent if you want
the plugin to work in all modes (normal, insert, visual).
Code Notes
----------
Use folding to view the `solarized.vim` script with `foldmethod=marker` turned
on.
I have attempted to modularize the creation of Vim colorschemes in this script
and, while it could be refactored further, it should be a good foundation for
the creation of any color scheme. By simply changing the sixteen values in the
GUI section and testing in gvim (or mvim) you can rapidly prototype new
colorschemes without diving into the weeds of line-item editing each syntax
highlight declaration.
The Values
----------
L\*a\*b values are canonical (White D65, Reference D50), other values are
matched in sRGB space.
SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB
--------- ------- ---- ------- ----------- ---------- ----------- -----------
base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21
base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26
base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46
base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51
base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59
base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63
base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93
base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99
yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71
orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80
red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86
magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83
violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77
blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82
cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63
green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60
License
-------
Copyright (c) 2011 Ethan Schoonover
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.

View file

@ -1,55 +0,0 @@
" Toggle Background
" Modified: 2011 Apr 29
" Maintainer: Ethan Schoonover
" License: OSI approved MIT license
if exists("g:loaded_togglebg")
finish
endif
let g:loaded_togglebg = 1
" noremap is a bit misleading here if you are unused to vim mapping.
" in fact, there is remapping, but only of script locally defined remaps, in
" this case <SID>TogBG. The <script> argument modifies the noremap scope in
" this regard (and the noremenu below).
nnoremap <unique> <script> <Plug>ToggleBackground <SID>TogBG
inoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>a
vnoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>gv
nnoremenu <script> Window.Toggle\ Background <SID>TogBG
inoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>a
vnoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>gv
tmenu Window.Toggle\ Background Toggle light and dark background modes
nnoremenu <script> ToolBar.togglebg <SID>TogBG
inoremenu <script> ToolBar.togglebg <ESC><SID>TogBG<ESC>a
vnoremenu <script> ToolBar.togglebg <ESC><SID>TogBG<ESC>gv
tmenu ToolBar.togglebg Toggle light and dark background modes
noremap <SID>TogBG :call <SID>TogBG()<CR>
function! s:TogBG()
let &background = ( &background == "dark"? "light" : "dark" )
if exists("g:colors_name")
exe "colorscheme " . g:colors_name
endif
endfunction
if !exists(":ToggleBG")
command ToggleBG :call s:TogBG()
endif
function! ToggleBackground()
echo "Please update your ToggleBackground mapping. ':help togglebg' for information."
endfunction
function! togglebg#map(mapActivation)
try
exe "silent! nmap <unique> ".a:mapActivation." <Plug>ToggleBackground"
exe "silent! imap <unique> ".a:mapActivation." <Plug>ToggleBackground"
exe "silent! vmap <unique> ".a:mapActivation." <Plug>ToggleBackground"
finally
return 0
endtry
endfunction
if !exists("no_plugin_maps") && !hasmapto('<Plug>ToggleBackground')
call togglebg#map("<F5>")
endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,254 +0,0 @@
*solarized.vim* for Vim version 7.3 or newer. Modified: 2011 May 05
Solarized Vim Colorscheme by Ethan Schoonover ~
Solarized Colorscheme *solarized*
*solarized-help*
*solarized-colors*
*solarized-colorscheme*
*vim-colors-solarized*
Solarized is a carefully designed selective contrast colorscheme with dual
light and dark modes that runs in both GUI, 256 and 16 color modes.
See the homepage at http://ethanschoonover.com/solarized for screenshots and
details.
0. Install |solarized-install|
1. Solarized Menu |solarized-menu|
2. Options |solarized-options|
3. Toggle Background |solarized-togglebg|
4. Terminal Issues |solarized-term|
==============================================================================
0. Install *solarized-install*
Note: I recommend using Tim Pope's pathogen plugin to install this
colorscheme. See https://github.com/tpope/vim-pathogen . If you've installed
pathogen properly you can install Solarized with the following commands,
followed by the .vimrc configuration below.
$ cd ~/.vim/bundle
$ git clone https://github.com/altercation/vim-colors-solarized.git
If you aren't using pathogen, you can use the following three steps to install
Solarized:
1. Download the solarized distribution (available on the homepage above)
and unarchive the file.
2. Move `solarized.vim` to your `.vim/colors` directory.
3. Move each of the files in each subdirectories to the corresponding .vim
subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload
directory as .vim/autoload/togglebg.vim).
After installation, place the following lines in your .vimrc:
syntax enable
set background=dark
colorscheme solarized
or, for the light background mode of Solarized:
syntax enable
set background=light
colorscheme solarized
==============================================================================
1. Solarized Menu *solarized-menu*
Solarized makes available a menu when used in Vim GUI mode (gvim, macvim).
This menu includes many of the options detailed below so that you can test out
different values quickly without modifying your .vimrc file. If you wish to
turn off this menu permanently, simply place the following line in your .vimrc
above the "colorscheme solarized" line.
let g:solarized_menu=0
==============================================================================
2. Toggle Background *solarized-togglebg*
*toggle-bg* *togglebg*
*toggle-background*
Solarized comes with Toggle Background, a simple plugin to switch between
light and dark background modes and reset the colorscheme. This is most useful
for colorschemes that support both light and dark modes and in terminals or
gui vim windows where the background will be properly set.
Toggle Background can be accessed by:
* the Solarized menu (in Vim gui mode)
* the Window menu (in Vim gui mode, even if the Solarized menu is off)
* the "yin/yang" toolbar button (in Vim gui mode)
* the default mapping of <F5>
* custom key mapping you set in your .vimrc (see below)
* command line via ":ToggleBG" (no quotes)
Toggle Background starts with a default mapping to function key <F5>. If you
are already using this in a mapping, Toggle Background will not map itself to
a default and you will have to map it manually in your .vimrc file, or
remove/change your existing <F5> mapping to another value. To customize the
keyboard mapping in your .vimrc file, use the following line, changing the
"<F5>" value to the key or key combination you wish to use:
call togglebg#map("<F5>")
Note that you'll want to use a single function key or equivalent if you want
the plugin to work in all modes (normal, insert, visual).
When using the plugin during normal, visual, or insert mode, there should be
no interruption in workflow. However, if you activate the plugin during
REPLACE mode, you will switch to standard insert mode (you will leave the
overwrite replace mode).
==============================================================================
3. Solarized Terminal Issues *solarized-term*
If you are going to use Solarized in Terminal mode (i.e. not in a GUI version
like gvim or macvim), **please please please** consider setting your terminal
emulator's colorscheme to used the Solarized palette. I've included palettes
for some popular terminal emulator as well as Xdefaults in the official
Solarized download available from the Solarized homepage listed at the top of
this help document. If you use Solarized *without* these colors, Solarized
will need to be told to degrade its colorscheme to a set compatible with the
limited 256 terminal palette (whereas by using the terminal's 16 ansi color
values, you can set the correct, specific values for the Solarized palette).
If you do use the custom terminal colors, solarized.vim should work out of
the box for you. If you are using a terminal emulator that supports 256
colors and don't want to use the custom Solarized terminal colors, you will
need to use the degraded 256 colorscheme. To do so, simply add the following
line *before* the `colorschem solarized` line:
let g:solarized_termcolors=256
Again, I recommend just changing your terminal colors to Solarized values
either manually or via one of the many terminal schemes available for import.
==============================================================================
4. Solarized Options *solarized-options*
AUTOGENERATE OPTIONS
You can easily modify and experiment with Solarized display options using the
Solarized menu when using Vim in gui mode. Once you have things set to your
liking, you can autogenerate the current option list in a format ready for
insertion into your .vimrc file using the Solarized menu "Autogenerate
Options" command or at the command line with:
:SolarizedOptions
OPTION LIST
Set these in your vimrc file prior to calling the colorscheme.
option name default optional
------------------------------------------------
g:solarized_termcolors= 16 | 256
g:solarized_termtrans = 0 | 1
g:solarized_degrade = 0 | 1
g:solarized_bold = 1 | 0
g:solarized_underline = 1 | 0
g:solarized_italic = 1 | 0
g:solarized_contrast = "normal"| "high" or "low"
g:solarized_visibility= "normal"| "high" or "low"
g:solarized_hitrail = 0 | 1
g:solarized_menu = 1 | 0
------------------------------------------------
OPTION DETAILS
------------------------------------------------
g:solarized_termcolors= 256 | 16 *'solarized_termcolors'*
------------------------------------------------
The most important option if you are using vim in terminal (non gui) mode!
This tells Solarized to use the 256 degraded color mode if running in a 256
color capable terminal. Otherwise, if set to `16` it will use the terminal
emulators colorscheme (best option as long as you've set the emulators colors
to the Solarized palette).
If you are going to use Solarized in Terminal mode (i.e. not in a GUI
version like gvim or macvim), **please please please** consider setting your
terminal emulator's colorscheme to used the Solarized palette. I've included
palettes for some popular terminal emulator as well as Xdefaults in the
official Solarized download available from:
http://ethanschoonover.com/solarized . If you use Solarized without these
colors, Solarized will by default use an approximate set of 256 colors. It
isn't bad looking and has been extensively tweaked, but it's still not quite
the real thing.
------------------------------------------------
g:solarized_termtrans = 0 | 1 *'solarized_termtrans'*
------------------------------------------------
If you use a terminal emulator with a transparent background and Solarized
isn't displaying the background color transparently, set this to 1 and
Solarized will use the default (transparent) background of the terminal
emulator. *urxvt* required this in my testing; iTerm2 did not.
Note that on Mac OS X Terminal.app, solarized_termtrans is set to 1 by
default as this is almost always the best option. The only exception to this
is if the working terminfo file supports 256 colors (xterm-256color).
------------------------------------------------
g:solarized_degrade = 0 | 1 *'solarized_degrade'*
------------------------------------------------
For test purposes only; forces Solarized to use the 256 degraded color mode
to test the approximate color values for accuracy.
------------------------------------------------
g:solarized_bold = 1 | 0 *'solarized_bold'*
------------------------------------------------
------------------------------------------------
g:solarized_underline = 1 | 0 *'solarized_underline'*
------------------------------------------------
------------------------------------------------
g:solarized_italic = 1 | 0 *'solarized_italic'*
------------------------------------------------
If you wish to stop Solarized from displaying bold, underlined or
italicized typefaces, simply assign a zero value to the appropriate
variable, for example: `let g:solarized_italic=0`
------------------------------------------------
g:solarized_contrast = "normal"| "high" or "low" *'solarized_contrast'*
------------------------------------------------
Stick with normal! It's been carefully tested. Setting this option to high
or low does use the same Solarized palette but simply shifts some values up
or down in order to expand or compress the tonal range displayed.
------------------------------------------------
g:solarized_visibility = "normal"| "high" or "low" *'solarized_visibility'*
------------------------------------------------
Special characters such as trailing whitespace, tabs, newlines, when
displayed using ":set list" can be set to one of three levels depending on
your needs.
------------------------------------------------
g:solarized_hitrail = 0 | 1 *'solarized_hitrail'*
------------------------------------------------
Visibility can make listchar entities more visible, but if one has set
cursorline on, these same listchar values standout somewhat less due to the
background color of the cursorline. g:solarized_hitrail enables highlighting
of trailing spaces (only one of the listchar types, but a particularly
important one) while in the cursoline in a different manner in order to make
them more visible. This may not work consistently as Solarized is using
a pattern match than can be overridden by a more encompassing syntax-native
match such as a comment line.
------------------------------------------------
g:solarized_menu = 1 | 0 *'solarized_menu'*
------------------------------------------------
Solarized includes a menu providing access to several of the above
display related options, including contrast and visibility. This allows
for an easy method of testing different values quickly before settling
on a final assignment for your .vimrc. If you wish to turn off this menu,
assign g:solarized_menu a value of 0.
vim:tw=78:noet:ts=8:ft=help:norl:

View file

@ -1 +0,0 @@
*.swp

View file

@ -1,49 +0,0 @@
# VIM-LESS
This vim bundle adds syntax highlighting, indenting and autocompletion for the dynamic stylesheet language [LESS](http://lesscss.org).
This bundle is compatible with [vim-css-color](https://github.com/skammer/vim-css-color),
[vim-css3-syntax](https://github.com/hail2u/vim-css3-syntax) and possibly other plugins that place code
in `after/syntax/css.vim` or `after/syntax/css/*.vim`.
![vim-less with vim-css-color and vim-css3-syntax (colorscheme solarized)](https://github.com/lenniboy/vim-less/raw/master/screenshot.png)
## Installing and Using
- Install [pathogen](http://www.vim.org/scripts/script.php?script_id=2332) into `~/.vim/autoload/` and add the
following line to your `~/.vimrc`:
call pathogen#infect()
- Make a clone of the `vim-less` repository:
$ mkdir -p ~/.vim/bundle
$ cd ~/.vim/bundle
$ git clone https://github.com/groenewege/vim-less
- OR use [vundle](https://github.com/gmarik/vundle), adding this line to your `~/.vimrc`:
Bundle 'groenewege/vim-less'
- OR use git submodules:
$ git submodule add https://github.com/groenewege/vim-less.git bundle/vim-less
$ git submodule init
### Map
.less to .css , lessc is required.
nnoremap <Leader>m :w <BAR> !lessc % > %:t:r.css<CR><space>
## Credits
Inspiration from [vim-haml](https://github.com/tpope/vim-haml),
[scss-syntax.vim](https://github.com/cakebaker/scss-syntax.vim) and
[vim-less](https://github.com/lunaru/vim-less)
## License ##
MIT : [groenewege.mit-license.org](http://groenewege.mit-license.org/)

View file

@ -1 +0,0 @@
autocmd BufNewFile,BufRead *.less setf less

View file

@ -1,25 +0,0 @@
" Vim filetype plugin
" Language: LessCSS
" Author: Tim Pope <vimNOSPAM@tpope.org>
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Last Change: 2011 Sep 30
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
setlocal iskeyword+=-
setlocal commentstring=//\ %s
setlocal define=^\\s*\\%(@mixin\\\|=\\)
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
setlocal omnifunc=csscomplete#CompleteCSS
setlocal suffixesadd=.less
setlocal comments=s1:/*,mb:*,ex:*/
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
" vim:set sw=2:

View file

@ -1,10 +0,0 @@
" Vim indent file
" Language: LessCSS
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Last Change: 2011 Sep 26
if exists("b:did_indent")
finish
endif
runtime! indent/css.vim

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

View file

@ -1,64 +0,0 @@
if exists("b:current_syntax")
finish
endif
runtime! syntax/css.vim
runtime! after/syntax/css.vim
" load files from vim-css3-syntax plugin (https://github.com/hail2u/vim-css3-syntax)
runtime! after/syntax/css/*.vim
syn case ignore
syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,lessNestedSelector,@cssColors fold
syn match lessVariable "@[[:alnum:]_-]\+" contained
syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessVariableAssignment skipwhite
syn match lessVariableAssignment ":" contained nextgroup=lessVariableValue skipwhite
syn match lessVariableValue ".*;"me=e-1 contained contains=lessVariable,lessOperator,lessDefault,cssValue.*,@cssColors "me=e-1 means that the last char of the pattern is not highlighted
syn match lessOperator "+" contained
syn match lessOperator "-" contained
syn match lessOperator "/" contained
syn match lessOperator "*" contained
syn match lessNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,lessAmpersandChar,lessVariable,lessMixinChar,lessFunction,lessNestedProperty
syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained
syn match lessDefault "!default" contained
syn match lessMixinChar "\.[[:alnum:]_-]\@=" contained nextgroup=lessClass
syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass
syn match lessClass "[[:alnum:]_-]\+" contained
" functions {{{
" string functions
syn keyword lessFunction escape e % containedin=cssDefinition contained
" misc functions
syn keyword lessFunction unit containedin=cssDefinition contained
" math functions
syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained
" color definition
syn keyword lessFunction rgb rgba argb hsl hsla hsv hsva containedin=cssDefinition contained
" color channel information
syn keyword lessFunction hue saturation lightness red green blue alpha luma containedin=cssDefinition contained
" color operations
syn keyword lessFunction saturate desaturate lighten darken fadein fadeout fade spin mix greyscale contrast containedin=cssDefinition contained
" color blending
syn keyword lessFunction multiply screen overlay softlight hardlight difference exclusion average negation containedin=cssDefinition contained
" }}}
syn match lessComment "//.*$" contains=@Spell
hi def link lessVariable Special
hi def link lessVariableValue Constant
hi def link lessDefault Special
hi def link lessComment Comment
hi def link lessFunction Function
hi def link lessMixinChar Special
hi def link lessAmpersandChar Special
hi def link lessNestedProperty Type
hi def link lessClass PreProc
let b:current_syntax = "less"

View file

@ -1,2 +0,0 @@
--color
--format d

View file

@ -1,7 +0,0 @@
language: ruby
rvm:
- 1.9.3
before_install: sudo apt-get install vim-gtk
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

View file

@ -1,109 +0,0 @@
## 2.2 (06/10/2013)
Bugfixes:
- Fix plugin break in PASTE mode. This fixes #44.
## 2.1 (04/26/2013)
Bugfixes:
- Fix 1 regression where cursors could potentially get out of sync in insert mode
Features:
- Added some logic to debug latency. Fanning out to 30 cursors in insert mode with my vimrc took over 300ms. It's like than 20ms with a plain vimrc. Need to debug what setting is causing the slowing down in insert mode and inform users.
## 2.0 (04/24/2013)
Bugfixes:
- Fix inconsistent undo behavior. Changes made in multicursor insert mode are now undone together. This fixes #22.
- Single key commands that do not terminate properly no longer cause ghostly cursors to linger on screen. An error message is now displayed informing the user the number of cursor locations that the input cannot be properly played back at. This fixes #28.
## 1.16 (04/23/2013)
Features:
- Add integration tests using vimrunner. Hook up travis-ci to run continous integration on commit.
## 1.15 (04/22/2013)
Bugfixes:
- Fix plugin causing error bell. This fixes #29.
## 1.14 (04/22/2013)
Features:
- Allow users to separate start key from next key. (credit: @xanderman)
## 1.13 (04/22/2013)
Bugfixes:
- Add support for switching to visual line mode from inside multicursor mode
- Fix highlight issue where extra character at end of line is highlighted for visual selections covering more than 2 lines.
## 1.12 (04/19/2013)
Bugfixes:
- Fix tab character causing highlight errors. This fixes #18 and fixes #32
## 1.11 (04/18/2013)
Bugfixes:
- Fix regression where `C-n` doesn't exhibit correct behavior when all matches have been found
- Clear echo messages when a new input is received
## 1.10 (04/17/2013)
Bugfixes:
- `O` works now in normal mode. This fixes #24
- Turn on `lazyredraw` during multicursor mode to prevent the sluggish screen redraws
Features:
- Add command **MultipleCursorsFind** to add multiple virtual cursors using regexp. This closes #20
## 1.9 (04/17/2013)
Bugfixes:
- Fix starting multicursor mode in visual line mode. This fixes #25
- Major refactoring to avoid getting in and out of visual mode as much as possible
## 1.8 (04/16/2013)
Bugfixes:
- Fix regression that causes call stack to explode with too many cursors
## 1.7 (04/15/2013)
Bugfixes:
- Finally fix the annoying highlighting problem when the last virtual cursor is on the last character of the line. The solution is a hack, but it should be harmless
## 1.6 (04/15/2013)
Bugfixes:
- Stop chaining dictionary function calls. This fixes #10 and #11
## 1.5 (04/15/2013)
Bugfixes:
- Exit Vim's visual mode before waiting for user's next input. This fixes #14
## 1.4 (04/14/2013)
Bugfixes:
- Don't use clearmatches(). It clears highlighting from other plugins. This fixes #13
## 1.3 (04/14/2013)
Bugfixes:
- Change mapping from using expression-quote syntax to using raw strings
## 1.2 (04/14/2013)
Bugfixes:
- Restore view when exiting from multicursor mode. This fixes #5
- Remove the unnecessary user level mapping for 'prev' and 'skip' in visual mode, since we can purely detect those keys from multicursor mode
## 1.1 (04/14/2013)
Bugfixes:
- Stop hijacking escape key in normal mode. This fixes #1, #2, and #3
## 1.0 (04/13/2013)
Initial release

View file

@ -1,4 +0,0 @@
source 'https://rubygems.org'
gem 'vimrunner'
gem 'rake'
gem 'rspec'

View file

@ -1,22 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.4)
rake (10.0.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
vimrunner (0.3.0)
PLATFORMS
ruby
DEPENDENCIES
rake
rspec
vimrunner

View file

@ -1,20 +0,0 @@
Copyright 2013 Terry Ma
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.

View file

@ -1,112 +0,0 @@
# vim-multiple-cursors [![Build Status](https://travis-ci.org/terryma/vim-multiple-cursors.png)](https://travis-ci.org/terryma/vim-multiple-cursors)
## About
[There](https://github.com/paradigm/vim-multicursor) [have](https://github.com/felixr/vim-multiedit) [been](https://github.com/hlissner/vim-multiedit) [many](https://github.com/adinapoli/vim-markmultiple) [attempts](https://github.com/AndrewRadev/multichange.vim) at bringing Sublime Text's awesome [multiple selection][sublime-multiple-selection] feature into Vim, but none so far have been in my opinion a faithful port that is simplistic to use, yet powerful and intuitive enough for an existing Vim user. [vim-multiple-cursors] is yet another attempt at that.
### It's great for quick refactoring
![Example1](assets/example1.gif?raw=true)
### Add a cursor to each line of your visual selection
![Example2](assets/example2.gif?raw=true)
### Do it backwards too! This is not just a replay of the above gif :)
![Example3](assets/example3.gif?raw=true)
### Add multiple cursors using regexes
![Example4](assets/example4.gif?raw=true)
To see what keystrokes are used for the above example, see [this issue](https://github.com/terryma/vim-multiple-cursors/issues/39).
## Features
- Live update in Insert mode
- One key to rule it all! See [Quick Start](#quick-start) on what the key does in different scenarios
- Works in Normal, Insert, and Visual mode for SINGLE key command
## Installation
Install using [Pathogen], [Vundle], [Neobundle], or your favorite Vim package manager.
## Quick Start
Out of the box, all you need to know is a single key `Ctrl-n`. Pressing the key in Normal mode highlights the current word under the cursor in Visual mode and places a virtual cursor at the end of it. Pressing it again finds the next ocurrence and places another virtual cursor at the end of the visual selection. If you select multiple lines in Visual mode, pressing the key puts a virtual cursor at every line and leaves you in Normal mode.
After you've marked all your locations with `Ctrl-n`, you can change the visual selection with normal Vim motion commands in Visual mode. You could go to Normal mode by pressing `v` and wield your motion commands there. Single key command to switch to Insert mode such as `c` or `s` from Visual mode or `i`, `a`, `I`, `A` in Normal mode should work without any issues.
At any time, you can press `<Esc>` to exit back to regular Vim.
Two additional keys are also mapped:
- `Ctrl-p` in Visual mode will remove the current virtual cursor and go back to the previous virtual cursor location. This is useful if you are trigger happy with `Ctrl-n` and accidentally went too far.
- `Ctrl-x` in Visual mode will remove the current virtual cursor and skip to the next virtual cursor location. This is useful if you don't want the current selection to be a candidate to operate on later.
You can also add multiple cursors using a regular expression. The command `MultipleCursorsFind` accepts a range and a pattern, and it will create a virtual cursor at the end of every match within the range. If no range is passed in, then it defaults to the entire buffer.
**NOTE:** If at any time you have lingering cursors on screen, you can press `Ctrl-n` in Normal mode and it will remove all prior cursors before starting a new one.
## Mapping
Out of the box, only the single key `Ctrl-n` is mapped in regular Vim's Normal mode and Visual mode to provide the functionality mentioned above. `Ctrl-n`, `Ctrl-p`, `Ctrl-x`, and `<Esc>` are mapped in the special multicursor mode once you've added at least one virtual cursor to the buffer. If you don't like the plugin taking over your favorite key bindings, you can turn off the default with
```
let g:multi_cursor_use_default_mapping=0
```
You can then map the 'next', 'previous', 'skip', and 'exit' keys like the following:
```
" Default mapping
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
```
By default, the 'next' key is also used to enter multicursor mode. If you want to use a different key to start multicursor mode than for selecting the next location, do like the following:
```
" Map start key separately from next key
let g:multi_cursor_start_key='<F6>'
```
**IMPORTANT:** Please note that currently only single keystrokes and special keys can be mapped. This contraint is also the reason why multikey commands such as `ciw` do not work and cause unexpected behavior in Normal mode. This means that a mapping like `<Leader>n` will NOT work correctly. For a list of special keys that are supported, see `help :key-notation`
**NOTE:** Please make sure to always map something to `g:multi_cursor_quit_key`, otherwise you'll have a tough time quitting from multicursor mode.
**NOTE:** Prior to version 1.3, the recommended way to map the keys is using the expressoin quote syntax in Vim, using something like `"\<C-n>"` or `"\<Esc>"` (see h: expr-quote). After 1.3, the recommended way is to use a raw string like above. If your key mappings don't appear to work, give the new syntax a try.
## Setting
Currently there're two additional global settings one can tweak:
### ```g:multi_cursor_exit_from_visual_mode``` (Default: 1)
If set to 0, then pressing `g:multi_cursor_quit_key` in _Visual_ mode will not quit and delete all existing cursors. This is useful if you want to press Escape and go back to Normal mode, and still be able to operate on all the cursors.
### ```g:multi_cursor_exit_from_insert_mode``` (Default: 1)
If set to 0, then pressing `g:multi_cursor_quit_key` in _Insert_ mode will not quit and delete all existing cursors. This is useful if you want to press Escape and go back to Normal mode, and still be able to operate on all the cursors.
### Highlight
The plugin uses the highlight group `multiple_cursors_cursor` and `multiple_cursors_visual` to highlight the virtual cursors and their visual selections respectively. You can customize them by putting something similar like the following in your vimrc:
```
" Default highlighting (see help :highlight and help :highlight-link)
highlight multiple_cursors_cursor term=reverse cterm=reverse gui=reverse
highlight link multiple_cursors_visual Visual
```
## Issues
- Multi key commands like `ciw` do not work at the moment
- All user input typed before Vim is able to fan out the last operation to all cursors is lost. This is a implementation decision to keep the input perfectly synced in all locations, at the cost of potentially losing user input.
- Select mode is not implemented
## Changelog
See [CHANGELOG.md](CHANGELOG.md)
## Contributing
As one can see, there're still many issues to be resolved, patches and suggestions are always welcome! A list of open feature requests can be found [here](../../issues?labels=enhancement&state=open).
## Credit
Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selection] feature, also encouraged by Emac's [multiple cursors][emacs-multiple-cursors] implemetation by Magnar Sveen
[vim-multiple-cursors]:http://github.com/terryma/vim-multiple-cursors
[sublime-multiple-selection]:http://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html
[Pathogen]:http://github.com/tpope/vim-pathogen
[Vundle]:http://github.com/gmarik/vundle
[Neobundle]:http://github.com/Shougo/neobundle.vim
[emacs-multiple-cursors]:https://github.com/magnars/multiple-cursors.el
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/terryma/vim-multiple-cursors/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

View file

@ -1,11 +0,0 @@
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/multiple_cursors_spec.rb'
end
RSpec::Core::RakeTask.new(:benchmark) do |t|
t.pattern = 'spec/benchmark_spec.rb'
end
task :default => :spec

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,198 +0,0 @@
*vim-multiple-cursors.txt* True Sublime Text multiple selection in Vim
____ _ __
____ ___ __ __/ / /_(_)___ / /__ _______ ________________ __________
/ __ `__ \/ / / / / __/ / __ \/ / _ \ / ___/ / / / ___/ ___/ __ \/ ___/ ___/
/ / / / / / /_/ / / /_/ / /_/ / / __/ / /__/ /_/ / / (__ ) /_/ / / (__ )
/_/ /_/ /_/\__,_/_/\__/_/ .___/_/\___/ \___/\__,_/_/ /____/\____/_/ /____/
/_/
Reference Manual~
==============================================================================
CONTENTS *multiple-cursors-contents*
1.Intro...................................|multiple-cursors-intro|
2.Usage...................................|multiple-cursors-usage|
3.Mappings................................|multiple-cursors-mappings|
4.Global Options..........................|multiple-cursors-global-options|
5.Issues..................................|multiple-cursors-issues|
6.Contributing............................|multiple-cursors-contributing|
7.License.................................|multiple-cursors-license|
8.Credit..................................|multiple-cursors-credit|
9.References..............................|multiple-cursors-references|
==============================================================================
1. Intro *multiple-cursors-intro*
There [1] have [2] been [3] many [4] attempts [5] at bringing Sublime Text's
awesome multiple selection [6] feature into Vim, but none so far have been in
my opinion a faithful port that is simplistic to use, yet powerful and
intuitive enough for an existing Vim user. *vim-multiple-cursors* is yet
another attempt at that.
==============================================================================
2. Usage *multiple-cursors-usage*
Out of the box, all you need to know is a single key CTRL-N. Pressing the key
in Normal mode highlights the current word under the cursor in Visual mode and
places a virtual cursor at the end of it. Pressing it again finds the next
ocurrence and places another virtual cursor at the end of the visual
selection. If you select multiple lines in Visual mode, pressing the key puts
a virtual cursor at every line and leaves you in Normal mode.
After you've marked all your locations with CTRL-N, you can change the visual
selection with normal Vim motion commands in Visual mode. You could go to
Normal mode by pressing v and wield your motion commands there. Single key
command to switch to Insert mode such as `c` or `s` from Visual mode or `i`,
`a`, `I`, `A` in Normal mode should work without any issues.
At any time, you can press <Esc> to exit back to regular Vim.
Two additional keys are also mapped:
CTRL-P in Visual mode will remove the current virtual cursor and go back to
the previous virtual cursor location. This is useful if you are trigger happy
with Ctrl-n and accidentally went too far.
CTRL-X in Visual mode will remove the current virtual cursor and skip to the
next virtual cursor location. This is useful if you don't want the current
selection to be a candidate to operate on later.
You can also add multiple cursors using a regular expression. The command
*MultipleCursorsFind* accepts a range and a pattern, and it will create a
virtual cursor at the end of every match within the range. If no range is
passed in, then it defaults to the entire buffer.
NOTE: If at any time you have lingering cursors on screen, you can press
CTRL-N in Normal mode and it will remove all prior cursors before starting a
new one.
==============================================================================
3. Mappings *multiple-cursors-mappings*
*g:multi_cursor_use_default_mapping* (Default: 1)
Out of the box, only the single key CTRL-N is mapped in regular Vim's Normal
mode and Visual mode to provide the functionality mentioned above. CTRL-N,
CTRL-P, CTRL-X, and <ESC> are mapped in the special multicursor mode once
you've added at least one virtual cursor to the buffer. If you don't like the
plugin taking over your favorite key bindings, you can turn off the default
with >
let g:multi_cursor_use_default_mapping=0
<
*g:multi_cursor_next_key* (Default: '<C-n>')
*g:multi_cursor_prev_key* (Default: '<C-p>')
*g:multi_cursor_skip_key* (Default: '<C-x>')
*g:multi_cursor_quit_key* (Default: '<Esc>')
You can map the 'next', 'previous', 'skip', and 'exit' keys like the
following: >
" Default mapping
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
<
*g:multi_cursor_start_key* (Default: 'g:multi_cursor_next_key')
By default, the same key is used to enter multicursor mode as to select the
next cursor location. If you want to use a different key to start multicursor
mode than for selecting the next location, do like the following: >
" Map start key separately from next key
let g:multi_cursor_start_key='<F6>'
<
IMPORTANT: Please note that currently only single keystroes and special
keys can be mapped. This contraint is also the reason why multikey commands
such as `ciw` do not work and cause unexpected behavior in Normal mode. This
means that a mapping like `<Leader>n` will NOT work correctly. For a list of
special keys that are supported, see |key-notation|
NOTE: Please make sure to always map something to |g:multi_cursor_quit_key|,
otherwise you'll have a tough time quitting from multicursor mode.
NOTE: Prior to version 1.3, the recommended way to map the keys is using the
expressoin quote syntax in Vim, using something like `"\<C-n>"` or `"\<Esc>"`
(see h: expr-quote). After 1.3, the recommended way is to use a raw string
like above. If your key mappings don't appear to work, give the new syntax a
try.
==============================================================================
4. Global Options *multiple-cursors-global-options*
Currently there're two additional global settings one can tweak:
*g:multi_cursor_exit_from_visual_mode* (Defaut: 1)
If set to 0, then pressing |g:multi_cursor_quit_key| in Visual mode will not
quit and delete all existing cursors. This is useful if you want to press
Escape and go back to Normal mode, and still be able to operate on all the
cursors.
*g:multi_cursor_exit_from_insert_mode* (Default: 1)
If set to 0, then pressing |g:multi_cursor_quit_key| in Insert mode will not
quit and delete all existing cursors. This is useful if you want to press
Escape and go back to Normal mode, and still be able to operate on all the
cursors.
The plugin uses the highlight group `multiple_cursors_cursor` and
`multiple_cursors_visual` to highlight the virtual cursors and their visual
selections respectively. You can customize them by putting something similar
like the following in your vimrc: >
" Default highlighting (see help :highlight and help :highlight-link)
highlight multiple_cursors_cursor term=reverse cterm=reverse gui=reverse
highlight link multiple_cursors_visual Visual
<
==============================================================================
5. Issues *multiple-cursors-issues*
- Multi key commands like ciw do not work at the moment
- All user input typed before Vim is able to fan out the last operation to all
cursors is lost. This is a implementation decision to keep the input
perfectly synced in all locations, at the cost of potentially losing user
input.
- Select mode is not implemented
==============================================================================
6. Contributing *multiple-cursors-contributing*
The project is hosted on Github. Patches, feature requests and suggestions are
always welcome!
Find the latest version of the plugin here:
http://github.com/terryma/vim-multiple-cursors
==============================================================================
7. License *multiple-cursors-license*
The project is licensed under the MIT license [7]. Copyrigth 2013 Terry Ma
==============================================================================
8. Credit *multiple-cursors-credit*
The plugin is obviously inspired by Sublime Text's awesome multiple selection
[6] feature. Some inspiration was also taken from Emac's multiple cursors [8]
implementation.
==============================================================================
9. References *multiple-cursors-references*
[1] https://github.com/paradigm/vim-multicursor
[2] https://github.com/felixr/vim-multiedit
[3] https://github.com/hlissner/vim-multiedit
[4] https://github.com/adinapoli/vim-markmultiple
[5] https://github.com/AndrewRadev/multichange.vim
[6] http://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html
[7] http://opensource.org/licenses/MIT
[8] https://github.com/magnars/multiple-cursors.el
vim:tw=78:sw=4:ft=help:norl:

View file

@ -1,66 +0,0 @@
"===============================================================================
" File: multiple_cursors.vim
" Author: Terry Ma
" Description: Emulate Sublime Text's multi selection feature
" Potential Features:
" - Create a blinking cursor effect? Good place to do it would be instead of
" waiting for user input, cycle through the highlight
" - Integrate with the status line? Maybe show a special multicursor mode?
" - Support mouse? Ctrl/Cmd click to set cursor?
"===============================================================================
let s:save_cpo = &cpo
set cpo&vim
function! s:init_settings(settings)
for [key, value] in items(a:settings)
let sub = ''
if type(value) == 0
let sub = '%d'
elseif type(value) == 1
let sub = '"%s"'
endif
let fmt = printf("let g:multi_cursor_%%s=get(g:, 'multi_cursor_%%s', %s)",
\ sub)
exec printf(fmt, key, key, value)
endfor
endfunction
" Settings
let s:settings = {
\ 'exit_from_visual_mode': 1,
\ 'exit_from_insert_mode': 1,
\ 'use_default_mapping': 1,
\ 'debug_latency': 0,
\ }
let s:settings_if_default = {
\ 'quit_key': '<Esc>',
\ 'next_key': '<C-n>',
\ 'prev_key': '<C-p>',
\ 'skip_key': '<C-x>',
\ }
call s:init_settings(s:settings)
if g:multi_cursor_use_default_mapping
call s:init_settings(s:settings_if_default)
endif
if !exists('g:multi_cursor_start_key') && exists('g:multi_cursor_next_key')
let g:multi_cursor_start_key = g:multi_cursor_next_key
endif
" External mappings
if exists('g:multi_cursor_start_key')
exec 'nnoremap <silent> '.g:multi_cursor_start_key.
\' :call multiple_cursors#new("n")<CR>'
exec 'xnoremap <silent> '.g:multi_cursor_start_key.
\' :<C-u>call multiple_cursors#new("v")<CR>'
endif
" Commands
command! -nargs=1 -range=% MultipleCursorsFind
\ call multiple_cursors#find(<line1>, <line2>, <q-args>)
let &cpo = s:save_cpo
unlet s:save_cpo

View file

@ -1,141 +0,0 @@
require 'vimrunner'
require 'vimrunner/rspec'
Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite. Set to false to use an
# instance per test (slower, but can be easier to manage).
config.reuse_server = false
# Decide how to start a Vim instance. In this block, an instance should be
# spawned and set up with anything project-specific.
config.start_vim do
# vim = Vimrunner.start
# vim = Vimrunner::Server.new("/usr/local/bin/vim").start
# Or, start a GUI instance:
vim = Vimrunner.start_gvim
# Setup your plugin in the Vim instance
plugin_path = File.expand_path('../..', __FILE__)
vim.add_plugin(plugin_path, 'plugin/multiple_cursors.vim')
# The returned value is the Client available in the tests.
vim
end
end
def set_file_content(string)
string = normalize_string_indent(string)
File.open(filename, 'w'){ |f| f.write(string) }
vim.edit filename
end
def get_file_content()
vim.write
IO.read(filename).strip
end
def before(string)
set_file_content(string)
end
def after(string)
get_file_content().should eq normalize_string_indent(string)
type ":q<CR>"
end
def type(string)
string.scan(/<.*?>|./).each do |key|
if /<.*>/.match(key)
vim.feedkeys "\\#{key}"
else
vim.feedkeys key
end
end
sleep 0.2
end
describe "Multiple Cursors" do
let(:filename) { 'test.txt' }
specify "#benchmark" do
before <<-EOF
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
EOF
# type ':profile start /tmp/test.result<CR>'
# type ':profile! file *multiple_cursors.vim<CR>'
type ':let g:multi_cursor_debug_latency=1<CR>'
type 'VG<C-n>Vchellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello<Esc>'
type ':echo multiple_cursors#get_latency_debug_file()<CR>'
sleep 3
latency_file = vim.command 'echo multiple_cursors#get_latency_debug_file()'
puts 'latency file = ' + latency_file
after <<-EOF
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
EOF
end
end

View file

@ -1,288 +0,0 @@
require 'spec_helper'
def set_file_content(string)
string = normalize_string_indent(string)
File.open(filename, 'w'){ |f| f.write(string) }
vim.edit filename
end
def get_file_content()
vim.write
IO.read(filename).strip
end
def before(string)
set_file_content(string)
end
def after(string)
get_file_content().should eq normalize_string_indent(string)
end
def type(string)
string.scan(/<.*?>|./).each do |key|
if /<.*>/.match(key)
vim.feedkeys "\\#{key}"
else
vim.feedkeys key
end
end
end
describe "Multiple Cursors" do
let(:filename) { 'test.txt' }
specify "#multiline replacement" do
before <<-EOF
hello
hello
hello
EOF
type '<C-n><C-n><C-n>cworld<Esc>'
after <<-EOF
world
world
world
EOF
end
specify "#single line replacement" do
before <<-EOF
hello hello hello
EOF
type '<C-n><C-n><C-n>cworld<Esc>'
after <<-EOF
world world world
EOF
end
specify "#mixed line replacement" do
before <<-EOF
hello hello
hello
EOF
type '<C-n><C-n><C-n>cworld<Esc>'
after <<-EOF
world world
world
EOF
end
specify "#new line in insert mode" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>chello<CR>world<Esc>'
after <<-EOF
hello
world
hello
world
EOF
end
specify "#new line in insert mode middle of line" do
before <<-EOF
hello world
hello world
EOF
type '<C-n><C-n>vlxi<cr><Esc>'
after <<-EOF
hello
world
hello
world
EOF
end
specify "#normal mode 'o'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>voworld<Esc>'
after <<-EOF
hello
world
hello
world
EOF
end
specify "#normal mode 'O'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vOworld<Esc>'
after <<-EOF
world
hello
world
hello
EOF
end
specify "#find command basic" do
before <<-EOF
hello
hello
EOF
vim.normal ':MultipleCursorsFind hello<CR>'
type 'cworld<Esc>'
after <<-EOF
world
world
EOF
end
specify "#visual line mode replacement" do
before <<-EOF
hello world
hello world
EOF
type '<C-n><C-n>Vchi!<Esc>'
after <<-EOF
hi!
hi!
EOF
end
specify "#skip key" do
before <<-EOF
hello
hello
hello
EOF
type '<C-n><C-n><C-x>cworld<Esc>'
after <<-EOF
world
hello
world
EOF
end
specify "#prev key" do
before <<-EOF
hello
hello
hello
EOF
type '<C-n><C-n><C-n><C-p>cworld<Esc>'
after <<-EOF
world
world
hello
EOF
end
specify "#normal mode 'I'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vIworld <Esc>'
after <<-EOF
world hello
world hello
EOF
end
specify "#normal mode 'A'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vA world<Esc>'
after <<-EOF
hello world
hello world
EOF
end
specify "#undo" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>cworld<Esc>u'
after <<-EOF
hello
hello
EOF
end
# 'd' is an operator pending command, which are not supported at the moment.
# This should result in a nop, but we should still remain in multicursor mode.
specify "#normal mode 'd'" do
before <<-EOF
hello
hello
EOF
type '<C-n><C-n>vdx<Esc>'
after <<-EOF
hell
hell
EOF
end
specify "#multiline visual mode" do
before <<-EOF
hello
hello
EOF
type 'Vj<C-n>A world<Esc>'
after <<-EOF
hello world
hello world
EOF
end
specify "#set paste mode" do
before <<-EOF
hello
hello
EOF
type ':set paste<CR><C-n><C-n>cworld<Esc>:set nopaste<CR>'
after <<-EOF
world
world
EOF
end
end

View file

@ -1,25 +0,0 @@
require 'vimrunner'
require 'vimrunner/rspec'
Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite. Set to false to use an
# instance per test (slower, but can be easier to manage).
config.reuse_server = true
# Decide how to start a Vim instance. In this block, an instance should be
# spawned and set up with anything project-specific.
config.start_vim do
# vim = Vimrunner.start
# Or, start a GUI instance:
vim = Vimrunner.start_gvim
# Setup your plugin in the Vim instance
plugin_path = File.expand_path('../..', __FILE__)
vim.add_plugin(plugin_path, 'plugin/multiple_cursors.vim')
# The returned value is the Client available in the tests.
vim
end
end

View file

@ -1,11 +0,0 @@
This is a version of Henning Hasemann's vim theme (http://www.vim.org/scripts/script.php?script_id=1492) packaged to work with Tim Pope's pathogen plugin (http://www.vim.org/scripts/script.php?script_id=2332).
To use it (assuming you're using pathogen):
- go to your bundle directory (.vim/bundle or .vimbundles) and clone the repo:
git clone git://github.com/therubymug/vim-pyte.git
- edit your .vimrc and add:
:colorscheme pyte

View file

@ -1,92 +0,0 @@
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "pyte"
if version >= 700
hi CursorLine guibg=#f6f6f6
hi CursorColumn guibg=#eaeaea
hi MatchParen guifg=white guibg=#80a090 gui=bold
"Tabpages
hi TabLine guifg=black guibg=#b0b8c0 gui=italic
hi TabLineFill guifg=#9098a0
hi TabLineSel guifg=black guibg=#f0f0f0 gui=italic,bold
"P-Menu (auto-completion)
hi Pmenu guifg=white guibg=#808080
"PmenuSel
"PmenuSbar
"PmenuThumb
endif
"
" Html-Titles
hi Title guifg=#202020 gui=bold
hi Underlined guifg=#202020 gui=underline
hi Cursor guifg=black guibg=#b0b4b8
hi lCursor guifg=black guibg=white
hi LineNr guifg=#ffffff guibg=#c0d0e0
hi Normal guifg=#202020 guibg=#f0f0f0
hi StatusLine guifg=white guibg=#8090a0 gui=bold,italic
hi StatusLineNC guifg=#506070 guibg=#a0b0c0 gui=italic
hi VertSplit guifg=#a0b0c0 guibg=#a0b0c0 gui=NONE
hi Folded guifg=#708090 guibg=#c0d0e0
hi NonText guifg=#c0c0c0 guibg=#e0e0e0
" Kommentare
hi Comment guifg=#a0b0c0 gui=italic
" Konstanten
hi Constant guifg=#a07040
hi String guifg=#4070a0
hi Number guifg=#40a070
hi Float guifg=#70a040
"hi Statement guifg=#0070e0 gui=NONE
" Python: def and so on, html: tag-names
hi Statement guifg=#007020 gui=bold
" HTML: arguments
hi Type guifg=#e5a00d gui=italic
" Python: Standard exceptions, True&False
hi Structure guifg=#007020 gui=italic
hi Function guifg=#06287e gui=italic
hi Identifier guifg=#5b3674 gui=italic
hi Repeat guifg=#7fbf58 gui=bold
hi Conditional guifg=#4c8f2f gui=bold
" Cheetah: #-Symbol, function-names
hi PreProc guifg=#1060a0 gui=NONE
" Cheetah: def, for and so on, Python: Decorators
hi Define guifg=#1060a0 gui=bold
hi Error guifg=red guibg=white gui=bold,underline
hi Todo guifg=#a0b0c0 guibg=NONE gui=italic,bold,underline
" Python: %(...)s - constructs, encoding
hi Special guifg=#70a0d0 gui=italic
hi Operator guifg=#408010
" color of <TAB>s etc...
hi SpecialKey guifg=#d8a080 guibg=#e8e8e8 gui=italic
" Diff
hi DiffChange guifg=NONE guibg=#e0e0e0 gui=italic,bold
hi DiffText guifg=NONE guibg=#f0c8c8 gui=italic,bold
hi DiffAdd guifg=NONE guibg=#c0e0d0 gui=italic,bold
hi DiffDelete guifg=NONE guibg=#f0e0b0 gui=italic,bold

View file

@ -1,166 +0,0 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=521
Overview
The Most Recently Used (MRU) plugin provides an easy access to a list of
recently opened/edited files in Vim. This plugin automatically stores the
file names as you open/edit them in Vim.
This plugin will work on all the platforms where Vim is supported. This
plugin will work in both console and GUI Vim. This version of the MRU
plugin needs Vim 7.0 and above. If you are using an earlier version of
Vim, then you should use an older version of the MRU plugin.
The recently used filenames are stored in a file specified by the Vim
MRU_File variable.
Usage
To list and edit files from the MRU list, you can use the ":MRU" command.
The ":MRU" command displays the MRU file list in a temporary Vim window. If
the MRU window is already opened, then the MRU list displayed in the window
is refreshed.
If you are using GUI Vim, then the names of the recently edited files are
added to the "File->Recent Files" menu. You can select the name of a file
from this sub-menu to edit the file.
You can use the normal Vim commands to move around in the MRU window. You
cannot make changes in the MRU window.
You can select a file name to edit by pressing the <Enter> key or by double
clicking the left mouse button on a file name. The selected file will be
opened. If the file is already opened in a window, the cursor will be moved
to that window. Otherwise, the file is opened in the previous window. If the
previous window has a modified buffer or is the preview window or is used by
some other plugin, then the file is opened in a new window.
You can press the 'o' key to open the file name under the cursor in the
MRU window in a new window.
To open a file from the MRU window in read-only mode (view), press the 'v'
key.
To open a file from the MRU window in a new tab, press the 't' key. If the
file is already opened in a window in the current or in another tab, then
the cursor is moved to that tab. Otherwise, a new tab is opened.
You can open multiple files from the MRU window by specifying a count before
pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually select
multiple filenames and invoke the commands to open the files. Each selected
file will be opened in a separate window or tab.
You can press the 'u' key in the MRU window to update the file list. This is
useful if you keep the MRU window open always.
You can close the MRU window by pressing the 'q' key or using one of the Vim
window commands.
To display only files matching a pattern from the MRU list in the MRU
window, you can specify a pattern to the ":MRU" command. For example, to
display only file names containing "vim" in them, you can use the following
command ":MRU vim". When you specify a partial file name and only one
matching filename is found, then the ":MRU" command will edit that file.
The ":MRU" command supports command-line completion of file names from
the MRU list. You can enter a partial file name and then press <Tab>
or <Ctrl-D> to complete or list all the matching file names. Note that
after typing the ":MRU" command, you have to enter a space before completing
the file names with <Tab>.
When a file supplied to the ":MRU" command is not present in the MRU list,
but it is a readable file, then the file will be opened (even though it is
not present in the MRU list). This is useful if you want to open a file
present in the same directory as a file in the MRU list. You can use the
command-line completion of the ":MRU" command to complete the full path of a
file and then modify the path to open another file present in the same path.
Whenever the MRU list changes, the MRU file is updated with the latest MRU
list. When you have multiple instances of Vim running at the same time, the
latest MRU list will show up in all the instances of Vim.
Configuration
By changing the following variables you can configure the behavior of this
plugin. Set the following variables in your .vimrc file using the 'let'
command.
The list of recently edited file names is stored in the file specified by the
MRU_File variable. The default setting for this variable is
$HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files
for MS-Windows systems. You can change this variable to point to a file by
adding the following line to the .vimrc file:
let MRU_File = 'd:\myhome\_vim_mru_files'
By default, the plugin will remember the names of the last 100 used files.
As you edit more files, old file names will be removed from the MRU list.
You can set the 'MRU_Max_Entries' variable to remember more file names. For
example, to remember 1000 most recently used file names, you can use
let MRU_Max_Entries = 1000
By default, all the edited file names will be added to the MRU list. If you
want to exclude file names matching a list of patterns, you can set the
MRU_Exclude_Files variable to a list of Vim regular expressions. By default,
this variable is set to an empty string. For example, to not include files
in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the
MRU_Exclude_Files variable to
let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix
let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows
The specified pattern should be a Vim regular expression pattern.
If you want to add only file names matching a set of patterns to the MRU
list, then you can set the MRU_Include_Files variable. This variable should
be set to a Vim regular expression pattern. For example, to add only .c and
.h files to the MRU list, you can set this variable as below:
let MRU_Include_Files = '\.c$\|\.h$'
By default, MRU_Include_Files is set to an empty string and all the edited
filenames are added to the MRU list.
The default height of the MRU window is 8. You can set the MRU_Window_Height
variable to change the window height.
let MRU_Window_Height = 15
By default, when the :MRU command is invoked, the MRU list will be displayed
in a new window. Instead, if you want the MRU plugin to reuse the current
window, then you can set the 'MRU_Use_Current_Window' variable to one.
let MRU_Use_Current_Window = 1
The MRU plugin will reuse the current window. When a file name is selected,
the file is also opened in the current window.
When you select a file from the MRU window, the MRU window will be
automatically closed and the selected file will be opened in the previous
window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU
window open.
let MRU_Auto_Close = 0
If you don't use the "File->Recent Files" menu and want to disable it,
then you can set the 'MRU_Add_Menu' variable to zero. By default, the
menu is enabled.
let MRU_Add_Menu = 0
If too many file names are present in the MRU list, then updating the MRU
menu to list all the file names makes Vim slow. To avoid this, the
MRU_Max_Menu_Entries variable controls the number of file names to show in
the MRU menu. By default, this is set to 10. You can change this to show
more entries in the menu.
let MRU_Max_Menu_Entries = 20
If many file names are present in the MRU list, then the MRU menu is split
into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names.
The default setting for this is 10. You can change this to increase the
number of file names displayed in a single sub-menu:
let MRU_Max_Submenu_Entries = 15

View file

@ -1,989 +0,0 @@
" File: mru.vim
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
" Version: 3.4
" Last Modified: April 13, 2012
" Copyright: Copyright (C) 2003-2012 Yegappan Lakshmanan
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
" mru.vim is provided *as is* and comes with no warranty of any
" kind, either expressed or implied. In no event will the copyright
" holder be liable for any damamges resulting from the use of this
" software.
"
" Overview
" --------
" The Most Recently Used (MRU) plugin provides an easy access to a list of
" recently opened/edited files in Vim. This plugin automatically stores the
" file names as you open/edit them in Vim.
"
" This plugin will work on all the platforms where Vim is supported. This
" plugin will work in both console and GUI Vim. This version of the MRU
" plugin needs Vim 7.0 and above. If you are using an earlier version of
" Vim, then you should use an older version of the MRU plugin.
"
" The recently used filenames are stored in a file specified by the Vim
" MRU_File variable.
"
" Installation
" ------------
" 1. Copy the mru.vim file to one of the following directories:
"
" $HOME/.vim/plugin - Unix like systems
" $HOME/vimfiles/plugin - MS-Windows
" $VIM:vimfiles:plugin - Macintosh
" $VIM/vimfiles/plugin - All
"
" Refer to the following Vim help topics for more information about Vim
" plugins:
"
" :help add-plugin
" :help add-global-plugin
" :help runtimepath
"
" 2. Set the MRU_File Vim variable in the .vimrc file to the location of a
" file to store the most recently edited file names. This step is needed
" only if you want to change the default MRU filename.
" 3. Restart Vim.
" 4. You can use the ":MRU" command to list and edit the recently used files.
" In GUI Vim, you can use the 'File->Recent Files' menu to access the
" recently used files.
"
" To uninstall this plugin, remove this file (mru.vim) from the
" $HOME/.vim/plugin or $HOME/vimfiles/plugin or the $VIM/vimfile/plugin
" directory.
"
" Usage
" -----
" To list and edit files from the MRU list, you can use the ":MRU" command.
" The ":MRU" command displays the MRU file list in a temporary Vim window. If
" the MRU window is already opened, then the MRU list displayed in the window
" is refreshed.
"
" If you are using GUI Vim, then the names of the recently edited files are
" added to the "File->Recent Files" menu. You can select the name of a file
" from this sub-menu to edit the file.
"
" You can use the normal Vim commands to move around in the MRU window. You
" cannot make changes in the MRU window.
"
" You can select a file name to edit by pressing the <Enter> key or by double
" clicking the left mouse button on a file name. The selected file will be
" opened. If the file is already opened in a window, the cursor will be moved
" to that window. Otherwise, the file is opened in the previous window. If the
" previous window has a modified buffer or is the preview window or is used by
" some other plugin, then the file is opened in a new window.
"
" You can press the 'o' key to open the file name under the cursor in the
" MRU window in a new window.
"
" To open a file from the MRU window in read-only mode (view), press the 'v'
" key.
"
" To open a file from the MRU window in a new tab, press the 't' key. If the
" file is already opened in a window in the current or in another tab, then
" the cursor is moved to that tab. Otherwise, a new tab is opened.
"
" You can open multiple files from the MRU window by specifying a count before
" pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually select
" multiple filenames and invoke the commands to open the files. Each selected
" file will be opened in a separate window or tab.
"
" You can press the 'u' key in the MRU window to update the file list. This is
" useful if you keep the MRU window open always.
"
" You can close the MRU window by pressing the 'q' key or using one of the Vim
" window commands.
"
" To display only files matching a pattern from the MRU list in the MRU
" window, you can specify a pattern to the ":MRU" command. For example, to
" display only file names matching "vim" in them, you can use the following
" command ":MRU vim". When you specify a partial file name and only one
" matching filename is found, then the ":MRU" command will edit that file.
"
" The ":MRU" command supports command-line completion of file names from
" the MRU list. You can enter a partial file name and then press <Tab>
" or <Ctrl-D> to complete or list all the matching file names. Note that
" after typing the ":MRU" command, you have to enter a space before completing
" the file names with <Tab>.
"
" When a file supplied to the ":MRU" command is not present in the MRU list,
" but it is a readable file, then the file will be opened (even though it is
" not present in the MRU list). This is useful if you want to open a file
" present in the same directory as a file in the MRU list. You can use the
" command-line completion of the ":MRU" command to complete the full path of a
" file and then modify the path to open another file present in the same path.
"
" Whenever the MRU list changes, the MRU file is updated with the latest MRU
" list. When you have multiple instances of Vim running at the same time, the
" latest MRU list will show up in all the instances of Vim.
"
" Configuration
" -------------
" By changing the following variables you can configure the behavior of this
" plugin. Set the following variables in your .vimrc file using the 'let'
" command.
"
" The list of recently edited file names is stored in the file specified by the
" MRU_File variable. The default setting for this variable is
" $HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files
" for MS-Windows systems. You can change this variable to point to a file by
" adding the following line to the .vimrc file:
"
" let MRU_File = 'd:\myhome\_vim_mru_files'
"
" By default, the plugin will remember the names of the last 100 used files.
" As you edit more files, old file names will be removed from the MRU list.
" You can set the 'MRU_Max_Entries' variable to remember more file names. For
" example, to remember 1000 most recently used file names, you can use
"
" let MRU_Max_Entries = 1000
"
" By default, all the edited file names will be added to the MRU list. If you
" want to exclude file names matching a list of patterns, you can set the
" MRU_Exclude_Files variable to a list of Vim regular expressions. By default,
" this variable is set to an empty string. For example, to not include files
" in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the
" MRU_Exclude_Files variable to
"
" let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix
" let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows
"
" The specified pattern should be a Vim regular expression pattern.
"
" If you want to add only file names matching a set of patterns to the MRU
" list, then you can set the MRU_Include_Files variable. This variable should
" be set to a Vim regular expression pattern. For example, to add only .c and
" .h files to the MRU list, you can set this variable as below:
"
" let MRU_Include_Files = '\.c$\|\.h$'
"
" By default, MRU_Include_Files is set to an empty string and all the edited
" filenames are added to the MRU list.
"
" The default height of the MRU window is 8. You can set the MRU_Window_Height
" variable to change the window height.
"
" let MRU_Window_Height = 15
"
" By default, when the :MRU command is invoked, the MRU list will be displayed
" in a new window. Instead, if you want the MRU plugin to reuse the current
" window, then you can set the 'MRU_Use_Current_Window' variable to one.
"
" let MRU_Use_Current_Window = 1
"
" The MRU plugin will reuse the current window. When a file name is selected,
" the file is also opened in the current window.
"
" When you select a file from the MRU window, the MRU window will be
" automatically closed and the selected file will be opened in the previous
" window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU
" window open.
"
" let MRU_Auto_Close = 0
"
" If you don't use the "File->Recent Files" menu and want to disable it,
" then you can set the 'MRU_Add_Menu' variable to zero. By default, the
" menu is enabled.
"
" let MRU_Add_Menu = 0
"
" If too many file names are present in the MRU list, then updating the MRU
" menu to list all the file names makes Vim slow. To avoid this, the
" MRU_Max_Menu_Entries variable controls the number of file names to show in
" the MRU menu. By default, this is set to 10. You can change this to show
" more entries in the menu.
"
" let MRU_Max_Menu_Entries = 20
"
" If many file names are present in the MRU list, then the MRU menu is split
" into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names.
" The default setting for this is 10. You can change this to increase the
" number of file names displayed in a single sub-menu:
"
" let MRU_Max_Submenu_Entries = 15
"
" ****************** Do not modify after this line ************************
if exists('loaded_mru')
finish
endif
let loaded_mru=1
if v:version < 700
finish
endif
" Line continuation used here
let s:cpo_save = &cpo
set cpo&vim
" MRU configuration variables {{{1
" Maximum number of entries allowed in the MRU list
if !exists('MRU_Max_Entries')
let MRU_Max_Entries = 100
endif
" Files to exclude from the MRU list
if !exists('MRU_Exclude_Files')
let MRU_Exclude_Files = ''
endif
" Files to include in the MRU list
if !exists('MRU_Include_Files')
let MRU_Include_Files = ''
endif
" Height of the MRU window
" Default height is 8
if !exists('MRU_Window_Height')
let MRU_Window_Height = 8
endif
if !exists('MRU_Use_Current_Window')
let MRU_Use_Current_Window = 0
endif
if !exists('MRU_Auto_Close')
let MRU_Auto_Close = 1
endif
if !exists('MRU_File')
if has('unix') || has('macunix')
let MRU_File = $HOME . '/.vim_mru_files'
else
let MRU_File = $VIM . '/_vim_mru_files'
if has('win32')
" MS-Windows
if $USERPROFILE != ''
let MRU_File = $USERPROFILE . '\_vim_mru_files'
endif
endif
endif
endif
" Option for enabling or disabling the MRU menu
if !exists('MRU_Add_Menu')
let MRU_Add_Menu = 1
endif
" Maximum number of file names to show in the MRU menu. If too many files are
" listed in the menu, then Vim becomes slow when updating the menu. So set
" this to a low value.
if !exists('MRU_Max_Menu_Entries')
let MRU_Max_Menu_Entries = 10
endif
" Maximum number of file names to show in a MRU sub-menu. If the MRU list
" contains more file names than this setting, then the MRU menu is split into
" one or more sub-menus.
if !exists('MRU_Max_Submenu_Entries')
let MRU_Max_Submenu_Entries = 10
endif
" When only a single matching filename is found in the MRU list, the following
" option controls whether the file name is displayed in the MRU window or the
" file is directly opened. When this variable is set to 0 and a single
" matching file name is found, then the file is directly opened.
if !exists('MRU_Window_Open_Always')
let MRU_Window_Open_Always = 0
endif
" When opening a file from the MRU list, the file is opened in the current
" tab. If the selected file has to be opened in a tab always, then set the
" following variable to 1. If the file is already opened in a tab, then the
" cursor will be moved to that tab.
if !exists('MRU_Open_File_Use_Tabs')
let MRU_Open_File_Use_Tabs = 0
endif
" Control to temporarily lock the MRU list. Used to prevent files from
" getting added to the MRU list when the ':vimgrep' command is executed.
let s:mru_list_locked = 0
" MRU_LoadList {{{1
" Loads the latest list of file names from the MRU file
function! s:MRU_LoadList()
" If the MRU file is present, then load the list of filenames. Otherwise
" start with an empty list.
if filereadable(g:MRU_File)
let s:MRU_files = readfile(g:MRU_File)
if s:MRU_files[0] =~# '^\s*" Most recently edited files in Vim'
" Generated by the previous version of the MRU plugin.
" Discard the list.
let s:MRU_files = []
elseif s:MRU_files[0] =~# '^#'
" Remove the comment line
call remove(s:MRU_files, 0)
else
" Unsupported format
let s:MRU_files = []
endif
else
let s:MRU_files = []
endif
" Refresh the MRU menu with the latest list of filenames
call s:MRU_Refresh_Menu()
endfunction
" MRU_SaveList {{{1
" Saves the MRU file names to the MRU file
function! s:MRU_SaveList()
let l = []
call add(l, '# Most recently edited files in Vim (version 3.0)')
call extend(l, s:MRU_files)
call writefile(l, g:MRU_File)
endfunction
" MRU_AddFile {{{1
" Adds a file to the MRU file list
" acmd_bufnr - Buffer number of the file to add
function! s:MRU_AddFile(acmd_bufnr)
if s:mru_list_locked
" MRU list is currently locked
return
endif
" Get the full path to the filename
let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p')
if fname == ''
return
endif
" Skip temporary buffers with buftype set. The buftype is set for buffers
" used by plugins.
if &buftype != ''
return
endif
if g:MRU_Include_Files != ''
" If MRU_Include_Files is set, include only files matching the
" specified pattern
if fname !~# g:MRU_Include_Files
return
endif
endif
if g:MRU_Exclude_Files != ''
" Do not add files matching the pattern specified in the
" MRU_Exclude_Files to the MRU list
if fname =~# g:MRU_Exclude_Files
return
endif
endif
" If the filename is not already present in the MRU list and is not
" readable then ignore it
let idx = index(s:MRU_files, fname)
if idx == -1
if !filereadable(fname)
" File is not readable and is not in the MRU list
return
endif
endif
" Load the latest MRU file list
call s:MRU_LoadList()
" Remove the new file name from the existing MRU list (if already present)
call filter(s:MRU_files, 'v:val !=# fname')
" Add the new file list to the beginning of the updated old file list
call insert(s:MRU_files, fname, 0)
" Trim the list
if len(s:MRU_files) > g:MRU_Max_Entries
call remove(s:MRU_files, g:MRU_Max_Entries, -1)
endif
" Save the updated MRU list
call s:MRU_SaveList()
" Refresh the MRU menu
call s:MRU_Refresh_Menu()
" If the MRU window is open, update the displayed MRU list
let bname = '__MRU_Files__'
let winnum = bufwinnr(bname)
if winnum != -1
let cur_winnr = winnr()
call s:MRU_Open_Window()
if winnr() != cur_winnr
exe cur_winnr . 'wincmd w'
endif
endif
endfunction
" MRU_escape_filename {{{1
" Escape special characters in a filename. Special characters in file names
" that should be escaped (for security reasons)
let s:esc_filename_chars = ' *?[{`$%#"|!<>();&' . "'\t\n"
function! s:MRU_escape_filename(fname)
return escape(a:fname, s:esc_filename_chars)
endfunction
" MRU_Edit_File {{{1
" Edit the specified file
" filename - Name of the file to edit
" sanitized - Specifies whether the filename is already escaped for special
" characters or not.
function! s:MRU_Edit_File(filename, sanitized)
if !a:sanitized
let esc_fname = s:MRU_escape_filename(a:filename)
else
let esc_fname = a:filename
endif
" If the user wants to always open the file in a tab, then open the file
" in a tab. If it is already opened in a tab, then the cursor will be
" moved to that tab.
if g:MRU_Open_File_Use_Tabs
call s:MRU_Open_File_In_Tab(a:filename, esc_fname)
return
endif
" If the file is already open in one of the windows, jump to it
let winnum = bufwinnr('^' . a:filename . '$')
if winnum != -1
if winnum != winnr()
exe winnum . 'wincmd w'
endif
else
if &modified || &buftype != '' || &previewwindow
" Current buffer has unsaved changes or is a special buffer or is
" the preview window. So open the file in a new window
exe 'split ' . esc_fname
else
exe 'edit ' . esc_fname
endif
endif
endfunction
" MRU_Open_File_In_Tab
" Open a file in a tab. If the file is already opened in a tab, jump to the
" tab. Otherwise, create a new tab and open the file.
" fname : Name of the file to open
" esc_fname : File name with special characters escaped
function! s:MRU_Open_File_In_Tab(fname, esc_fname)
" If the selected file is already open in the current tab or in
" another tab, jump to it. Otherwise open it in a new tab
if bufwinnr('^' . a:fname . '$') == -1
let tabnum = -1
let i = 1
let bnum = bufnr('^' . a:fname . '$')
while i <= tabpagenr('$')
if index(tabpagebuflist(i), bnum) != -1
let tabnum = i
break
endif
let i += 1
endwhile
if tabnum != -1
" Goto the tab containing the file
exe 'tabnext ' . i
else
" Open a new tab as the last tab page
exe '999tabnew ' . a:esc_fname
endif
endif
" Jump to the window containing the file
let winnum = bufwinnr('^' . a:fname . '$')
if winnum != winnr()
exe winnum . 'wincmd w'
endif
endfunction
" MRU_Window_Edit_File {{{1
" fname : Name of the file to edit. May specify single or multiple
" files.
" edit_type : Specifies how to edit the file. Can be one of 'edit' or 'view'.
" 'view' - Open the file as a read-only file
" 'edit' - Edit the file as a regular file
" multi : Specifies whether a single file or multiple files need to be
" opened.
" open_type : Specifies where to open the file. Can be one of 'useopen' or
" 'newwin' or 'newtab'.
" useopen - If the file is already present in a window, then
" jump to that window. Otherwise, open the file in
" the previous window.
" newwin_horiz - Open the file in a new horizontal window.
" newwin_vert - Open the file in a new vertical window.
" newtab - Open the file in a new tab. If the file is already
" opened in a tab, then jump to that tab.
function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
let esc_fname = s:MRU_escape_filename(a:fname)
if a:open_type == 'newwin_horiz'
" Edit the file in a new horizontally split window above the previous
" window
wincmd p
exe 'belowright new ' . esc_fname
elseif a:open_type == 'newwin_vert'
" Edit the file in a new vertically split window above the previous
" window
wincmd p
exe 'belowright vnew ' . esc_fname
elseif a:open_type == 'newtab' || g:MRU_Open_File_Use_Tabs
call s:MRU_Open_File_In_Tab(a:fname, esc_fname)
else
" If the selected file is already open in one of the windows,
" jump to it
let winnum = bufwinnr('^' . a:fname . '$')
if winnum != -1
exe winnum . 'wincmd w'
else
if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0
" Jump to the window from which the MRU window was opened
if exists('s:MRU_last_buffer')
let last_winnr = bufwinnr(s:MRU_last_buffer)
if last_winnr != -1 && last_winnr != winnr()
exe last_winnr . 'wincmd w'
endif
endif
else
if g:MRU_Use_Current_Window == 0
" Goto the previous window
" If MRU_Use_Current_Window is set to one, then the
" current window is used to open the file
wincmd p
endif
endif
let split_window = 0
if &modified || &previewwindow || a:multi
" Current buffer has unsaved changes or is the preview window
" or the user is opening multiple files
" So open the file in a new window
let split_window = 1
endif
if &buftype != ''
" Current buffer is a special buffer (maybe used by a plugin)
if g:MRU_Use_Current_Window == 0 ||
\ bufnr('%') != bufnr('__MRU_Files__')
let split_window = 1
endif
endif
" Edit the file
if split_window
" Current buffer has unsaved changes or is a special buffer or
" is the preview window. So open the file in a new window
if a:edit_type == 'edit'
exe 'split ' . esc_fname
else
exe 'sview ' . esc_fname
endif
else
if a:edit_type == 'edit'
exe 'edit ' . esc_fname
else
exe 'view ' . esc_fname
endif
endif
endif
endif
endfunction
" MRU_Select_File_Cmd {{{1
" Open a file selected from the MRU window
"
" 'opt' has two values separated by comma. The first value specifies how to
" edit the file and can be either 'edit' or 'view'. The second value
" specifies where to open the file. It can take one of the following values:
" 'useopen' to open file in the previous window
" 'newwin_horiz' to open the file in a new horizontal split window
" 'newwin_vert' to open the file in a new vertical split window.
" 'newtab' to open the file in a new tab.
" If multiple file names are selected using visual mode, then open multiple
" files (either in split windows or tabs)
function! s:MRU_Select_File_Cmd(opt) range
let [edit_type, open_type] = split(a:opt, ',')
let fnames = getline(a:firstline, a:lastline)
if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0
" Automatically close the window if the file window is
" not used to display the MRU list.
silent! close
endif
let multi = 0
for f in fnames
if f == ''
continue
endif
" The text in the MRU window contains the filename in parenthesis
let file = matchstr(f, '(\zs.*\ze)')
call s:MRU_Window_Edit_File(file, multi, edit_type, open_type)
if a:firstline != a:lastline
" Opening multiple files
let multi = 1
endif
endfor
endfunction
" MRU_Warn_Msg {{{1
" Display a warning message
function! s:MRU_Warn_Msg(msg)
echohl WarningMsg
echo a:msg
echohl None
endfunction
" MRU_Open_Window {{{1
" Display the Most Recently Used file list in a temporary window.
" If the optional argument is supplied, then it specifies the pattern of files
" to selectively display in the MRU window.
function! s:MRU_Open_Window(...)
" Load the latest MRU file list
call s:MRU_LoadList()
" Check for empty MRU list
if empty(s:MRU_files)
call s:MRU_Warn_Msg('MRU file list is empty')
return
endif
" Save the current buffer number. This is used later to open a file when a
" entry is selected from the MRU window. The window number is not saved,
" as the window number will change when new windows are opened.
let s:MRU_last_buffer = bufnr('%')
let bname = '__MRU_Files__'
" If the window is already open, jump to it
let winnum = bufwinnr(bname)
if winnum != -1
if winnr() != winnum
" If not already in the window, jump to it
exe winnum . 'wincmd w'
endif
setlocal modifiable
" Delete the contents of the buffer to the black-hole register
silent! %delete _
else
if g:MRU_Use_Current_Window
" Reuse the current window
"
" If the __MRU_Files__ buffer exists, then reuse it. Otherwise open
" a new buffer
let bufnum = bufnr(bname)
if bufnum == -1
let cmd = 'edit ' . bname
else
let cmd = 'buffer ' . bufnum
endif
exe cmd
if bufnr('%') != bufnr(bname)
" Failed to edit the MRU buffer
return
endif
else
" Open a new window at the bottom
" If the __MRU_Files__ buffer exists, then reuse it. Otherwise open
" a new buffer
let bufnum = bufnr(bname)
if bufnum == -1
let wcmd = bname
else
let wcmd = '+buffer' . bufnum
endif
exe 'silent! botright ' . g:MRU_Window_Height . 'split ' . wcmd
endif
endif
" Mark the buffer as scratch
setlocal buftype=nofile
setlocal bufhidden=delete
setlocal noswapfile
setlocal nowrap
setlocal nobuflisted
" Use fixed height for the MRU window
setlocal winfixheight
call MRU_SetupSyntax()
" Setup the cpoptions properly for the maps to work
let old_cpoptions = &cpoptions
set cpoptions&vim
" Create mappings to select and edit a file from the MRU list
nnoremap <buffer> <silent> <CR>
\ :call <SID>MRU_Select_File_Cmd('edit,useopen')<CR>
vnoremap <buffer> <silent> <CR>
\ :call <SID>MRU_Select_File_Cmd('edit,useopen')<CR>
nnoremap <buffer> <silent> o
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_horiz')<CR>
vnoremap <buffer> <silent> o
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_horiz')<CR>
nnoremap <buffer> <silent> O
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_vert')<CR>
vnoremap <buffer> <silent> O
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_vert')<CR>
nnoremap <buffer> <silent> t
\ :call <SID>MRU_Select_File_Cmd('edit,newtab')<CR>
vnoremap <buffer> <silent> t
\ :call <SID>MRU_Select_File_Cmd('edit,newtab')<CR>
nnoremap <buffer> <silent> v
\ :call <SID>MRU_Select_File_Cmd('view,useopen')<CR>
nnoremap <buffer> <silent> u :MRU<CR>
nnoremap <buffer> <silent> <2-LeftMouse>
\ :call <SID>MRU_Select_File_Cmd('edit,useopen')<CR>
nnoremap <buffer> <silent> q :close<CR>
" Restore the previous cpoptions settings
let &cpoptions = old_cpoptions
" Display the MRU list
if a:0 == 0
" No search pattern specified. Display the complete list
let m = copy(s:MRU_files)
else
" Display only the entries matching the specified pattern
" First try using it as a literal pattern
let m = filter(copy(s:MRU_files), 'stridx(v:val, a:1) != -1')
if len(m) == 0
" No match. Try using it as a regular expression
let m = filter(copy(s:MRU_files), 'v:val =~# a:1')
endif
endif
" Get the tail part of the file name (without the directory) and display
" it along with the full path
let output = map(m, 'fnamemodify(v:val, ":t") . " (" . v:val . ")"')
silent! 0put =output
" Delete the empty line at the end of the buffer
$delete
" Move the cursor to the beginning of the file
normal! gg
setlocal nomodifiable
endfunction
" MRU_Complete {{{1
" Command-line completion function used by :MRU command
function! s:MRU_Complete(ArgLead, CmdLine, CursorPos)
if a:ArgLead == ''
" Return the complete list of MRU files
return s:MRU_files
else
" Return only the files matching the specified pattern
return filter(copy(s:MRU_files), 'v:val =~? a:ArgLead')
endif
endfunction
" MRU_Cmd {{{1
" Function to handle the MRU command
" pat - File name pattern passed to the MRU command
function! s:MRU_Cmd(pat)
if a:pat == ''
" No arguments specified. Open the MRU window
call s:MRU_Open_Window()
return
endif
" Load the latest MRU file
call s:MRU_LoadList()
" Empty MRU list
if empty(s:MRU_files)
call s:MRU_Warn_Msg('MRU file list is empty')
return
endif
" First use the specified string as a literal string and search for
" filenames containing the string. If only one filename is found,
" then edit it (unless the user wants to open the MRU window always)
let m = filter(copy(s:MRU_files), 'stridx(v:val, a:pat) != -1')
if len(m) > 0
if len(m) == 1 && !g:MRU_Window_Open_Always
call s:MRU_Edit_File(m[0], 0)
return
endif
" More than one file matches. Try find an accurate match
let new_m = filter(m, 'v:val ==# a:pat')
if len(new_m) == 1 && !g:MRU_Window_Open_Always
call s:MRU_Edit_File(new_m[0], 0)
return
endif
" Couldn't find an exact match, open the MRU window with all the
" files matching the pattern.
call s:MRU_Open_Window(a:pat)
return
endif
" Use the specified string as a regular expression pattern and search
" for filenames matching the pattern
let m = filter(copy(s:MRU_files), 'v:val =~? a:pat')
if len(m) == 0
" If an existing file (not present in the MRU list) is specified,
" then open the file.
if filereadable(a:pat)
call s:MRU_Edit_File(a:pat, 0)
return
endif
" No filenames matching the specified pattern are found
call s:MRU_Warn_Msg("MRU file list doesn't contain " .
\ "files matching " . a:pat)
return
endif
if len(m) == 1 && !g:MRU_Window_Open_Always
call s:MRU_Edit_File(m[0], 0)
return
endif
call s:MRU_Open_Window(a:pat)
endfunction
" MRU_add_files_to_menu {{{1
" Adds a list of files to the "Recent Files" sub menu under the "File" menu.
" prefix - Prefix to use for each of the menu entries
" file_list - List of file names to add to the menu
function! s:MRU_add_files_to_menu(prefix, file_list)
for fname in a:file_list
" Escape special characters in the filename
let esc_fname = escape(fnamemodify(fname, ':t'), ".\\" .
\ s:esc_filename_chars)
let esc_fname = substitute(esc_fname, '&', '&&', 'g')
" Truncate the directory name if it is long
let dir_name = fnamemodify(fname, ':h')
let len = strlen(dir_name)
" Shorten long file names by adding only few characters from
" the beginning and end.
if len > 30
let dir_name = strpart(dir_name, 0, 10) .
\ '...' .
\ strpart(dir_name, len - 20)
endif
let esc_dir_name = escape(dir_name, ".\\" . s:esc_filename_chars)
let esc_dir_name = substitute(esc_dir_name, '&', '&&', 'g')
let menu_path = '&File.&Recent\ Files.' . a:prefix . esc_fname .
\ '\ (' . esc_dir_name . ')'
let esc_mfname = s:MRU_escape_filename(fname)
exe 'anoremenu <silent> ' . menu_path .
\ " :call <SID>MRU_Edit_File('" . esc_mfname . "', 1)<CR>"
exe 'tmenu ' . menu_path . ' Edit file ' . esc_mfname
endfor
endfunction
" MRU_Refresh_Menu {{{1
" Refresh the MRU menu
function! s:MRU_Refresh_Menu()
if !has('menu') || !g:MRU_Add_Menu
" No support for menus
return
endif
" Setup the cpoptions properly for the maps to work
let old_cpoptions = &cpoptions
set cpoptions&vim
" Remove the MRU menu
" To retain the teared-off MRU menu, we need to add a dummy entry
silent! unmenu &File.&Recent\ Files
" The menu priority of the File menu is 10. If the MRU plugin runs
" first before menu.vim, the File menu order may not be correct.
" So specify the priority of the File menu here.
10noremenu &File.&Recent\ Files.Dummy <Nop>
silent! unmenu! &File.&Recent\ Files
anoremenu <silent> &File.&Recent\ Files.Refresh\ list
\ :call <SID>MRU_LoadList()<CR>
exe 'tmenu File.&Recent\ Files.Refresh\ list Reload the MRU file list from '
\ . s:MRU_escape_filename(g:MRU_File)
anoremenu File.&Recent\ Files.-SEP1- :
" Add the filenames in the MRU list to the menu
let entry_cnt = len(s:MRU_files)
if entry_cnt > g:MRU_Max_Menu_Entries
" Show only MRU_Max_Menu_Entries file names in the menu
let mru_list = s:MRU_files[1 : g:MRU_Max_Menu_Entries]
let entry_cnt = g:MRU_Max_Menu_Entries
else
let mru_list = s:MRU_files
endif
if entry_cnt > g:MRU_Max_Submenu_Entries
" Split the MRU menu into sub-menus
for start_idx in range(0, entry_cnt, g:MRU_Max_Submenu_Entries)
let last_idx = start_idx + g:MRU_Max_Submenu_Entries - 1
if last_idx >= entry_cnt
let last_idx = entry_cnt - 1
endif
let prefix = 'Files\ (' . (start_idx + 1) . '\.\.\.' .
\ (last_idx + 1) . ').'
call s:MRU_add_files_to_menu(prefix,
\ mru_list[start_idx : last_idx])
endfor
else
call s:MRU_add_files_to_menu('', mru_list)
endif
" Remove the dummy menu entry
unmenu &File.&Recent\ Files.Dummy
" Restore the previous cpoptions settings
let &cpoptions = old_cpoptions
endfunction
" Setup syntax highlight
function! MRU_SetupSyntax()
if has("syntax")
syn match mruName /.\+\s/
syn match mruDir /(.\+)/
hi def link mruDir Folded
hi def link mruName String
endif
endfunction
" Load the MRU list on plugin startup
call s:MRU_LoadList()
" MRU autocommands {{{1
" Autocommands to detect the most recently used files
autocmd BufRead * call s:MRU_AddFile(expand('<abuf>'))
autocmd BufNewFile * call s:MRU_AddFile(expand('<abuf>'))
autocmd BufWritePost * call s:MRU_AddFile(expand('<abuf>'))
" The ':vimgrep' command adds all the files searched to the buffer list.
" This also modifies the MRU list, even though the user didn't edit the
" files. Use the following autocmds to prevent this.
autocmd QuickFixCmdPre *vimgrep* let s:mru_list_locked = 1
autocmd QuickFixCmdPost *vimgrep* let s:mru_list_locked = 0
" Command to open the MRU window
command! -nargs=? -complete=customlist,s:MRU_Complete MRU
\ call s:MRU_Cmd(<q-args>)
command! -nargs=? -complete=customlist,s:MRU_Complete Mru
\ call s:MRU_Cmd(<q-args>)
" }}}
" restore 'cpo'
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set foldenable foldmethod=marker:

View file

@ -1,606 +0,0 @@
" Vim color file --- psc (peak sea color) "Lite version"
" Maintainer: Pan, Shi Zhu <Go to the following URL for my email>
" URL: http://vim.sourceforge.net/scripts/script.php?script_id=760
" Last Change: 5 Feb 2010
" Version: 3.4
"
" Comments and e-mails are welcomed, thanks.
"
" The peaksea color is simply a colorscheme with the default settings of
" the original ps_color. Lite version means there's no custom settings
" and fancy features such as integration with reloaded.vim
"
" The full version of ps_color.vim will be maintained until Vim 8.
" By then there will be only the lite version: peaksea.vim
"
" Note: Please set the background option in your .vimrc and/or .gvimrc
"
" It is much better *not* to set 'background' option inside
" a colorscheme file. because ":set background" improperly
" may cause colorscheme be sourced twice
"
" Color Scheme Overview:
" :ru syntax/hitest.vim
"
" Relevant Help:
" :h highlight-groups
" :h psc-cterm-color-table
"
" Colors Order:
" #rrggbb
"
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "peaksea"
" I don't want to abuse folding, but here folding is used to avoid confusion.
if &background=='light'
" for background=light {{{2
" LIGHT COLOR DEFINE START
hi Normal guifg=#000000 guibg=#e0e0e0 gui=NONE
hi Search guifg=White guibg=DarkRed gui=NONE
hi Visual guifg=NONE guibg=#a6caf0 gui=NONE
hi Cursor guifg=#f0f0f0 guibg=#008000 gui=NONE
" The idea of CursorIM is pretty good, however, the feature is still buggy
" in the current version (Vim 7.0).
" The following line will be kept commented until the bug fixed.
"
" hi CursorIM guifg=#f0f0f0 guibg=#800080
hi Special guifg=#907000 guibg=NONE gui=NONE
hi Comment guifg=#606000 guibg=NONE gui=NONE
hi Number guifg=#907000 guibg=NONE gui=NONE
hi Constant guifg=#007068 guibg=NONE gui=NONE
hi StatusLine guifg=fg guibg=#a6caf0 gui=NONE
hi LineNr guifg=#686868 guibg=NONE gui=NONE
hi Question guifg=fg guibg=#d0d090 gui=NONE
hi PreProc guifg=#009030 guibg=NONE gui=NONE
hi Statement guifg=#2060a8 guibg=NONE gui=NONE
hi Type guifg=#0850a0 guibg=NONE gui=NONE
hi Todo guifg=#800000 guibg=#e0e090 gui=NONE
" NOTE THIS IS IN THE WARM SECTION
hi Error guifg=#c03000 guibg=NONE gui=NONE
hi Identifier guifg=#a030a0 guibg=NONE gui=NONE
hi ModeMsg guifg=fg guibg=#b0b0e0 gui=NONE
hi VisualNOS guifg=fg guibg=#b0b0e0 gui=NONE
hi SpecialKey guifg=#1050a0 guibg=NONE gui=NONE
hi NonText guifg=#002090 guibg=#d0d0d0 gui=NONE
hi Directory guifg=#a030a0 guibg=NONE gui=NONE
hi ErrorMsg guifg=fg guibg=#f0b090 gui=NONE
hi MoreMsg guifg=#489000 guibg=NONE gui=NONE
hi Title guifg=#a030a0 guibg=NONE gui=NONE
hi WarningMsg guifg=#b02000 guibg=NONE gui=NONE
hi WildMenu guifg=fg guibg=#d0d090 gui=NONE
hi Folded guifg=NONE guibg=#b0e0b0 gui=NONE
hi FoldColumn guifg=fg guibg=#90e090 gui=NONE
hi DiffAdd guifg=NONE guibg=#b0b0e0 gui=NONE
hi DiffChange guifg=NONE guibg=#e0b0e0 gui=NONE
hi DiffDelete guifg=#002090 guibg=#d0d0d0 gui=NONE
hi DiffText guifg=NONE guibg=#c0e080 gui=NONE
hi SignColumn guifg=fg guibg=#90e090 gui=NONE
hi IncSearch guifg=White guibg=DarkRed gui=NONE
hi StatusLineNC guifg=fg guibg=#c0c0c0 gui=NONE
hi VertSplit guifg=fg guibg=#c0c0c0 gui=NONE
hi Underlined guifg=#6a5acd guibg=NONE gui=underline
hi Ignore guifg=bg guibg=NONE
" NOTE THIS IS IN THE WARM SECTION
if v:version >= 700
if has('spell')
hi SpellBad guifg=NONE guibg=NONE guisp=#c03000
hi SpellCap guifg=NONE guibg=NONE guisp=#2060a8
hi SpellRare guifg=NONE guibg=NONE guisp=#a030a0
hi SpellLocal guifg=NONE guibg=NONE guisp=#007068
endif
hi Pmenu guifg=fg guibg=#e0b0e0
hi PmenuSel guifg=#f0f0f0 guibg=#806060 gui=NONE
hi PmenuSbar guifg=fg guibg=#c0c0c0 gui=NONE
hi PmenuThumb guifg=fg guibg=#c0e080 gui=NONE
hi TabLine guifg=fg guibg=#c0c0c0 gui=NONE
hi TabLineFill guifg=fg guibg=#c0c0c0 gui=NONE
hi TabLineSel guifg=fg guibg=NONE gui=NONE
hi CursorColumn guifg=NONE guibg=#f0b090
hi CursorLine guifg=NONE guibg=NONE gui=underline
hi MatchParen guifg=NONE guibg=#c0e080
endif
" LIGHT COLOR DEFINE END
" Vim 7 added stuffs
if v:version >= 700
hi Ignore gui=NONE
" the gui=undercurl guisp could only support in Vim 7
if has('spell')
hi SpellBad gui=undercurl
hi SpellCap gui=undercurl
hi SpellRare gui=undercurl
hi SpellLocal gui=undercurl
endif
hi TabLine gui=underline
hi TabLineFill gui=underline
hi CursorLine gui=underline
endif
" For reversed stuffs, clear the reversed prop and set the bold prop again
hi IncSearch gui=bold
hi StatusLine gui=bold
hi StatusLineNC gui=bold
hi VertSplit gui=bold
hi Visual gui=bold
" Enable the bold property
hi Question gui=bold
hi DiffText gui=bold
hi Statement gui=bold
hi Type gui=bold
hi MoreMsg gui=bold
hi ModeMsg gui=bold
hi NonText gui=bold
hi Title gui=bold
hi DiffDelete gui=bold
hi TabLineSel gui=bold
" gui define for background=light end here
" generally, a dumb terminal is dark, we assume the light terminal has 256
" color support.
if &t_Co==8 || &t_Co==16
set t_Co=256
endif
if &t_Co==256
" 256color light terminal support here
hi Normal ctermfg=16 ctermbg=254 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi Normal ctermfg=16 ctermbg=NONE cterm=NONE
hi Search ctermfg=White ctermbg=DarkRed cterm=NONE
hi Visual ctermfg=NONE ctermbg=153 cterm=NONE
hi Cursor ctermfg=255 ctermbg=28 cterm=NONE
" hi CursorIM ctermfg=255 ctermbg=90
hi Special ctermfg=94 ctermbg=NONE cterm=NONE
hi Comment ctermfg=58 ctermbg=NONE cterm=NONE
hi Number ctermfg=94 ctermbg=NONE cterm=NONE
hi Constant ctermfg=23 ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=fg ctermbg=153 cterm=NONE
hi LineNr ctermfg=242 ctermbg=NONE cterm=NONE
hi Question ctermfg=fg ctermbg=186 cterm=NONE
hi PreProc ctermfg=29 ctermbg=NONE cterm=NONE
hi Statement ctermfg=25 ctermbg=NONE cterm=NONE
hi Type ctermfg=25 ctermbg=NONE cterm=NONE
hi Todo ctermfg=88 ctermbg=186 cterm=NONE
" NOTE THIS IS IN THE WARM SECTION
hi Error ctermfg=130 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=133 ctermbg=NONE cterm=NONE
hi ModeMsg ctermfg=fg ctermbg=146 cterm=NONE
hi VisualNOS ctermfg=fg ctermbg=146 cterm=NONE
hi SpecialKey ctermfg=25 ctermbg=NONE cterm=NONE
hi NonText ctermfg=18 ctermbg=252 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi NonText ctermfg=18 ctermbg=NONE cterm=NONE
hi Directory ctermfg=133 ctermbg=NONE cterm=NONE
hi ErrorMsg ctermfg=fg ctermbg=216 cterm=NONE
hi MoreMsg ctermfg=64 ctermbg=NONE cterm=NONE
hi Title ctermfg=133 ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=124 ctermbg=NONE cterm=NONE
hi WildMenu ctermfg=fg ctermbg=186 cterm=NONE
hi Folded ctermfg=NONE ctermbg=151 cterm=NONE
hi FoldColumn ctermfg=fg ctermbg=114 cterm=NONE
hi DiffAdd ctermfg=NONE ctermbg=146 cterm=NONE
hi DiffChange ctermfg=NONE ctermbg=182 cterm=NONE
hi DiffDelete ctermfg=18 ctermbg=252 cterm=NONE
hi DiffText ctermfg=NONE ctermbg=150 cterm=NONE
hi SignColumn ctermfg=fg ctermbg=114 cterm=NONE
hi IncSearch ctermfg=White ctermbg=DarkRed cterm=NONE
hi StatusLineNC ctermfg=fg ctermbg=250 cterm=NONE
hi VertSplit ctermfg=fg ctermbg=250 cterm=NONE
hi Underlined ctermfg=62 ctermbg=NONE cterm=underline
hi Ignore ctermfg=bg ctermbg=NONE
" NOTE THIS IS IN THE WARM SECTION
if v:version >= 700
if has('spell')
if 0
" ctermsp is not supported in Vim7, we ignore it.
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=130
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=25
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=133
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=23
else
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE
endif
endif
hi Pmenu ctermfg=fg ctermbg=182
hi PmenuSel ctermfg=255 ctermbg=95 cterm=NONE
hi PmenuSbar ctermfg=fg ctermbg=250 cterm=NONE
hi PmenuThumb ctermfg=fg ctermbg=150 cterm=NONE
hi TabLine ctermfg=fg ctermbg=250 cterm=NONE
hi TabLineFill ctermfg=fg ctermbg=250 cterm=NONE
hi TabLineSel ctermfg=fg ctermbg=NONE cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=216
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi MatchParen ctermfg=NONE ctermbg=150
endif
hi TabLine cterm=underline
hi TabLineFill cterm=underline
hi CursorLine cterm=underline
" For reversed stuffs, clear the reversed prop and set the bold prop again
hi IncSearch cterm=bold
hi StatusLine cterm=bold
hi StatusLineNC cterm=bold
hi VertSplit cterm=bold
hi Visual cterm=bold
hi NonText cterm=bold
hi Question cterm=bold
hi Title cterm=bold
hi DiffDelete cterm=bold
hi DiffText cterm=bold
hi Statement cterm=bold
hi Type cterm=bold
hi MoreMsg cterm=bold
hi ModeMsg cterm=bold
hi TabLineSel cterm=bold
"hi lCursor ctermfg=bg ctermbg=fg cterm=NONE
endif " t_Co==256
" }}}2
elseif &background=='dark'
" for background=dark {{{2
" DARK COLOR DEFINE START
hi Normal guifg=#d0d0d0 guibg=#202020 gui=NONE
hi Comment guifg=#d0d090 guibg=NONE gui=NONE
hi Constant guifg=#80c0e0 guibg=NONE gui=NONE
hi Number guifg=#e0c060 guibg=NONE gui=NONE
hi Identifier guifg=#f0c0f0 guibg=NONE gui=NONE
hi Statement guifg=#c0d8f8 guibg=NONE gui=NONE
hi PreProc guifg=#60f080 guibg=NONE gui=NONE
hi Type guifg=#b0d0f0 guibg=NONE gui=NONE
hi Special guifg=#e0c060 guibg=NONE gui=NONE
hi Error guifg=#f08060 guibg=NONE gui=NONE
hi Todo guifg=#800000 guibg=#d0d090 gui=NONE
hi Search guifg=White guibg=DarkRed gui=NONE
hi Visual guifg=#000000 guibg=#a6caf0 gui=NONE
hi Cursor guifg=#000000 guibg=#00f000 gui=NONE
" NOTE THIS IS IN THE COOL SECTION
" hi CursorIM guifg=#000000 guibg=#f000f0 gui=NONE
hi StatusLine guifg=#000000 guibg=#a6caf0 gui=NONE
hi LineNr guifg=#b0b0b0 guibg=NONE gui=NONE
hi Question guifg=#000000 guibg=#d0d090 gui=NONE
hi ModeMsg guifg=fg guibg=#000080 gui=NONE
hi VisualNOS guifg=fg guibg=#000080 gui=NONE
hi SpecialKey guifg=#b0d0f0 guibg=NONE gui=NONE
hi NonText guifg=#202020 guibg=#202020 gui=NONE
hi Directory guifg=#80c0e0 guibg=NONE gui=NONE
hi ErrorMsg guifg=#d0d090 guibg=#800000 gui=NONE
hi MoreMsg guifg=#c0e080 guibg=NONE gui=NONE
hi Title guifg=#f0c0f0 guibg=NONE gui=NONE
hi WarningMsg guifg=#f08060 guibg=NONE gui=NONE
hi WildMenu guifg=#000000 guibg=#d0d090 gui=NONE
hi Folded guifg=#aaaaaa guibg=#333333 gui=NONE
hi FoldColumn guifg=#202020 guibg=#202020 gui=NONE
hi DiffAdd guifg=NONE guibg=#000080 gui=NONE
hi DiffChange guifg=NONE guibg=#800080 gui=NONE
hi DiffDelete guifg=#6080f0 guibg=#202020 gui=NONE
hi DiffText guifg=#000000 guibg=#c0e080 gui=NONE
hi SignColumn guifg=#e0e0e0 guibg=#202020 gui=NONE
hi IncSearch guifg=White guibg=DarkRed gui=NONE
hi StatusLineNC guifg=#000000 guibg=#c0c0c0 gui=NONE
hi VertSplit guifg=#000000 guibg=#c0c0c0 gui=NONE
hi Underlined guifg=#80a0ff guibg=NONE gui=underline
hi Ignore guifg=#000000 guibg=NONE
" NOTE THIS IS IN THE COOL SECTION
if v:version >= 700
if has('spell')
" the guisp= could only support in Vim 7
hi SpellBad guifg=NONE guibg=NONE guisp=#f08060
hi SpellCap guifg=NONE guibg=NONE guisp=#6080f0
hi SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0
hi SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8
endif
hi Pmenu guifg=#dddddd guibg=#444444 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffffff gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi TabLine guifg=fg guibg=#008000 gui=NONE
hi TabLineFill guifg=fg guibg=#008000 gui=NONE
hi TabLineSel guifg=fg guibg=NONE gui=NONE
hi CursorColumn guifg=NONE guibg=#800000 gui=NONE
hi CursorLine guifg=NONE guibg=NONE gui=underline
hi MatchParen guifg=NONE guibg=#800080
endif
" DARK COLOR DEFINE END
" Vim 7 added stuffs
if v:version >= 700
hi Ignore gui=NONE
" the gui=undercurl could only support in Vim 7
if has('spell')
hi SpellBad gui=undercurl
hi SpellCap gui=undercurl
hi SpellRare gui=undercurl
hi SpellLocal gui=undercurl
endif
hi TabLine gui=underline
hi TabLineFill gui=underline
hi Underlined gui=underline
hi CursorLine gui=underline
endif
" gui define for background=dark end here
if &t_Co==8 || &t_Co==16
" for 8-color and 16-color term
hi Normal ctermfg=LightGrey ctermbg=Black
hi Special ctermfg=Yellow ctermbg=bg
hi Comment ctermfg=DarkYellow ctermbg=bg
hi Constant ctermfg=Blue ctermbg=bg
hi Number ctermfg=Yellow ctermbg=bg
hi LineNr ctermfg=DarkGrey ctermbg=bg
hi PreProc ctermfg=Green ctermbg=bg
hi Statement ctermfg=Cyan ctermbg=bg
hi Type ctermfg=Cyan ctermbg=bg
hi Error ctermfg=Red ctermbg=bg
hi Identifier ctermfg=Magenta ctermbg=bg
hi SpecialKey ctermfg=Cyan ctermbg=bg
hi NonText ctermfg=Blue ctermbg=bg
hi Directory ctermfg=Blue ctermbg=bg
hi MoreMsg ctermfg=Green ctermbg=bg
hi Title ctermfg=Magenta ctermbg=bg
hi WarningMsg ctermfg=Red ctermbg=bg
hi DiffDelete ctermfg=Blue ctermbg=bg
hi Search ctermfg=NONE ctermbg=DarkRed
hi Visual ctermfg=Black ctermbg=DarkCyan
hi Cursor ctermfg=Black ctermbg=Green
hi StatusLine ctermfg=Black ctermbg=DarkCyan
hi Question ctermfg=Black ctermbg=DarkYellow
hi Todo ctermfg=DarkRed ctermbg=DarkYellow
hi Folded ctermfg=DarkGrey ctermbg=DarkGrey
hi FoldColumn ctermfg=DarkGrey ctermbg=DarkGrey
hi ModeMsg ctermfg=Grey ctermbg=DarkBlue
hi VisualNOS ctermfg=Grey ctermbg=DarkBlue
hi ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed
hi WildMenu ctermfg=Black ctermbg=DarkYellow
hi SignColumn ctermfg=White ctermbg=DarkGreen
hi DiffText ctermfg=Black ctermbg=DarkYellow
if v:version >= 700
if has('spell')
hi SpellBad ctermfg=NONE ctermbg=DarkRed
hi SpellCap ctermfg=NONE ctermbg=DarkBlue
hi SpellRare ctermfg=NONE ctermbg=DarkMagenta
hi SpellLocal ctermfg=NONE ctermbg=DarkGreen
endif
hi Pmenu ctermfg=White ctermbg=DarkGrey
hi PmenuSel ctermfg=Black ctermbg=White
hi TabLine ctermfg=fg ctermbg=Black cterm=underline
hi TabLineFill ctermfg=fg ctermbg=Black cterm=underline
hi CursorColumn ctermfg=NONE ctermbg=DarkRed
hi TabLineSel ctermfg=fg ctermbg=bg
hi CursorLine ctermfg=NONE ctermbg=bg cterm=underline
hi MatchParen ctermfg=NONE ctermbg=DarkMagenta
endif
if &t_Co==8
" 8 colour terminal support, this assumes 16 colour is available through
" setting the 'bold' attribute, will get bright foreground colour.
" However, the bright background color is not available for 8-color terms.
"
" You can manually set t_Co=16 in your .vimrc to see if your terminal
" supports 16 colours,
hi DiffText cterm=none
hi Visual cterm=none
hi Cursor cterm=none
hi Comment cterm=none
hi Todo cterm=none
hi StatusLine cterm=none
hi Question cterm=none
hi DiffChange cterm=none
hi ModeMsg cterm=none
hi VisualNOS cterm=none
hi ErrorMsg cterm=none
hi WildMenu cterm=none
hi DiffAdd cterm=none
hi Folded cterm=none
hi DiffDelete cterm=none
hi Normal cterm=none
hi PmenuThumb cterm=none
hi Search cterm=bold
hi Special cterm=bold
hi Constant cterm=bold
hi Number cterm=bold
hi LineNr cterm=bold
hi PreProc cterm=bold
hi Statement cterm=bold
hi Type cterm=bold
hi Error cterm=bold
hi Identifier cterm=bold
hi SpecialKey cterm=bold
hi NonText cterm=bold
hi MoreMsg cterm=bold
hi Title cterm=bold
hi WarningMsg cterm=bold
hi FoldColumn cterm=bold
hi SignColumn cterm=bold
hi Directory cterm=bold
hi DiffDelete cterm=bold
else
" Background > 7 is only available with 16 or more colors
hi WarningMsg cterm=none
hi Search cterm=none
hi Visual cterm=none
hi Cursor cterm=none
hi Special cterm=none
hi Comment cterm=none
hi Constant cterm=none
hi Number cterm=none
hi LineNr cterm=none
hi PreProc cterm=none
hi Todo cterm=none
hi Error cterm=none
hi Identifier cterm=none
hi Folded cterm=none
hi SpecialKey cterm=none
hi Directory cterm=none
hi ErrorMsg cterm=none
hi Normal cterm=none
hi PmenuThumb cterm=none
hi WildMenu cterm=none
hi FoldColumn cterm=none
hi SignColumn cterm=none
hi DiffAdd cterm=none
hi DiffChange cterm=none
hi Question cterm=none
hi StatusLine cterm=none
hi DiffText cterm=none
hi IncSearch cterm=reverse
hi StatusLineNC cterm=reverse
hi VertSplit cterm=reverse
" Well, well, bold font with color 0-7 is not possible.
" So, the Question, StatusLine, DiffText cannot act as expected.
hi Statement cterm=none
hi Type cterm=none
hi MoreMsg cterm=none
hi ModeMsg cterm=none
hi NonText cterm=none
hi Title cterm=none
hi VisualNOS cterm=none
hi DiffDelete cterm=none
hi TabLineSel cterm=none
endif
elseif &t_Co==256
" 256color dark terminal support here
hi Normal ctermfg=252 ctermbg=234 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi Normal ctermfg=252 ctermbg=NONE cterm=NONE
hi Comment ctermfg=186 ctermbg=NONE cterm=NONE
hi Constant ctermfg=110 ctermbg=NONE cterm=NONE
hi Number ctermfg=179 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=219 ctermbg=NONE cterm=NONE
hi Statement ctermfg=153 ctermbg=NONE cterm=NONE
hi PreProc ctermfg=84 ctermbg=NONE cterm=NONE
hi Type ctermfg=153 ctermbg=NONE cterm=NONE
hi Special ctermfg=179 ctermbg=NONE cterm=NONE
hi Error ctermfg=209 ctermbg=NONE cterm=NONE
hi Todo ctermfg=88 ctermbg=186 cterm=NONE
hi Search ctermfg=White ctermbg=DarkRed cterm=NONE
hi Visual ctermfg=16 ctermbg=153 cterm=NONE
hi Cursor ctermfg=16 ctermbg=46 cterm=NONE
" NOTE THIS IS IN THE COOL SECTION
" hi CursorIM ctermfg=16 ctermbg=201 cterm=NONE
hi StatusLine ctermfg=16 ctermbg=153 cterm=NONE
hi LineNr ctermfg=249 ctermbg=NONE cterm=NONE
hi Question ctermfg=16 ctermbg=186 cterm=NONE
hi ModeMsg ctermfg=fg ctermbg=18 cterm=NONE
hi VisualNOS ctermfg=fg ctermbg=18 cterm=NONE
hi SpecialKey ctermfg=153 ctermbg=NONE cterm=NONE
hi NonText ctermfg=69 ctermbg=233 cterm=NONE
" Comment/Uncomment the following line to disable/enable transparency
"hi NonText ctermfg=69 ctermbg=NONE cterm=NONE
hi Directory ctermfg=110 ctermbg=NONE cterm=NONE
hi ErrorMsg ctermfg=186 ctermbg=88 cterm=NONE
hi MoreMsg ctermfg=150 ctermbg=NONE cterm=NONE
hi Title ctermfg=219 ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=209 ctermbg=NONE cterm=NONE
hi WildMenu ctermfg=16 ctermbg=186 cterm=NONE
hi Folded ctermfg=NONE ctermbg=DarkGrey cterm=NONE
hi FoldColumn ctermfg=DarkGrey ctermbg=DarkGrey cterm=NONE
hi DiffAdd ctermfg=NONE ctermbg=18 cterm=NONE
hi DiffChange ctermfg=NONE ctermbg=90 cterm=NONE
hi DiffDelete ctermfg=69 ctermbg=234 cterm=NONE
hi DiffText ctermfg=16 ctermbg=150 cterm=NONE
hi SignColumn ctermfg=254 ctermbg=28 cterm=NONE
hi IncSearch ctermfg=White ctermbg=DarkRed cterm=NONE
hi StatusLineNC ctermfg=16 ctermbg=250 cterm=NONE
hi VertSplit ctermfg=16 ctermbg=250 cterm=NONE
hi Underlined ctermfg=111 ctermbg=NONE cterm=underline
hi Ignore ctermfg=16 ctermbg=NONE
" NOTE THIS IS IN THE COOL SECTION
if v:version >= 700
if has('spell')
" the ctermsp= is not supported in Vim 7 we simply ignored
if 0
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=209
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=69
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=219
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=153
else
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=NONE
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE
endif
endif
hi Pmenu ctermfg=White ctermbg=DarkGrey
hi PmenuSel ctermfg=Black ctermbg=White cterm=NONE
hi TabLine ctermfg=fg ctermbg=Black cterm=NONE
hi TabLineFill ctermfg=fg ctermbg=Black cterm=NONE
hi TabLineSel ctermfg=fg ctermbg=NONE cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=88 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi MatchParen ctermfg=NONE ctermbg=90
hi TabLine cterm=underline
hi TabLineFill cterm=underline
hi Underlined cterm=underline
hi CursorLine cterm=underline
endif
endif " t_Co
" }}}2
endif
" Links:
"
" COLOR LINKS DEFINE START
hi link String Constant
" Character must be different from strings because in many languages
" (especially C, C++) a 'char' variable is scalar while 'string' is pointer,
" mistaken a 'char' for a 'string' will cause disaster!
hi link Character Number
hi link SpecialChar LineNr
hi link Tag Identifier
hi link cCppOut LineNr
" The following are not standard hi links,
" these are used by DrChip
hi link Warning MoreMsg
hi link Notice Constant
" these are used by Calendar
hi link CalToday PreProc
" these are used by TagList
hi link MyTagListTagName IncSearch
hi link MyTagListTagScope Constant
hi TabLineFill guifg=#9098a0 guibg=#111111
hi TabLine guifg=black guibg=#888888
hi TabLineSel guifg=white guibg=#202020 gui=bold
" COLOR LINKS DEFINE END
" vim:et:nosta:sw=2:ts=8:
" vim600:fdm=marker:fdl=1:

View file

@ -1,30 +0,0 @@
function! CustomizedTabLine()
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= '%' . i . 'T'
let s .= (i == t ? '%1*' : '%2*')
let s .= ' '
let s .= i . ':'
let s .= '%*'
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
let file = bufname(buflist[winnr - 1])
let file = fnamemodify(file, ':p:t')
if file == ''
let file = '[No Name]'
endif
let s .= file
let s .= ' '
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction
" Always show the tablilne
set stal=2
set tabline=%!CustomizedTabLine()

View file

@ -1,11 +0,0 @@
This is a version of Infinite Red's vim theme (http://blog.infinitered.com/entries/show/8) packaged to work with Tim Pope's pathogen plugin (http://www.vim.org/scripts/script.php?script_id=2332).
To use it (assuming you're using pathogen):
- go to your bundle directory (.vim/bundle or .vimbundles) and clone the repo:
git clone git@github.com:wgibbs/vim-irblack.git
- edit your .vimrc and add:
:colorscheme ir_black

View file

@ -1,220 +0,0 @@
" ir_black color scheme
" More at: http://blog.infinitered.com/entries/show/8
" ********************************************************************************
" Standard colors used in all ir_black themes:
" Note, x:x:x are RGB values
"
" normal: #f6f3e8
"
" string: #A8FF60 168:255:96
" string inner (punc, code, etc): #00A0A0 0:160:160
" number: #FF73FD 255:115:253
" comments: #7C7C7C 124:124:124
" keywords: #96CBFE 150:203:254
" operators: white
" class: #FFFFB6 255:255:182
" method declaration name: #FFD2A7 255:210:167
" regular expression: #E9C062 233:192:98
" regexp alternate: #FF8000 255:128:0
" regexp alternate 2: #B18A3D 177:138:61
" variable: #C6C5FE 198:197:254
"
" Misc colors:
" red color (used for whatever): #FF6C60 255:108:96
" light red: #FFB6B0 255:182:176
"
" brown: #E18964 good for special
"
" lightpurpleish: #FFCCFF
"
" Interface colors:
" background color: black
" cursor (where underscore is used): #FFA560 255:165:96
" cursor (where block is used): white
" visual selection: #1D1E2C
" current line: #151515 21:21:21
" search selection: #07281C 7:40:28
" line number: #3D3D3D 61:61:61
" ********************************************************************************
" The following are the preferred 16 colors for your terminal
" Colors Bright Colors
" Black #4E4E4E #7C7C7C
" Red #FF6C60 #FFB6B0
" Green #A8FF60 #CEFFAB
" Yellow #FFFFB6 #FFFFCB
" Blue #96CBFE #FFFFCB
" Magenta #FF73FD #FF9CFE
" Cyan #C6C5FE #DFDFFE
" White #EEEEEE #FFFFFF
" ********************************************************************************
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "ir_black"
"hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
" General colors
hi Normal guifg=#f6f3e8 guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi NonText guifg=#070707 guibg=black gui=NONE ctermfg=black ctermbg=NONE cterm=NONE
hi Cursor guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=reverse
hi LineNr guifg=#3D3D3D guibg=black gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi VertSplit guifg=#202020 guibg=#202020 gui=NONE ctermfg=darkgray ctermbg=darkgray cterm=NONE
hi StatusLine guifg=#CCCCCC guibg=#202020 gui=None ctermfg=white ctermbg=darkgray cterm=NONE
hi StatusLineNC guifg=black guibg=#202020 gui=NONE ctermfg=blue ctermbg=darkgray cterm=NONE
hi Folded guifg=#a0a8b0 guibg=#384048 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title guifg=#f6f3e8 guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE
hi Visual guifg=NONE guibg=DarkBlue gui=NONE ctermfg=NONE ctermbg=darkgray cterm=NONE
hi SpecialKey guifg=#808080 guibg=#343434 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi WildMenu guifg=white guibg=DarkRed gui=NONE ctermfg=white ctermbg=DarkRed cterm=NONE
hi PmenuSbar guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=NONE
"hi Ignore guifg=gray guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error guifg=NONE guibg=red gui=undercurl ctermfg=white ctermbg=red cterm=NONE guisp=#FF6C60 " undercurl color
hi ErrorMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
hi WarningMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
" Message displayed in lower left, such as --INSERT--
hi ModeMsg guifg=black guibg=#C6C5FE gui=BOLD ctermfg=black ctermbg=cyan cterm=BOLD
if version >= 700 " Vim 7.x specific colors
hi CursorLine guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
hi CursorColumn guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=BOLD ctermfg=white ctermbg=darkgray cterm=NONE
hi Pmenu guifg=#f6f3e8 guibg=#444444 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#cae682 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Search guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
endif
" Syntax highlighting
hi Comment guifg=#7C7C7C guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi String guifg=#A8FF60 guibg=NONE gui=NONE ctermfg=green ctermbg=NONE cterm=NONE
hi Number guifg=#FF73FD guibg=NONE gui=NONE ctermfg=magenta ctermbg=NONE cterm=NONE
hi Keyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi PreProc guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi Conditional guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE " if else end
hi Todo guifg=#8f8f8f guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE
hi Constant guifg=#99CC99 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Identifier guifg=#C6C5FE guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Function guifg=#FFD2A7 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi Type guifg=#FFFFB6 guibg=NONE gui=NONE ctermfg=yellow ctermbg=NONE cterm=NONE
hi Statement guifg=#6699CC guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE
hi Special guifg=#E18964 guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
hi Delimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Operator guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi link Character Constant
hi link Boolean Constant
hi link Float Number
hi link Repeat Statement
hi link Label Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link SpecialComment Special
hi link Debug Special
" Special for Ruby
hi rubyRegexp guifg=#B18A3D guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi rubyRegexpDelimiter guifg=#FF8000 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi rubyEscape guifg=white guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi rubyInterpolationDelimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi rubyControl guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE "and break, etc
"hi rubyGlobalVariable guifg=#FFCCFF guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE "yield
hi rubyStringDelimiter guifg=#336633 guibg=NONE gui=NONE ctermfg=lightgreen ctermbg=NONE cterm=NONE
"rubyInclude
"rubySharpBang
"rubyAccess
"rubyPredefinedVariable
"rubyBoolean
"rubyClassVariable
"rubyBeginEnd
"rubyRepeatModifier
"hi link rubyArrayDelimiter Special " [ , , ]
"rubyCurlyBlock { , , }
hi link rubyClass Keyword
hi link rubyModule Keyword
hi link rubyKeyword Keyword
hi link rubyOperator Operator
hi link rubyIdentifier Identifier
hi link rubyInstanceVariable Identifier
hi link rubyGlobalVariable Identifier
hi link rubyClassVariable Identifier
hi link rubyConstant Type
" Special for Java
" hi link javaClassDecl Type
hi link javaScopeDecl Identifier
hi link javaCommentTitle javaDocSeeTag
hi link javaDocTags javaDocSeeTag
hi link javaDocParam javaDocSeeTag
hi link javaDocSeeTagParam javaDocSeeTag
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
"hi javaClassDecl guifg=#CCFFCC guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
" Special for XML
hi link xmlTag Keyword
hi link xmlTagName Conditional
hi link xmlEndTag Identifier
" Special for HTML
hi link htmlTag Keyword
hi link htmlTagName Conditional
hi link htmlEndTag Identifier
" Special for Javascript
hi link javaScriptNumber Number
" Special for Python
"hi link pythonEscape Keyword
" Special for CSharp
hi link csXmlTag Keyword
" Amix customizations
" Tab line
hi TabLineFill guifg=#000000 guibg=#000000 gui=NONE
hi TabLine guifg=black guibg=#888888 gui=NONE
hi TabLineSel guifg=white guibg=#000000 gui=bold
" Search higlights
hi Search guifg=White guibg=DarkRed gui=NONE

View file

@ -1,38 +0,0 @@
vim-peepopen
=============
A plugin for the Vim text editor. PeepOpen provides fuzzy search of filenames and paths in a programming project.
Installation
------------
Get the PeepOpen.app and open it at least once to approve the Mac OS X security dialog.
Standard:
Copy `peepopen.vim` to your `~/.vim/plugin` directory.
With Tim Pope's [Pathogen](http://github.com/tpope/vim-pathogen):
Copy the entire `vim-peepopen` plugin directory to your `~/.vim/bundle` directory.
Usage
-----
`<Leader>p` opens the current project directory with the PeepOpen application.
Use the [vim-rooter](https://github.com/airblade/vim-rooter) plugin for automatic assignment of the current working directory for projects stored in Git.
(Leader is mapped to '\' by default)
### Options
Automatically quit PeepOpen when Vim exits.
`let p:peepopen_quit = 1`
Credits
-------
- Initial Vim Plugin by [Andrew Stewart](http://www.airbladesoftware.com/).
- Some plugin boilerplate from [Rein Henrichs](http://reinh.com/).

View file

@ -1,57 +0,0 @@
" plugin/peepopen.vim
" Author: Geoffrey Grosenbach <boss@topfunky.com>
" License: MIT License
" Install this file as plugin/peepopen.vim.
" If you prefer Command-T, use this snippet in your .gvimrc:
" if has("gui_macvim")
" macmenu &File.New\ Tab key=<nop>
" map <D-t> <Plug>PeepOpen
" end
" ============================================================================
" Exit quickly when:
" - this plugin was already loaded (or disabled)
" - when 'compatible' is set
if &cp || exists("g:peepopen_loaded") && g:peepopen_loaded
finish
endif
let g:peepopen_loaded = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:peepopen_quit')
let g:peepopen_quit = 0
endif
function s:LaunchPeepOpenViaVim()
silent exe "!open -a PeepOpen " . shellescape(getcwd())
redraw!
endfunction
function s:QuitPeepOpenViaVim()
silent exe '!ps ax | grep PeepOpen | grep -v grep | awk "{ print $1 }" | xargs kill -QUIT'
endfunction
command! PeepOpen :call <SID>LaunchPeepOpenViaVim()
command! PeepQuit :call <SID>QuitPeepOpenViaVim()
if has('autocmd') && exists('g:peepopen_quit') && g:peepopen_quit
au VimLeave * :call <SID>QuitPeepOpenViaVim()
endif
noremap <unique> <script> <Plug>PeepOpen <SID>Launch
noremap <SID>Launch :call <SID>LaunchPeepOpenViaVim()<CR>
if !hasmapto('<Plug>PeepOpen')
map! <unique> <silent> <Leader>p <Plug>PeepOpen
endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set sw=2 sts=2:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
/doc/tags

View file

@ -1,4 +0,0 @@
[submodule "docs"]
path = docs
url = git@github.com:mattn/zencoding-vim.git
branch = gh-pages

View file

@ -1,11 +0,0 @@
all : zencoding-vim.zip
remove-zip:
-rm doc/tags
-rm zencoding-vim.zip
zencoding-vim.zip: remove-zip
zip -r zencoding-vim.zip autoload plugin doc
release: zencoding-vim.zip
vimup update-script zencoding.vim

View file

@ -1,103 +0,0 @@
# ZenCoding-vim
[zencoding-vim](http://mattn.github.com/zencoding-vim) is vim script support for expanding abbreviation like zen-coding(emmet).
## Installation
[Download zip file](http://www.vim.org/scripts/script.php?script_id=2981):
cd ~/.vim
unzip zencoding-vim.zip
If you install pathogen.vim:
cd ~/.vim/bundle # or make directory
unzip /path/to/zencoding-vim.zip
If you get source from repository:
cd ~/.vim/bundle # or make directory
git clone http://github.com/mattn/zencoding-vim.git
or:
git clone http://github.com/mattn/zencoding-vim.git
cd zencoding-vim
cp plugin/zencoding.vim ~/.vim/plugin/
cp autoload/zencoding.vim ~/.vim/autoload/
cp -a autoload/zencoding ~/.vim/autoload/
## Quick Tutorial
Open or create New File:
vim index.html
Type ("_" is the cursor position):
html:5_
Then type "<c-y>," (Ctrl + y + ','), you should see:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
_
</body>
</html>
[More Tutorials](https://raw.github.com/mattn/zencoding-vim/master/TUTORIAL)
## Enable in different mode
If you don't want enable zencoding in all mode,
you can use set a option in `vimrc`:
let g:user_zen_mode='n' "only enable normal mode functions.
let g:user_zen_mode='inv' "enable all functions, which is equal to
let g:user_zen_mode='a' "enable all function in all mode.
## Project Authors
[Yasuhiro Matsumoto](http://mattn.kaoriya.net/)
## Links
### zen-coding official site:
> <http://code.google.com/p/zen-coding/>
### zencoding.vim:
> <http://mattn.github.com/zencoding-vim>
### development repository:
> <https://github.com/mattn/zencoding-vim>
### my blog posts about zencoding-vim:
> <http://mattn.kaoriya.net/software/vim/20100222103327.htm>
> <http://mattn.kaoriya.net/software/vim/20100306021632.htm>
### japanese blog posts about zencoding-vim:
> <http://d.hatena.ne.jp/idesaku/20100424/1272092255>
> <http://d.hatena.ne.jp/griefworker/20110118/vim_zen_coding>
> <http://d.hatena.ne.jp/sakurako_s/20110126/1295988873>
> <http://looxu.blogspot.jp/2010/02/zencodingvimhtml.html>
### tutorial traslated in chinese:
> <http://www.zfanw.com/blog/zencoding-vim-tutorial-chinese.html>

View file

@ -1,212 +0,0 @@
Tutorial of zencoding.vim
mattn <mattn.jp@gmail.com>
1. Expand Abbreviation
Type abbreviation as 'div>p#foo$*3>a' and type '<c-y>,'.
---------------------
<div>
<p id="foo1">
<a href=""></a>
</p>
<p id="foo2">
<a href=""></a>
</p>
<p id="foo3">
<a href=""></a>
</p>
</div>
---------------------
2. Wrap with Abbreviation
Write as below.
---------------------
test1
test2
test3
---------------------
Then do visual select(line wize) and type '<c-y>,'.
If you request 'Tag:', then type 'ul>li*'.
---------------------
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
</ul>
---------------------
If you type tag as 'blockquote', then you'll see as following.
---------------------
<blockquote>
test1
test2
test3
</blockquote>
---------------------
3. Balance Tag Inward
type '<c-y>d' in insert mode.
4. Balance Tag Outward
type '<c-y>D' in insert mode.
5. Go to Next Edit Point
type '<c-y>n' in insert mode.
6. Go to Previous Edit Point
type '<c-y>N' in insert mode.
7. Update <img> Size
Move cursor to img tag.
---------------------
<img src="foo.png" />
---------------------
Type '<c-y>i' on img tag
---------------------
<img src="foo.png" width="32" height="48" />
---------------------
8. Merge Lines
select the lines included '<li>'
---------------------
<ul>
<li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
---------------------
and type '<c-y>m'
---------------------
<ul>
<li class="list1"></li><li class="list2"></li><li class="list3"></li>
</ul>
---------------------
9. Remove Tag
Move cursor in block
---------------------
<div class="foo">
<a>cursor is here</a>
</div>
---------------------
Type '<c-y>k' in insert mode.
---------------------
<div class="foo">
</div>
---------------------
And type '<c-y>k' in there again.
---------------------
---------------------
10. Split/Join Tag
Move cursor in block
---------------------
<div class="foo">
cursor is here
</div>
---------------------
Type '<c-y>j' in insert mode.
---------------------
<div class="foo"/>
---------------------
And type '<c-y>j' in there again.
---------------------
<div class="foo">
</div>
---------------------
11. Toggle Comment
Move cursor to block
---------------------
<div>
hello world
</div>
---------------------
Type '<c-y>/' in insert mode.
---------------------
<!-- <div>
hello world
</div> -->
---------------------
Type '<c-y>/' in there again.
---------------------
<div>
hello world
</div>
---------------------
12. Make anchor from URL
Move cursor to URL
---------------------
http://www.google.com/
---------------------
Type '<c-y>a'
---------------------
<a href="http://www.google.com/">Google</a>
---------------------
13. Make quoted text from URL
Move cursor to URL
---------------------
http://github.com/
---------------------
Type '<c-y>A'
---------------------
<blockquote class="quote">
<a href="http://github.com/">Secure source code hosting and collaborative development - GitHub</a><br />
<p>How does it work? Get up and running in seconds by forking a project, pushing an existing repository...</p>
<cite>http://github.com/</cite>
</blockquote>
---------------------
14. Installing zencoding.vim for language you using.
# cd ~/.vim
# unzip zencoding-vim.zip
or if you install pathogen.vim:
# cd ~/.vim/bundle # or make directory
# unzip /path/to/zencoding-vim.zip
if you get sources from repository:
# cd ~/.vim/bundle # or make directory
# git clone http://github.com/mattn/zencoding-vim.git
15. Enable zencoding.vim for language you using.
You can customize the behavior of language you using.
---------------------
# cat >> ~/.vimrc
let g:user_zen_settings = {
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'c',
\ },
\ 'xml' : {
\ 'extends' : 'html',
\ },
\ 'haml' : {
\ 'extends' : 'html',
\ },
\}
---------------------

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
let s:exists = {}
function zencoding#lang#exists(type)
if len(a:type) == 0
return 0
elseif has_key(s:exists, a:type)
return s:exists[a:type]
endif
let s:exists[a:type] = len(globpath(&rtp, 'autoload/zencoding/lang/'.a:type.'.vim')) > 0
return s:exists[a:type]
endfunction

View file

@ -1,228 +0,0 @@
function! zencoding#lang#css#findTokens(str)
return substitute(a:str, '^.*[;{]\s*', '', '')
endfunction
function! zencoding#lang#css#parseIntoTree(abbr, type)
let abbr = a:abbr
let type = a:type
let prefix = 0
let value = ''
let settings = zencoding#getSettings()
let indent = zencoding#getIndentation(type)
let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0 }
" emmet
let tokens = split(abbr, '+\ze[^)!]')
for n in range(len(tokens))
let token = tokens[n]
let prop = matchlist(token, '^\(-\{0,1}[a-zA-Z]\+\|[a-zA-Z0-9]\++\{0,1}\|([a-zA-Z0-9]\++\{0,1})\)\(\%([0-9.-]\+[pe]\{0,1}-\{0,1}\|-auto\)*\)$')
if len(prop)
let token = substitute(prop[1], '^(\(.*\))', '\1', '')
if token =~ '^-'
let prefix = 1
let token = token[1:]
endif
let value = ''
for v in split(prop[2], '\d\zs-')
if len(value) > 0
let value .= ' '
endif
if token =~ '^[z]'
" TODO
let value .= substitute(v, '[^0-9.]*$', '', '')
elseif v =~ 'p$'
let value .= substitute(v, 'p$', '%', '')
elseif v =~ 'e$'
let value .= substitute(v, 'e$', 'em', '')
elseif v =~ '\.'
let value .= v . 'em'
elseif v == 'auto'
let value .= v
else
let value .= v . 'px'
endif
endfor
endif
let tag_name = token
if tag_name =~ '.!$'
let tag_name = tag_name[:-2]
let important = 1
else
let important = 0
endif
" make default node
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': important }
let current.name = tag_name
" aliases
let aliases = zencoding#getResource(type, 'aliases', {})
if has_key(aliases, tag_name)
let current.name = aliases[tag_name]
endif
let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1)
" snippets
let snippets = zencoding#getResource(type, 'snippets', {})
if !empty(snippets) && has_key(snippets, tag_name)
let snippet = snippets[tag_name]
if use_pipe_for_cursor
let snippet = substitute(snippet, '|', '${cursor}', 'g')
endif
let lines = split(snippet, "\n")
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
let current.snippet = join(lines, "\n")
let current.name = ''
let current.snippet = substitute(current.snippet, ';', value . ';', '')
if use_pipe_for_cursor && len(value) > 0 && stridx(value, '${cursor}') == -1
let current.snippet = substitute(current.snippet, '${cursor}', '', 'g') . '${cursor}'
endif
if n < len(tokens) - 1
let current.snippet .= "\n"
endif
endif
let current.pos = 0
let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\w\+\)\s*,\s*\([^,]\+\)\s*,\s*\([^)]\+\)\s*)$')
if len(lg)
let current.name = ''
let current.snippet = printf("background-image: -webkit-gradient(%s, 0 0, 0 100%, from(%s), to(%s));\n", lg[1], lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image: -webkit-linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image: -moz-linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image: -o-linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image: linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
elseif prefix
let snippet = current.snippet
let current.snippet = '-webkit-' . snippet . "\n"
call add(root.child, deepcopy(current))
let current.snippet = '-moz-' . snippet . "\n"
call add(root.child, deepcopy(current))
let current.snippet = snippet
call add(root.child, current)
else
call add(root.child, current)
endif
endfor
return root
endfunction
function! zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
let current = a:current
let value = current.value[1:-2]
if zencoding#useFilter(a:filters, 'fc')
let value = substitute(value, '\([^:]\+\):\([^;]*;\)', '\1: \2', 'g')
else
let value = substitute(value, '\([^:]\+\):\([^;]*;\)', '\1:\2', 'g')
endif
if current.important
let value = substitute(value, ';', ' !important;', '')
endif
return value
endfunction
function! zencoding#lang#css#imageSize()
endfunction
function! zencoding#lang#css#encodeImage()
endfunction
function! zencoding#lang#css#parseTag(tag)
return {}
endfunction
function! zencoding#lang#css#toggleComment()
let line = getline('.')
let mx = '^\(\s*\)/\*\s*\(.*\)\s*\*/\s*$'
if line =~ '{\s*$'
let block = zencoding#util#searchRegion('/\*', '\*/\zs')
if zencoding#util#regionIsValid(block)
let content = zencoding#util#getContent(block)
let content = substitute(content, '/\*\s\(.*\)\s\*/', '\1', '')
call zencoding#util#setContent(block, content)
else
let node = expand('<cword>')
if len(node)
exe "normal ciw\<c-r>='/* '.node.' */'\<cr>"
endif
endif
else
if line =~ mx
let space = substitute(matchstr(line, mx), mx, '\1', '')
let line = substitute(matchstr(line, mx), mx, '\2', '')
let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g')
else
let mx = '^\(\s*\)\(.*\)\s*$'
let line = substitute(line, mx, '\1/* \2 */', '')
endif
call setline('.', line)
endif
endfunction
function! zencoding#lang#css#balanceTag(flag) range
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = getpos('.')
endif
let block = zencoding#util#getVisualBlock()
if !zencoding#util#regionIsValid(block)
if a:flag > 0
let block = zencoding#util#searchRegion('^', ';')
if zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endif
else
if a:flag > 0
let content = zencoding#util#getContent(block)
if content !~ '^{.*}$'
let block = zencoding#util#searchRegion('{', '}')
if zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endif
else
let pos = searchpos('.*;', 'nW')
if pos[0] != 0
call setpos('.', [0, pos[0], pos[1], 0])
let block = zencoding#util#searchRegion('^', ';')
if zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endif
endif
endif
if a:flag == -2 || a:flag == 2
silent! exe "normal! gv"
else
call setpos('.', curpos)
endif
endfunction
function! zencoding#lang#css#moveNextPrev(flag)
let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp')
if pos == 2
startinsert!
else
silent! normal! l
startinsert
endif
endfunction
function! zencoding#lang#css#splitJoinTag()
" nothing to do
endfunction
function! zencoding#lang#css#removeTag()
" nothing to do
endfunction

View file

@ -1,310 +0,0 @@
function! zencoding#lang#haml#findTokens(str)
return zencoding#lang#html#findTokens(a:str)
endfunction
function! zencoding#lang#haml#parseIntoTree(abbr, type)
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
endfunction
function! zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
let str = ""
let comment_indent = ''
let comment = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '')
endif
if len(current.name) > 0
let str .= '%' . current_name
let tmp = ''
for attr in current.attrs_order
if !has_key(current.attr, attr)
continue
endif
let val = current.attr[attr]
if dollar_expr
while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
endif
let valtmp = substitute(val, '\${cursor}', '', '')
if attr == 'id' && len(valtmp) > 0
let str .= '#' . val
elseif attr == 'class' && len(valtmp) > 0
let str .= '.' . substitute(val, ' ', '.', 'g')
else
if len(tmp) > 0 | let tmp .= ',' | endif
let val = substitute(val, '\${cursor}', '', '')
let tmp .= ' :' . attr . ' => "' . val . '"'
endif
endfor
if len(tmp)
let str .= '{' . tmp . ' }'
endif
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
let str .= "/"
endif
let inner = ''
if len(current.value) > 0
let text = current.value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
let str = substitute(str, '\$#', text, 'g')
endif
let lines = split(text, "\n")
if len(lines) == 1
let str .= " " . text
else
for line in lines
let str .= "\n" . indent . line . " |"
endfor
endif
elseif len(current.child) == 0
let str .= '${cursor}'
endif
if len(current.child) == 1 && len(current.child[0].name) == 0
let text = current.child[0].value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
endif
let lines = split(text, "\n")
if len(lines) == 1
let str .= " " . text
else
for line in lines
let str .= "\n" . indent . line . " |"
endfor
endif
elseif len(current.child) > 0
for child in current.child
let inner .= zencoding#toString(child, type, inline, filters, itemno)
endfor
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g')
let str .= "\n" . indent . inner
endif
else
let str = current.value[1:-2]
if dollar_expr
let str = substitute(str, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let str = substitute(str, '\${nr}', "\n", 'g')
let str = substitute(str, '\\\$', '$', 'g')
endif
endif
let str .= "\n"
return str
endfunction
function! zencoding#lang#haml#imageSize()
let line = getline('.')
let current = zencoding#lang#haml#parseTag(line)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn =~ '^\s*$'
return
elseif fn !~ '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = zencoding#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let current.attrs_order += ['width', 'height']
let haml = zencoding#toString(current, 'haml', 1)
let haml = substitute(haml, '\${cursor}', '', '')
call setline('.', substitute(matchstr(line, '^\s*') . haml, "\n", "", "g"))
endfunction
function! zencoding#lang#haml#encodeImage()
endfunction
function! zencoding#lang#haml#parseTag(tag)
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] }
let mx = '%\([a-zA-Z][a-zA-Z0-9]*\)\s*\%({\(.*\)}\)'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i')
let attrs = substitute(match, mx, '\2', 'i')
let mx = '\([a-zA-Z0-9]\+\)\s*=>\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)
if len(match) == 0
break
endif
let attr_match = matchlist(match, mx)
let name = attr_match[1]
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
let current.attr[name] = value
let current.attrs_order += [name]
let attrs = attrs[stridx(attrs, match) + len(match):]
endwhile
return current
endfunction
function! zencoding#lang#haml#toggleComment()
let line = getline('.')
let space = matchstr(line, '^\s*')
if line =~ '^\s*-#'
call setline('.', space . matchstr(line[len(space)+2:], '^\s*\zs.*'))
elseif line =~ '^\s*%[a-z]'
call setline('.', space . '-# ' . line[len(space):])
endif
endfunction
function! zencoding#lang#haml#balanceTag(flag) range
let block = zencoding#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = getpos('.')
endif
let n = curpos[1]
let ml = len(matchstr(getline(n), '^\s*'))
if a:flag > 0
if a:flag == 1 || !zencoding#util#regionIsValid(block)
let n = line('.')
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze%[a-z]'))
if l > 0 && l < ml
let ml = l
break
endif
let n -= 1
endwhile
endif
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l > ml
let ml = l
break
endif
let n += 1
endwhile
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
endif
endfunction
function! zencoding#lang#haml#moveNextPrev(flag)
let pos = search('""', a:flag ? 'Wb' : 'W')
if pos != 0
silent! normal! l
startinsert
endif
endfunction
function! zencoding#lang#haml#splitJoinTag()
let n = line('.')
let sml = len(matchstr(getline(n), '^\s*%[a-z]'))
while n > 0
if getline(n) =~ '^\s*\ze%[a-z]'
if len(matchstr(getline(n), '^\s*%[a-z]')) < sml
break
endif
let line = getline(n)
call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', ''))
let sn = n
let n += 1
let ml = len(matchstr(getline(n), '^\s*%[a-z]'))
if len(matchstr(getline(n), '^\s*')) > ml
while n <= line('$')
let l = len(matchstr(getline(n), '^\s*'))
if l <= ml
break
endif
exe n "delete"
endwhile
call setpos('.', [0, sn, 1, 0])
else
let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)')
let spaces = matchstr(getline(sn), '^\s*')
let settings = zencoding#getSettings()
if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1
call append(sn, spaces . ' ')
call setpos('.', [0, sn+1, 1, 0])
else
call setpos('.', [0, sn, 1, 0])
endif
startinsert!
endif
break
endif
let n -= 1
endwhile
endfunction
function! zencoding#lang#haml#removeTag()
let n = line('.')
let ml = 0
while n > 0
if getline(n) =~ '^\s*\ze[a-z]'
let ml = len(matchstr(getline(n), '^\s*%[a-z]'))
break
endif
let n -= 1
endwhile
let sn = n
while n < line('$')
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
if sn == n
exe "delete"
else
exe sn "," (n-1) "delete"
endif
endfunction

View file

@ -1,692 +0,0 @@
let s:mx = '\([+>]\|[<^]\+\)\{-}\s*'
\ .'\((*\)\{-}\s*'
\ .'\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\-$]*\|{\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}[ \t\r\n}]*\)'
\ .'\('
\ .'\%('
\ .'\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)'
\ .'\|\%(\[[^\]]\+\]\)'
\ .'\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)'
\ .'\)*'
\ .'\)'
\ .'\%(\({\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}\)\)\{0,1}'
\ .'\%(\*\([0-9]\+\)\)\{0,1}'
\ .'\(\%()\%(\*[0-9]\+\)\{0,1}\)*\)'
function! zencoding#lang#html#findTokens(str)
let str = a:str
let [pos, last_pos] = [0, 0]
while 1
let tag = matchstr(str, '<[a-zA-Z].\{-}>', pos)
if len(tag) == 0
break
endif
let pos = stridx(str, tag, pos) + len(tag)
endwhile
let last_pos = pos
while len(str) > 0
let token = matchstr(str, s:mx, pos)
if token == ''
break
endif
if token =~ '^\s'
let token = matchstr(token, '^\s*\zs.*')
let last_pos = stridx(str, token, pos)
endif
let pos = stridx(str, token, pos) + len(token)
endwhile
return a:str[last_pos :-1]
endfunction
function! zencoding#lang#html#parseIntoTree(abbr, type)
let abbr = a:abbr
let type = a:type
let settings = zencoding#getSettings()
if !has_key(settings, type)
let type = 'html'
endif
if len(type) == 0 | let type = 'html' | endif
let settings = zencoding#getSettings()
let indent = zencoding#getIndentation(type)
" try 'foo' to (foo-x)
let rabbr = zencoding#getExpandos(type, abbr)
if rabbr == abbr
" try 'foo+(' to (foo-x)
let rabbr = substitute(abbr, '\%(+\|^\)\([a-zA-Z][a-zA-Z0-9+]\+\)+\([(){}>]\|$\)', '\="(".zencoding#getExpandos(type, submatch(1)).")".submatch(2)', 'i')
endif
let abbr = rabbr
let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0, 'attrs_order': ['id', 'class'] }
let parent = root
let last = root
let pos = []
while len(abbr)
" parse line
let match = matchstr(abbr, s:mx)
let str = substitute(match, s:mx, '\0', 'ig')
let operator = substitute(match, s:mx, '\1', 'ig')
let block_start = substitute(match, s:mx, '\2', 'ig')
let tag_name = substitute(match, s:mx, '\3', 'ig')
let attributes = substitute(match, s:mx, '\4', 'ig')
let value = substitute(match, s:mx, '\5', 'ig')
let multiplier = 0 + substitute(match, s:mx, '\6', 'ig')
let block_end = substitute(match, s:mx, '\7', 'ig')
let important = 0
if len(str) == 0
break
endif
if tag_name =~ '^#'
let attributes = tag_name . attributes
let tag_name = 'div'
endif
if tag_name =~ '.!$'
let tag_name = tag_name[:-2]
let important = 1
endif
if tag_name =~ '^\.'
let attributes = tag_name . attributes
let tag_name = 'div'
endif
if multiplier <= 0 | let multiplier = 1 | endif
" make default node
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0, 'attrs_order': ['id', 'class'] }
let current.name = tag_name
let current.important = important
" aliases
let aliases = zencoding#getResource(type, 'aliases', {})
if has_key(aliases, tag_name)
let current.name = aliases[tag_name]
endif
let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1)
" snippets
let snippets = zencoding#getResource(type, 'snippets', {})
if !empty(snippets) && has_key(snippets, tag_name)
let snippet = snippets[tag_name]
if use_pipe_for_cursor
let snippet = substitute(snippet, '|', '${cursor}', 'g')
endif
let lines = split(snippet, "\n")
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
let current.snippet = join(lines, "\n")
let current.name = ''
endif
" default_attributes
let default_attributes = zencoding#getResource(type, 'default_attributes', {})
if !empty(default_attributes)
for pat in [current.name, tag_name]
if has_key(default_attributes, pat)
if type(default_attributes[pat]) == 4
let a = default_attributes[pat]
let current.attrs_order += keys(a)
if use_pipe_for_cursor
for k in keys(a)
let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
endfor
else
for k in keys(a)
let current.attr[k] = a[k]
endfor
endif
else
for a in default_attributes[pat]
let current.attrs_order += keys(a)
if use_pipe_for_cursor
for k in keys(a)
let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
endfor
else
for k in keys(a)
let current.attr[k] = a[k]
endfor
endif
endfor
endif
if has_key(settings.html.default_attributes, current.name)
let current.name = substitute(current.name, ':.*$', '', '')
endif
break
endif
endfor
endif
" parse attributes
if len(attributes)
let attr = attributes
while len(attr)
let item = matchstr(attr, '\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)*\)\)')
if len(item) == 0
break
endif
if item[0] == '#'
let current.attr.id = item[1:]
endif
if item[0] == '.'
let current.attr.class = substitute(item[1:], '\.', ' ', 'g')
endif
if item[0] == '['
let atts = item[1:-2]
while len(atts)
let amat = matchstr(atts, '\(\w\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)')
if len(amat) == 0
break
endif
let key = split(amat, '=')[0]
let val = amat[len(key)+1:]
if val =~ '^["'']'
let val = val[1:-2]
endif
let current.attr[key] = val
if index(current.attrs_order, key) == -1
let current.attrs_order += [key]
endif
let atts = atts[stridx(atts, amat) + len(amat):]
endwhile
endif
let attr = substitute(strpart(attr, len(item)), '^\s*', '', '')
endwhile
endif
" parse text
if tag_name =~ '^{.*}$'
let current.name = ''
let current.value = tag_name
else
let current.value = value
endif
let current.multiplier = multiplier
" parse step inside/outside
if !empty(last)
if operator =~ '>'
unlet! parent
let parent = last
let current.parent = last
let current.pos = last.pos + 1
else
let current.parent = parent
let current.pos = last.pos
endif
else
let current.parent = parent
let current.pos = 1
endif
if operator =~ '[<^]'
for c in range(len(operator))
let tmp = parent.parent
if empty(tmp)
break
endif
let parent = tmp
let current.parent = tmp
endfor
endif
call add(parent.child, current)
let last = current
" parse block
if block_start =~ '('
if operator =~ '>'
let last.pos += 1
endif
for n in range(len(block_start))
let pos += [last.pos]
endfor
endif
if block_end =~ ')'
for n in split(substitute(substitute(block_end, ' ', '', 'g'), ')', ',),', 'g'), ',')
if n == ')'
if len(pos) > 0 && last.pos >= pos[-1]
for c in range(last.pos - pos[-1])
let tmp = parent.parent
if !has_key(tmp, 'parent')
break
endif
let parent = tmp
endfor
if len(pos) > 0
call remove(pos, -1)
endif
let last = parent
let last.pos += 1
endif
elseif len(n)
let cl = last.child
let cls = []
for c in range(n[1:])
let cls += cl
endfor
let last.child = cls
endif
endfor
endif
let abbr = abbr[stridx(abbr, match) + len(match):]
if g:zencoding_debug > 1
echomsg "str=".str
echomsg "block_start=".block_start
echomsg "tag_name=".tag_name
echomsg "operator=".operator
echomsg "attributes=".attributes
echomsg "value=".value
echomsg "multiplier=".multiplier
echomsg "block_end=".block_end
echomsg "abbr=".abbr
echomsg "pos=".string(pos)
echomsg "---"
endif
endwhile
return root
endfunction
function! zencoding#lang#html#toString(settings, current, type, inline, filters, itemno, indent)
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
if zencoding#useFilter(filters, 'haml')
return zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
endif
if zencoding#useFilter(filters, 'slim')
return zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
endif
let comment = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current_name, '\$$', itemno+1, '')
endif
let str = ''
if len(current_name) == 0
let text = current.value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
endif
return text
endif
if len(current_name) > 0
let str .= '<' . current_name
for attr in current.attrs_order
if !has_key(current.attr, attr)
continue
endif
let val = current.attr[attr]
if dollar_expr
while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
endif
let str .= ' ' . attr . '="' . val . '"'
if zencoding#useFilter(filters, 'c')
if attr == 'id' | let comment .= '#' . val | endif
if attr == 'class' | let comment .= '.' . val | endif
endif
endfor
if len(comment) > 0
let str = "<!-- " . comment . " -->\n" . str
endif
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
let str .= settings.html.empty_element_suffix
else
let str .= ">"
let text = current.value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
let str = substitute(str, '\("\zs$#\ze"\|\s\zs\$#"\|"\$#\ze\s\)', text, 'g')
endif
let str .= text
let nc = len(current.child)
let dr = 0
if nc > 0
for n in range(nc)
let child = current.child[n]
if child.multiplier > 1
let str .= "\n" . indent
let dr = 1
elseif len(current_name) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
if nc > 1 || (len(child.name) > 0 && stridx(','.settings.html.inline_elements.',', ','.child.name.',') == -1)
let str .= "\n" . indent
let dr = 1
elseif current.multiplier == 1 && nc == 1 && len(child.name) == 0
let str .= "\n" . indent
let dr = 1
endif
endif
let inner = zencoding#toString(child, type, 0, filters, itemno)
let inner = substitute(inner, "^\n", "", 'g')
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
let str .= inner
endfor
else
let str .= '${cursor}'
endif
if dr
let str .= "\n"
endif
let str .= "</" . current_name . ">"
endif
if len(comment) > 0
let str .= "\n<!-- /" . comment . " -->"
endif
if len(current_name) > 0 && current.multiplier > 0 || stridx(','.settings.html.block_elements.',', ','.current_name.',') != -1
let str .= "\n"
endif
return str
endfunction
function! zencoding#lang#html#imageSize()
let img_region = zencoding#util#searchRegion('<img\s', '>')
if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region)
return
endif
let content = zencoding#util#getContent(img_region)
if content !~ '^<img[^><]\+>$'
return
endif
let current = zencoding#lang#html#parseTag(content)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn =~ '^\s*$'
return
elseif fn !~ '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = zencoding#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let current.attrs_order += ['width', 'height']
let html = substitute(zencoding#toString(current, 'html', 1), '\n', '', '')
let html = substitute(html, '\${cursor}', '', '')
call zencoding#util#setContent(img_region, html)
endfunction
function! zencoding#lang#html#encodeImage()
let img_region = zencoding#util#searchRegion('<img\s', '>')
if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region)
return
endif
let content = zencoding#util#getContent(img_region)
if content !~ '^<img[^><]\+>$'
return
endif
let current = zencoding#lang#html#parseTag(content)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn !~ '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = zencoding#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let html = zencoding#toString(current, 'html', 1)
call zencoding#util#setContent(img_region, html)
endfunction
function! zencoding#lang#html#parseTag(tag)
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] }
let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i')
let attrs = substitute(match, mx, '\2', 'i')
let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)
if len(match) == 0
break
endif
let attr_match = matchlist(match, mx)
let name = attr_match[1]
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
let current.attr[name] = value
let current.attrs_order += [name]
let attrs = attrs[stridx(attrs, match) + len(match):]
endwhile
return current
endfunction
function! zencoding#lang#html#toggleComment()
let orgpos = getpos('.')
let curpos = getpos('.')
let mx = '<\%#[^>]*>'
while 1
let block = zencoding#util#searchRegion('<!--', '-->')
if zencoding#util#regionIsValid(block)
let block[1][1] += 2
let content = zencoding#util#getContent(block)
let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
call zencoding#util#setContent(block, content)
silent! call setpos('.', orgpos)
return
endif
let block = zencoding#util#searchRegion('<[^>]', '>')
if !zencoding#util#regionIsValid(block)
let pos1 = searchpos('<', 'bcW')
if pos1[0] == 0 && pos1[1] == 0
return
endif
let curpos = getpos('.')
continue
endif
let pos1 = block[0]
let pos2 = block[1]
let content = zencoding#util#getContent(block)
let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
if tag_name[0] == '/'
call setpos('.', [0, pos1[0], pos1[1], 0])
let pos2 = searchpairpos('<'. tag_name[1:] . '>', '', '</' . tag_name[1:] . '>', 'bnW')
let pos1 = searchpos('>', 'cneW')
let block = [pos2, pos1]
elseif tag_name =~ '/$'
if !zencoding#util#pointInRegion(orgpos[1:2], block)
" it's broken tree
call setpos('.', orgpos)
let block = zencoding#util#searchRegion('>', '<')
let content = '><!-- ' . zencoding#util#getContent(block)[1:-2] . ' --><'
call zencoding#util#setContent(block, content)
silent! call setpos('.', orgpos)
return
endif
else
call setpos('.', [0, pos2[0], pos2[1], 0])
let pos2 = searchpairpos('<'. tag_name . '>', '', '</' . tag_name . '>', 'nW')
call setpos('.', [0, pos2[0], pos2[1], 0])
let pos2 = searchpos('>', 'neW')
let block = [pos1, pos2]
endif
if !zencoding#util#regionIsValid(block)
silent! call setpos('.', orgpos)
return
endif
if zencoding#util#pointInRegion(curpos[1:2], block)
let content = '<!-- ' . zencoding#util#getContent(block) . ' -->'
call zencoding#util#setContent(block, content)
silent! call setpos('.', orgpos)
return
endif
endwhile
endfunction
function! zencoding#lang#html#balanceTag(flag) range
let vblock = zencoding#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = getpos('.')
endif
let settings = zencoding#getSettings()
if a:flag > 0
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
while 1
let pos1 = searchpos(mx, 'bW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1
let pos2 = searchpos('>', 'nW')
else
let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '</'. tag_name . '>\zs', 'nW')
endif
let block = [pos1, pos2]
if pos1[0] == 0 && pos1[1] == 0
break
endif
if zencoding#util#pointInRegion(curpos[1:2], block) && zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endwhile
else
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
while 1
let pos1 = searchpos(mx, 'W')
if pos1 == curpos[1:2]
let pos1 = searchpos(mx . '\zs', 'W')
let pos2 = searchpos('.\ze<', 'W')
let block = [pos1, pos2]
if zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endif
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1
let pos2 = searchpos('>', 'nW')
else
let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '</'. tag_name . '>\zs', 'nW')
endif
let block = [pos1, pos2]
if pos1[0] == 0 && pos1[1] == 0
break
endif
if zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endwhile
endif
call setpos('.', curpos)
if a:flag == -2 || a:flag == 2
silent! exe "normal! gv"
endif
endfunction
function! zencoding#lang#html#moveNextPrev(flag)
let pos = search('\%(</\w\+\)\@<!\zs><\/\|\(""\)\|^\(\s*\)$', a:flag ? 'Wpb' : 'Wp')
if pos == 3
startinsert!
elseif pos != 0
silent! normal! l
startinsert
endif
endfunction
function! zencoding#lang#html#splitJoinTag()
let curpos = getpos('.')
while 1
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
let pos1 = searchpos(mx, 'bcnW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '')
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
if content[-2:] == '/>' && zencoding#util#cursorInRegion(block)
let content = content[:-3] . "></" . tag_name . '>'
call zencoding#util#setContent(block, content)
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if tag_name[0] == '/'
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
call setpos('.', [0, pos1[0], pos1[1], 0])
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
else
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
endif
let block = [pos1, pos2]
let content = zencoding#util#getContent(block)
if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
let content = matchstr(content, mx)[:-2] . '/>'
call zencoding#util#setContent(block, content)
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if block[0][0] > 0
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
else
call setpos('.', curpos)
return
endif
endif
endif
endwhile
endfunction
function! zencoding#lang#html#removeTag()
let curpos = getpos('.')
while 1
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
let pos1 = searchpos(mx, 'bcnW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
if content[-2:] == '/>' && zencoding#util#cursorInRegion(block)
call zencoding#util#setContent(block, '')
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if tag_name[0] == '/'
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
call setpos('.', [0, pos1[0], pos1[1], 0])
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
else
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
endif
let block = [pos1, pos2]
let content = zencoding#util#getContent(block)
if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
call zencoding#util#setContent(block, '')
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if block[0][0] > 0
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
else
call setpos('.', curpos)
return
endif
endif
endif
endwhile
endfunction

View file

@ -1,158 +0,0 @@
function! zencoding#lang#sass#findTokens(str)
return zencoding#lang#html#findTokens(a:str)
endfunction
function! zencoding#lang#sass#parseIntoTree(abbr, type)
if a:abbr =~ '>'
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
else
return zencoding#lang#css#parseIntoTree(a:abbr, a:type)
endif
endfunction
function! zencoding#lang#sass#toString(settings, current, type, inline, filters, itemno, indent)
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let str = ""
let current_name = current.name
let current_name = substitute(current.name, '\$$', itemno+1, '')
if len(current.name) > 0
let str .= current_name
let tmp = ''
for attr in keys(current.attr)
let val = current.attr[attr]
while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
if attr == 'id'
let str .= '#' . val
elseif attr == 'class'
let str .= '.' . val
else
let tmp .= attr . ': ' . val
endif
endfor
if len(tmp) > 0
let str .= "\n"
for line in split(tmp, "\n")
let str .= indent . line . "\n"
endfor
else
let str .= "\n"
endif
let inner = ''
for child in current.child
let inner .= zencoding#toString(child, type, inline, filters, itemno)
endfor
let inner = substitute(inner, "\n", "\n" . indent, 'g')
let inner = substitute(inner, "\n" . indent . "$", "", 'g')
let str .= indent . inner
else
let text = zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
let text = substitute(text, '\${cursor}', '', 'g')
let text = substitute(text, '\s*;$', '', '')
return text
endif
return str
endfunction
function! zencoding#lang#sass#imageSize()
endfunction
function! zencoding#lang#sass#encodeImage()
endfunction
function! zencoding#lang#sass#parseTag(tag)
endfunction
function! zencoding#lang#sass#toggleComment()
endfunction
function! zencoding#lang#sass#balanceTag(flag) range
let block = zencoding#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = getpos('.')
endif
let n = curpos[1]
let ml = len(matchstr(getline(n), '^\s*'))
if a:flag > 0
if a:flag == 1 || !zencoding#util#regionIsValid(block)
let n = line('.')
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l < ml
let ml = l
break
endif
let n -= 1
endwhile
endif
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l > ml
let ml = l
break
endif
let n += 1
endwhile
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
endif
endfunction
function! zencoding#lang#sass#moveNextPrev(flag)
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
if pos == 2
startinsert!
elseif pos != 0
silent! normal! l
startinsert
endif
endfunction
function! zencoding#lang#sass#splitJoinTag()
endfunction
function! zencoding#lang#sass#removeTag()
endfunction

View file

@ -1,121 +0,0 @@
function! zencoding#lang#scss#findTokens(str)
return zencoding#lang#html#findTokens(a:str)
endfunction
function! zencoding#lang#scss#parseIntoTree(abbr, type)
if a:abbr =~ '>'
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
else
return zencoding#lang#css#parseIntoTree(a:abbr, a:type)
endif
endfunction
function! zencoding#lang#scss#toString(settings, current, type, inline, filters, itemno, indent)
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let str = ""
let current_name = substitute(current.name, '\$$', itemno+1, '')
if len(current.name) > 0
let str .= current_name
let tmp = ''
for attr in keys(current.attr)
let val = current.attr[attr]
while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
if attr == 'id'
let str .= '#' . val
elseif attr == 'class'
let str .= '.' . val
else
let tmp .= attr . ': ' . val . ';'
endif
endfor
if len(tmp) > 0
let str .= " {\n"
for line in split(tmp, "\n")
let str .= indent . line . "\n"
endfor
else
let str .= " {\n"
endif
let inner = ''
for child in current.child
let inner .= zencoding#toString(child, type, inline, filters, itemno)
endfor
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g')
let str .= indent . inner . "\n}\n"
else
return zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
endif
return str
endfunction
function! zencoding#lang#scss#imageSize()
call zencoding#lang#css#imageSize()
endfunction
function! zencoding#lang#scss#encodeImage()
return zencoding#lang#css#encodeImage()
endfunction
function! zencoding#lang#scss#parseTag(tag)
return zencoding#lang#css#parseTag(a:tag)
endfunction
function! zencoding#lang#scss#toggleComment()
call zencoding#lang#css#toggleComment()
endfunction
function! zencoding#lang#scss#balanceTag(flag) range
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
call setpos('.', curpos)
else
let curpos = getpos('.')
endif
if a:flag < 0
let ret = searchpair('}', '', '.\zs{')
else
let ret = searchpair('{', '', '}', 'bW')
endif
if ret > 0
let pos1 = getpos('.')[1:2]
if a:flag < 0
let pos2 = searchpairpos('{', '', '}')
else
let pos2 = searchpairpos('{', '', '}')
endif
let block = [pos1, pos2]
if zencoding#util#regionIsValid(block)
call zencoding#util#selectRegion(block)
return
endif
endif
if a:flag == -2 || a:flag == 2
silent! exe "normal! gv"
else
call setpos('.', curpos)
endif
endfunction
function! zencoding#lang#scss#moveNextPrev(flag)
call zencoding#lang#css#moveNextPrev(a:flag)
endfunction
function! zencoding#lang#scss#splitJoinTag()
call zencoding#lang#css#splitJoinTag()
endfunction
function! zencoding#lang#scss#removeTag()
call zencoding#lang#ss#removeTag()
endfunction

View file

@ -1,276 +0,0 @@
function! zencoding#lang#slim#findTokens(str)
return zencoding#lang#html#findTokens(a:str)
endfunction
function! zencoding#lang#slim#parseIntoTree(abbr, type)
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
endfunction
function! zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
let str = ""
let comment_indent = ''
let comment = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '')
endif
if len(current.name) > 0
let str .= current_name
for attr in current.attrs_order
if !has_key(current.attr, attr)
continue
endif
let val = current.attr[attr]
if dollar_expr
while val =~ '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
endif
let attr = substitute(attr, '\$$', itemno+1, '')
let str .= ' ' . attr . '="' . val . '"'
endfor
let inner = ''
if len(current.value) > 0
let str .= "\n"
let text = current.value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
let str = substitute(str, '\$#', text, 'g')
endif
for line in split(text, "\n")
let str .= indent . "| " . line . "\n"
endfor
elseif len(current.child) == 0
let str .= '${cursor}'
endif
if len(current.child) == 1 && len(current.child[0].name) == 0
let str .= "\n"
let text = current.child[0].value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
endif
for line in split(text, "\n")
let str .= indent . "| " . line . "\n"
endfor
elseif len(current.child) > 0
for child in current.child
let inner .= zencoding#toString(child, type, inline, filters, itemno)
endfor
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g')
let str .= "\n" . indent . inner
endif
else
let str = current.value[1:-2]
if dollar_expr
let str = substitute(str, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let str = substitute(str, '\${nr}', "\n", 'g')
let str = substitute(str, '\\\$', '$', 'g')
endif
endif
if str !~ "\n$"
let str .= "\n"
endif
return str
endfunction
function! zencoding#lang#slim#imageSize()
let line = getline('.')
let current = zencoding#lang#slim#parseTag(line)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn =~ '^\s*$'
return
elseif fn !~ '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = zencoding#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let current.attrs_order += ['width', 'height']
let slim = zencoding#toString(current, 'slim', 1)
let slim = substitute(slim, '\${cursor}', '', '')
call setline('.', substitute(matchstr(line, '^\s*') . slim, "\n", "", "g"))
endfunction
function! zencoding#lang#slim#encodeImage()
endfunction
function! zencoding#lang#slim#parseTag(tag)
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] }
let mx = '\([a-zA-Z][a-zA-Z0-9]*\)\s\+\(.*\)'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i')
let attrs = substitute(match, mx, '\2', 'i')
let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)
if len(match) == 0
break
endif
let attr_match = matchlist(match, mx)
let name = attr_match[1]
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
let current.attr[name] = value
let current.attrs_order += [name]
let attrs = attrs[stridx(attrs, match) + len(match):]
endwhile
return current
endfunction
function! zencoding#lang#slim#toggleComment()
let line = getline('.')
let space = matchstr(line, '^\s*')
if line =~ '^\s*/'
call setline('.', space . line[len(space)+1:])
elseif line =~ '^\s*[a-z]'
call setline('.', space . '/' . line[len(space):])
endif
endfunction
function! zencoding#lang#slim#balanceTag(flag) range
let block = zencoding#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = getpos('.')
endif
let n = curpos[1]
let ml = len(matchstr(getline(n), '^\s*'))
if a:flag > 0
if a:flag == 1 || !zencoding#util#regionIsValid(block)
let n = line('.')
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l < ml
let ml = l
break
endif
let n -= 1
endwhile
endif
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l > ml
let ml = l
break
endif
let n += 1
endwhile
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
endif
endfunction
function! zencoding#lang#slim#moveNextPrev(flag)
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
if pos == 2
startinsert!
elseif pos != 0
silent! normal! l
startinsert
endif
endfunction
function! zencoding#lang#slim#splitJoinTag()
let n = line('.')
while n > 0
if getline(n) =~ '^\s*\ze[a-z]'
let sn = n
let n += 1
if getline(n) =~ '^\s*|'
while n <= line('$')
if getline(n) !~ '^\s*|'
break
endif
exe n "delete"
endwhile
call setpos('.', [0, sn, 1, 0])
else
let spaces = matchstr(getline(sn), '^\s*')
call append(sn, spaces . ' | ')
call setpos('.', [0, sn+1, 1, 0])
startinsert!
endif
break
endif
let n -= 1
endwhile
endfunction
function! zencoding#lang#slim#removeTag()
let n = line('.')
let ml = 0
while n > 0
if getline(n) =~ '^\s*\ze[a-z]'
let ml = len(matchstr(getline(n), '^\s*[a-z]'))
break
endif
let n -= 1
endwhile
let sn = n
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
if sn == n
exe "delete"
else
exe sn "," (n-1) "delete"
endif
endfunction

View file

@ -1,249 +0,0 @@
"==============================================================================
" region utils
"==============================================================================
" deleteContent : delete content in region
" if region make from between '<foo>' and '</foo>'
" --------------------
" begin:<foo>
" </foo>:end
" --------------------
" this function make the content as following
" --------------------
" begin::end
" --------------------
function! zencoding#util#deleteContent(region)
let lines = getline(a:region[0][0], a:region[1][0])
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
silent! exe "delete ".(a:region[1][0] - a:region[0][0])
call setline(line('.'), lines[0][:a:region[0][1]-2] . lines[-1][a:region[1][1]])
endfunction
" change_content : change content in region
" if region make from between '<foo>' and '</foo>'
" --------------------
" begin:<foo>
" </foo>:end
" --------------------
" and content is
" --------------------
" foo
" bar
" baz
" --------------------
" this function make the content as following
" --------------------
" begin:foo
" bar
" baz:end
" --------------------
function! zencoding#util#setContent(region, content)
let newlines = split(a:content, '\n', 1)
let oldlines = getline(a:region[0][0], a:region[1][0])
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
silent! exe "delete ".(a:region[1][0] - a:region[0][0])
if len(newlines) == 0
let tmp = ''
if a:region[0][1] > 1
let tmp = oldlines[0][:a:region[0][1]-2]
endif
if a:region[1][1] >= 1
let tmp .= oldlines[-1][a:region[1][1]:]
endif
call setline(line('.'), tmp)
elseif len(newlines) == 1
if a:region[0][1] > 1
let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0]
endif
if a:region[1][1] >= 1
let newlines[0] .= oldlines[-1][a:region[1][1]:]
endif
call setline(line('.'), newlines[0])
else
if a:region[0][1] > 1
let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0]
endif
if a:region[1][1] >= 1
let newlines[-1] .= oldlines[-1][a:region[1][1]:]
endif
call setline(line('.'), newlines[0])
call append(line('.'), newlines[1:])
endif
endfunction
" select_region : select region
" this function make a selection of region
function! zencoding#util#selectRegion(region)
call setpos('.', [0, a:region[1][0], a:region[1][1], 0])
normal! v
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
endfunction
" point_in_region : check point is in the region
" this function return 0 or 1
function! zencoding#util#pointInRegion(point, region)
if !zencoding#util#regionIsValid(a:region) | return 0 | endif
if a:region[0][0] > a:point[0] | return 0 | endif
if a:region[1][0] < a:point[0] | return 0 | endif
if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif
if a:region[1][0] == a:point[0] && a:region[1][1] < a:point[1] | return 0 | endif
return 1
endfunction
" cursor_in_region : check cursor is in the region
" this function return 0 or 1
function! zencoding#util#cursorInRegion(region)
if !zencoding#util#regionIsValid(a:region) | return 0 | endif
let cur = getpos('.')[1:2]
return zencoding#util#pointInRegion(cur, a:region)
endfunction
" region_is_valid : check region is valid
" this function return 0 or 1
function! zencoding#util#regionIsValid(region)
if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif
return 1
endfunction
" search_region : make region from pattern which is composing start/end
" this function return array of position
function! zencoding#util#searchRegion(start, end)
return [searchpairpos(a:start, '', a:end, 'bcnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
endfunction
" get_content : get content in region
" this function return string in region
function! zencoding#util#getContent(region)
if !zencoding#util#regionIsValid(a:region)
return ''
endif
let lines = getline(a:region[0][0], a:region[1][0])
if a:region[0][0] == a:region[1][0]
let lines[0] = lines[0][a:region[0][1]-1:a:region[1][1]-1]
else
let lines[0] = lines[0][a:region[0][1]-1:]
let lines[-1] = lines[-1][:a:region[1][1]-1]
endif
return join(lines, "\n")
endfunction
" region_in_region : check region is in the region
" this function return 0 or 1
function! zencoding#util#regionInRegion(outer, inner)
if !zencoding#util#regionIsValid(a:inner) || !zencoding#util#regionIsValid(a:outer)
return 0
endif
return zencoding#util#pointInRegion(a:inner[0], a:outer) && zencoding#util#pointInRegion(a:inner[1], a:outer)
endfunction
" get_visualblock : get region of visual block
" this function return region of visual block
function! zencoding#util#getVisualBlock()
return [[line("'<"), col("'<")], [line("'>"), col("'>")]]
endfunction
"==============================================================================
" html utils
"==============================================================================
function! zencoding#util#getContentFromURL(url)
let res = system(printf("%s %s", g:zencoding_curl_command, shellescape(substitute(a:url, '#.*', '', ''))))
let s1 = len(split(res, '?'))
let utf8 = iconv(res, 'utf-8', &encoding)
let s2 = len(split(utf8, '?'))
return (s2 == s1 || s2 >= s1 * 2) ? utf8 : res
endfunction
function! zencoding#util#getTextFromHTML(buf)
let threshold_len = 100
let threshold_per = 0.1
let buf = a:buf
let buf = strpart(buf, stridx(buf, '</head>'))
let buf = substitute(buf, '<style[^>]*>.\{-}</style>', '', 'g')
let buf = substitute(buf, '<script[^>]*>.\{-}</script>', '', 'g')
let res = ''
let max = 0
let mx = '\(<td[^>]\{-}>\)\|\(<\/td>\)\|\(<div[^>]\{-}>\)\|\(<\/div>\)'
let m = split(buf, mx)
for str in m
let c = split(str, '<[^>]*?>')
let str = substitute(str, '<[^>]\{-}>', ' ', 'g')
let str = substitute(str, '&gt;', '>', 'g')
let str = substitute(str, '&lt;', '<', 'g')
let str = substitute(str, '&quot;', '"', 'g')
let str = substitute(str, '&apos;', "'", 'g')
let str = substitute(str, '&nbsp;', ' ', 'g')
let str = substitute(str, '&yen;', '\&#65509;', 'g')
let str = substitute(str, '&amp;', '\&', 'g')
let str = substitute(str, '^\s*\(.*\)\s*$', '\1', '')
let str = substitute(str, '\s\+', ' ', 'g')
let l = len(str)
if l > threshold_len
let per = (l+0.0) / len(c)
if max < l && per > threshold_per
let max = l
let res = str
endif
endif
endfor
let res = substitute(res, '^\s*\(.*\)\s*$', '\1', 'g')
return res
endfunction
function! zencoding#util#getImageSize(fn)
let fn = a:fn
if zencoding#util#isImageMagickInstalled()
return zencoding#util#imageSizeWithImageMagick(fn)
endif
if filereadable(fn)
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
else
let hex = substitute(system(g:zencoding_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
endif
let [width, height] = [-1, -1]
if hex =~ '^89504e470d0a1a0a'
let width = eval('0x'.hex[32:39])
let height = eval('0x'.hex[40:47])
endif
if hex =~ '^ffd8'
let pos = 4
while pos < len(hex)
let bs = hex[pos+0:pos+3]
let pos += 4
if bs == 'ffc0' || bs == 'ffc2'
let pos += 6
let height = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])
let pos += 4
let width = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])
break
elseif bs =~ 'ffd[9a]'
break
elseif bs =~ 'ff\(e[0-9a-e]\|fe\|db\|dd\|c4\)'
let pos += (eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])) * 2
endif
endwhile
endif
if hex =~ '^47494638'
let width = eval('0x'.hex[14:15].hex[12:13])
let height = eval('0x'.hex[18:19].hex[16:17])
endif
return [width, height]
endfunction
function! zencoding#util#imageSizeWithImageMagick(fn)
let img_info = system('identify -format "%wx%h" "'.a:fn.'"')
let img_size = split(substitute(img_info, '\n', '', ''), 'x')
let width = img_size[0]
let height = img_size[1]
return [width, height]
endfunction
function! zencoding#util#isImageMagickInstalled()
if !get(s:, 'zencoding_use_identify', 1)
return 0
endif
return executable('identify')
endfunction

View file

@ -1,438 +0,0 @@
*zencoding.txt* ZenCoding for Vim
-------------------------------------------------------
ZenCoding: vim plugins for HTML and CSS hi-speed coding
-------------------------------------------------------
Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
WebSite: http://mattn.kaoriya.net/
Repository: http://github.com/mattn/zencoding-vim
Site: http://mattn.github.com/zencoding-vim
License: BSD style license
==============================================================================
CONTENTS *zencoding-contents*
Introduction |zencoding-introduction|
Install |zencoding-install|
Tutorial |zencoding-tutorial|
1. Expand Abbreviation |zencoding-expandabbr|
2. Wrap with Abbreviation |zencoding-wrap-wtih-abbreviation|
3. Balance Tag Inward |zencoding-balance-tag-inward|
4. Balance Tag Outward |zencoding-balance-tag-outward|
5. Go to Next Edit Point |zencoding-goto-next-point| |<C-Y>n|
6. Go to Previous Edit Point |zencoding-goto-previous-point|
7. Update <img> Size |zencoding-update-image-size|
8. Merge Lines |zencoding-merge-lines|
9. Remove Tag |zencoding-remove-tag|
10. Split/Join Tag |zencoding-split-join-tag|
11. Toggle Comment |zencoding-toggle-comment|
12. Make anchor from URL |zencoding-make-anchor-url|
13. Make quoted text from URL |zencoding-quoted-text-url|
14. Code Pretty |zencoding-code-pretty|
Customize |zencoding-customize|
1. Key Mappings |zencoding-customize-keymappings|
2. Indent Size |zencoding-indent-size|
3. Define Tag's Behavior |zencoding-define-tags-behavior|
4. Complete Tag |zencoding-complete-tag|
Links |zencoding-links|
ToDo |zencoding-todo|
==============================================================================
INTRODUCTION *zencoding-introduction* *zencoding*
|ZenCoding| is an editor plugin for high-speed HTML, XML, XSL (or any other
structured code format) coding and editing. The core of this plugin is a
powerful abbreviation engine which allows you to expand expressions?similar to
CSS selectors?into HTML code:
>
div#page>div.logo+ul#navigation>li*5>a
<
...can be expanded into:
>
<div id="page">
<div class="logo"></div>
<ul id="navigation">
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul>
</div>
<
Read more about current Zen Coding syntax
http://code.google.com/p/zen-coding/wiki/ZenHTMLSelectorsEn
Abbreviation engine has a modular structure which allows you to expand
abbreviations into different languages. Zen Coding currently supports CSS,
HTML, XML/XSL and HAML, Slim languages via filters.
==============================================================================
INSTALL *zencoding-install*
Install the distributed files into Vim runtime directory which is usually
~/.vim/, or $HOME/vimfiles on Windows.
If you install pathogen that provided from Tim Pope, you should extract the
file into 'bundle' directory.
==============================================================================
TUTORIAL *zencoding-tutorial*
If you are seeing this file as :help, then you can't edit this file.
You should copy this section and create new buffer, paste and write as
'zencoding-tutor.txt'. Formally, open the file to start tutorial.
1. Expand Abbreviation *zencoding-expandabbr* *<C-Y>,*
Type abbreviation as 'div>p#foo$*3>a' and type |<C-Y>,|.
>
<div>
<p id="foo1">
<a href=""></a>
</p>
<p id="foo2">
<a href=""></a>
</p>
<p id="foo3">
<a href=""></a>
</p>
</div>
<
2. Wrap with Abbreviation *zencoding-wrap-wtih-abbreviation* *v_<C-Y>,*
Write as below.
>
test1
test2
test3
<
Then do visual select(line wize) and type |<C-Y>,|.
If you request 'Tag:', then type 'ul>li*'.
>
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
</ul>
<
If you type tag as 'blockquote', then you'll see as following.
>
<blockquote>
test1
test2
test3
</blockquote>
<
3. Balance Tag Inward *zencoding-balance-tag-inward* *<C-Y>d*
To select inward of ul tag, type |<C-Y>d| in insert mode.
>
<ul>
* <li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
<
If cursor is at '*', |<C-Y>d| select from begin of <ul> to end of </ul>.
If cursor is at first of <li>, it select <li class="list1"></li>.
4. Balance Tag Outward *zencoding-balance-tag-outward* *<C-Y>D*
To select outward of ul tag, insert mode, type <C-Y>D in insert mode.
>
<ul>
* <li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
<
If cursor is at '*', |<C-Y>D| select from next letter of <ul> to previous
letter of </ul>.
If cursor is at first of <li>, it select <li class="list1"></li>.
5. Go to Next Edit Point *zencoding-goto-next-point* *<C-Y>n*
To jump next point that need to edit, type |<C-Y>n| in insert mode.
>
* <div id="foo" class="">foo</div>
<div id="bar" class="bar"></li>
<
If cursor is at '*', |<C-Y>n| move a cursor into attribute value of div
specified id as 'foo'. And type again |<C-Y>n| move a cursor into inner of
div specified id as 'bar'.
6. Go to Previous Edit Point *zencoding-goto-previous-point* *<C-Y>N*
To jump previous point that need to edit, type |<C-Y>N| in insert mode.
>
<div id="foo" class="">foo</div>
<div id="bar" class="bar"></li> *
<
If cursor is at '*', |<C-Y>N| move a cursor into div specified id as 'bar'.
And type again |<C-Y>N| move a cursor into attribute value of 'foo'.
7. Update <img> Size *zencoding-update-image-size* *<C-Y>i*
To expand or update size of image, type |<C-Y>i| on img tag
>
<img src="foo.png" />
<
Type '<c-y>i' on img tag
>
<img src="foo.png" width="32" height="32" />
<
If you change image, then type it again. it will be following.
>
<img src="foo-48.png" width="32" height="48" />
<
8. Merge Lines *zencoding-merge-lines*
To join multi line text like following, type |J|.
>
<ul>
<li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
<
If you select part of line include <li> and type |<C-Y>m|, it will be
following.
>
<ul>
<li class="list1"></li><li class="list2"></li><li class="list3"></li>
</ul>
<
9. Remove Tag *zencoding-remove-tag* *<C-Y>k*
To remove tag in the block, type |<C-Y>k|.
>
<div class="foo">
<a>cursor is here</a>
</div>
<
Type |<C-Y>k| in insert mode, then
>
<div class="foo">
</div>
<
And type |<C-Y>k| in there again, then div will be removed.
10. Split/Join Tag *zencoding-split-join-tag* *<C-Y>j*
To join block, type |<C-Y>j|.
>
<div class="foo">
cursor is here
</div>
<
Type |<C-Y>j| in insert mode. then,
>
<div class="foo"/>
<
And type |<C-Y>j| in there again.
>
<div class="foo">
</div>
<
11. Toggle Comment *zencoding-toggle-comment* *<C-Y>/*
Move cursor to block
>
<div>
hello world
</div>
<
Type '<c-y>/' in insert mode.
>
<!-- <div>
hello world
</div> -->
<
Type '<c-y>/' in there again.
>
<div>
hello world
</div>
<
12. Make anchor from URL *zencoding-make-anchor-url* *<C-Y>a*
Move cursor to URL
>
http://www.google.com/
<
Type |<C-Y>a|
>
<a href="http://www.google.com/">Google</a>
<
13. Make quoted text from URL *zencoding-quoted-text-url* *<C-Y>A*
Move cursor to URL
>
http://github.com/
<
Type |<C-Y>A|
>
<blockquote class="quote">
<a href="http://github.com/">Secure source code hosting and collaborative development - GitHub</a><br />
<p>How does it work? Get up and running in seconds by forking a project, pushing an existing repository...</p>
<cite>http://github.com/</cite>
</blockquote>
<
14. Code Pretty *zencoding-code-pretty* *<C-Y>c*
Select code block, for example select following code from "int main()".
>
<p>Writing in C language</p>
int main() {
puts("hello world");
}
<
Type |<C-Y>c|
>
<p>Writing in C language</p>
<span class="Type">int</span>&nbsp;main() {<br />
&nbsp;&nbsp;puts(<span class="Constant">&quot;hello world&quot;</span>);<br />
}<br />
<
==============================================================================
CUSTOMIZE *zencoding-customize*
1. Key Mapping *zencoding-customize-keymappings*
To specify leading key for expanding or balance tag, or for all,
Add this line in your vimrc: >
>
let g:user_zen_leader_key = '<c-y>'
<
Or if you prefer to map for each actions, then you set each variables.
'user_zen_expandabbr_key'
'user_zen_expandword_key'
'user_zen_balancetaginward_key'
'user_zen_balancetagoutward_key'
'user_zen_next_key'
'user_zen_prev_key'
'user_zen_imagesize_key'
'user_zen_togglecomment_key'
'user_zen_splitjointag_key'
'user_zen_removetag_key'
'user_zen_anchorizeurl_key'
'user_zen_anchorizesummary_key'
2. Indent Size *zencoding-indent-size*
To change indent size of html, add this code in your vimrc.
>
let g:user_zen_settings = {
\ 'html' : {
\ 'indentation' : ' '
\ },
\}
<
If you prefer to change global indent size then add this.
>
let g:user_zen_settings = {
\ 'indentation' : ' '
\}
<
3. Define Tag's Behavior *zencoding-define-tags-behavior*
zencoding.vim can change behavior of expanding abbreviation for each
filetypes as |Dictionary|. for details, see official site of zencoding.
for example, vimmer can add following.
>
let g:user_zen_settings = {
\ 'lang' : 'ja',
\ 'html' : {
\ 'filters' : 'html',
\ 'indentation' : ' '
\ },
\ 'perl' : {
\ 'indentation' : ' ',
\ 'aliases' : {
\ 'req' : "require '|'"
\ },
\ 'snippets' : {
\ 'use' : "use strict\nuse warnings\n\n",
\ 'w' : "warn \"${cursor}\";",
\ },
\ },
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'html,c',
\ },
\ 'css' : {
\ 'filters' : 'fc',
\ },
\ 'javascript' : {
\ 'snippets' : {
\ 'jq' : "$(function() {\n\t${cursor}${child}\n});",
\ 'jq:each' : "$.each(arr, function(index, item)\n\t${child}\n});",
\ 'fn' : "(function() {\n\t${cursor}\n})();",
\ 'tm' : "setTimeout(function() {\n\t${cursor}\n}, 100);",
\ },
\ },
\ 'java' : {
\ 'indentation' : ' ',
\ 'snippets' : {
\ 'main': "public static void main(String[] args) {\n\t|\n}",
\ 'println': "System.out.println(\"|\");",
\ 'class': "public class | {\n}\n",
\ },
\ },
\}
<
4. Complete Tag *zencoding-complete-tag*
If you want to complete tags using |omnifunc| then add this.
>
let g:use_zen_complete_tag = 1
<
5. Enable functions in different mode
If you want to use zencoding only in some modes, set an mode option:
let g:user_zen_mode='n' "only enable normal mode functions, or
let g:user_zen_mode='inv' "enable all functions, which is equal to
let g:user_zen_mode='a' "enable all function in all mode.
==============================================================================
LINKS *zencoding-links*
zen-coding official site:
http://code.google.com/p/zen-coding/
zencoding.vim:
http://mattn.github.com/zencoding-vim
development repository:
https://github.com/mattn/zencoding-vim
my blog posts about zencoding-vim:
http://mattn.kaoriya.net/software/vim/20100222103327.htm
http://mattn.kaoriya.net/software/vim/20100306021632.htm
japanese blog posts about zencoding-vim:
http://d.hatena.ne.jp/idesaku/20100424/1272092255
http://d.hatena.ne.jp/griefworker/20110118/vim_zen_coding
http://d.hatena.ne.jp/sakurako_s/20110126/1295988873
http://looxu.blogspot.jp/2010/02/zencodingvimhtml.html
tutorial traslated in chinese:
http://www.zfanw.com/blog/zencoding-vim-tutorial-chinese.html
==============================================================================
TODO *zencoding-todo*
* wrapping inline selected.
* more documents.
* more contributor.
* more time to improve zencodig.vim.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:

View file

@ -1,215 +0,0 @@
"=============================================================================
" File: zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 13-Feb-2013.
" Version: 0.75
" WebPage: http://github.com/mattn/zencoding-vim
" Description: vim plugins for HTML and CSS hi-speed coding.
" SeeAlso: http://code.google.com/p/zen-coding/
" Usage:
"
" This is vim script support expanding abbreviation like zen-coding.
" ref: http://code.google.com/p/zen-coding/
"
" Type abbreviation
" +-------------------------------------
" | html:5_
" +-------------------------------------
" "_" is a cursor position. and type "<c-y>," (Ctrl+y and Comma)
" NOTE: Don't worry about key map. you can change it easily.
" +-------------------------------------
" | <!DOCTYPE HTML>
" | <html lang="en">
" | <head>
" | <title></title>
" | <meta charset="UTF-8">
" | </head>
" | <body>
" | _
" | </body>
" | </html>
" +-------------------------------------
" Type following
" +-------------------------------------
" | div#foo$*2>div.bar
" +-------------------------------------
" And type "<c-y>,"
" +-------------------------------------
" |<div id="foo1">
" | <div class="bar">_</div>
" |</div>
" |<div id="foo2">
" | <div class="bar"></div>
" |</div>
" +-------------------------------------
"
" Tips:
"
" You can customize behavior of expanding with overriding config.
" This configuration will be marged at loading plugin.
"
" let g:user_zen_settings = {
" \ 'indentation' : ' ',
" \ 'perl' : {
" \ 'aliases' : {
" \ 'req' : 'require '
" \ },
" \ 'snippets' : {
" \ 'use' : "use strict\nuse warnings\n\n",
" \ 'warn' : "warn \"|\";",
" \ }
" \ }
" \}
"
" You can set language attribute in html using 'zen_settings.lang'.
"
" GetLatestVimScripts: 2981 1 :AutoInstall: zencoding.vim
" script type: plugin
if &cp || (exists('g:loaded_zencoding_vim') && g:loaded_zencoding_vim)
finish
endif
let g:loaded_zencoding_vim = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:zencoding_debug')
let g:zencoding_debug = 0
endif
if !exists('g:zencoding_curl_command')
let g:zencoding_curl_command = 'curl -s -L -A Mozilla/5.0'
endif
if exists('g:use_zen_complete_tag') && g:use_zen_complete_tag
setlocal omnifunc=zencoding#CompleteTag
endif
if !exists('g:user_zen_leader_key')
let g:user_zen_leader_key = '<c-y>'
endif
function! s:install_plugin_i()
for item in [
\ {'mode': 'i', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandAbbr', 'func': '<c-g>u<esc>:call zencoding#expandAbbr(0,"")<cr>a'},
\ {'mode': 'i', 'var': 'user_zen_expandword_key', 'key': ';', 'plug': 'ZenCodingExpandWord', 'func': '<c-g>u<esc>:call zencoding#expandAbbr(1,"")<cr>a'},
\ {'mode': 'i', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardInsert', 'func': '<esc>:call zencoding#balanceTag(1)<cr>'},
\ {'mode': 'i', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardInsert', 'func': '<esc>:call zencoding#balanceTag(-1)<cr>'},
\ {'mode': 'i', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': '<esc>:call zencoding#moveNextPrev(0)<cr>'},
\ {'mode': 'i', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': '<esc>:call zencoding#moveNextPrev(1)<cr>'},
\ {'mode': 'i', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': '<esc>:call zencoding#imageSize()<cr>a'},
\ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': '<esc>:call zencoding#toggleComment()<cr>a'},
\ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': '<esc>:call zencoding#splitJoinTag()<cr>'},
\ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': '<esc>:call zencoding#removeTag()<cr>a'},
\ {'mode': 'i', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': '<esc>:call zencoding#anchorizeURL(0)<cr>a'},
\ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': '<esc>:call zencoding#anchorizeURL(1)<cr>a'},
\]
if !hasmapto('<plug>'.item.plug, item.mode)
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
endif
if !exists('g:' . item.var)
endif
if exists('g:' . item.var)
let key = eval('g:' . item.var)
else
let key = g:user_zen_leader_key . item.key
endif
if len(maparg(key, item.mode)) == 0
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
endif
endfor
endfunction
function! s:install_plugin_n()
for item in [
\ {'mode': 'n', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandNormal', 'func': ':call zencoding#expandAbbr(3,"")<cr>'},
\ {'mode': 'n', 'var': 'user_zen_expandword_key', 'key': ',', 'plug': 'ZenCodingExpandWord', 'func': ':call zencoding#expandAbbr(1,"")<cr>'},
\ {'mode': 'n', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardNormal', 'func': ':call zencoding#balanceTag(1)<cr>'},
\ {'mode': 'n', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardNormal', 'func': ':call zencoding#balanceTag(-1)<cr>'},
\ {'mode': 'n', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': ':call zencoding#moveNextPrev(0)<cr>'},
\ {'mode': 'n', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': ':call zencoding#moveNextPrev(1)<cr>'},
\ {'mode': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()<cr>'},
\ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()<cr>'},
\ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()<cr>'},
\ {'mode': 'n', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()<cr>'},
\ {'mode': 'n', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)<cr>'},
\ {'mode': 'n', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)<cr>'},
\]
if !hasmapto('<plug>'.item.plug, item.mode)
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
endif
if !exists('g:' . item.var)
endif
if exists('g:' . item.var)
let key = eval('g:' . item.var)
else
let key = g:user_zen_leader_key . item.key
endif
if len(maparg(key, item.mode)) == 0
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
endif
endfor
endfunction
function! s:install_plugin_v()
for item in [
\ {'mode': 'v', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandVisual', 'func': ':call zencoding#expandAbbr(2,"")<cr>'},
\ {'mode': 'v', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardVisual', 'func': ':call zencoding#balanceTag(2)<cr>'},
\ {'mode': 'v', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardVisual', 'func': ':call zencoding#balanceTag(-2)<cr>'},
\ {'mode': 'v', 'var': 'user_zen_mergelines_key', 'key': 'm', 'plug': 'ZenCodingMergeLines', 'func': ':call zencoding#mergeLines()<cr>'},
\ {'mode': 'v', 'var': 'user_zen_codepretty_key', 'key': 'c', 'plug': 'ZenCodingCodePretty', 'func': ':call zencoding#codePretty()<cr>'},
\]
if !hasmapto('<plug>'.item.plug, item.mode)
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
endif
if !exists('g:' . item.var)
endif
if exists('g:' . item.var)
let key = eval('g:' . item.var)
else
let key = g:user_zen_leader_key . item.key
endif
if len(maparg(key, item.mode)) == 0
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
endif
endfor
endfunction
if exists('g:user_zen_mode')
let imode = matchstr(g:user_zen_mode, '[ai]')
let nmode = matchstr(g:user_zen_mode, '[an]')
let vmode = matchstr(g:user_zen_mode, '[av]')
if !empty(imode)
call s:install_plugin_i()
endif
if !empty(nmode)
call s:install_plugin_n()
endif
if !empty(vmode)
call s:install_plugin_v()
endif
else
call s:install_plugin_i()
call s:install_plugin_n()
call s:install_plugin_v()
endif
delfunction s:install_plugin_i
delfunction s:install_plugin_n
delfunction s:install_plugin_v
command! -nargs=1 Zen call zencoding#expandAbbr(4, <q-args>)
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et:

View file

@ -1,794 +0,0 @@
let s:sfile = expand('<sfile>')
function! s:reload(d)
exe "so" a:d."/plugin/zencoding.vim"
for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n")
silent! exe "so" f
endfor
endfunction
function! s:show_type(type)
echohl Search | echon "[" a:type "]\n" | echohl None
echo "\r"
endfunction
function! s:show_category(category)
echohl MatchParen | echon "[" a:category "]\n" | echohl None
echo "\r"
endfunction
function! s:show_pass(pass)
echohl Title | echo "pass".a:pass."\n" | echohl None
endfunction
function! s:show_done()
echohl IncSearch | echo "done" | echohl None
endfunction
function! s:escape(str)
let str = a:str
let str = substitute(str, "\n", '\\n', 'g')
let str = substitute(str, "\t", '\\t', 'g')
return str
endfunction
function! s:show_title(no, title)
let title = s:escape(a:title)
let width = &columns - 23
echohl MoreMsg | echon "\rtesting #".printf("%03d", a:no)
echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
endfunction
function! s:show_skip(no, title)
let title = s:escape(a:title)
let width = &columns - 23
echohl WarningMsg | echon "\rskipped #".printf("%03d", a:no)
echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
echo ""
endfunction
function! s:show_ok()
echohl Title | echon "ok\n" | echohl None
echo ""
endfunction
function! s:show_ng(no, expect, got)
echohl WarningMsg | echon "ng\n" | echohl None
echohl ErrorMsg | echo "failed test #".a:no | echohl None
set more
echohl WarningMsg | echo printf("expect(%d):", len(a:expect)) | echohl None
echo join(split(a:expect, "\n", 1), "|\n")
echohl WarningMsg | echo printf("got(%d):", len(a:got)) | echohl None
echo join(split(a:got, "\n", 1), "|\n")
let cs = split(a:expect, '\zs')
for c in range(len(cs))
if c < len(a:got)
if a:expect[c] != a:got[c]
echohl WarningMsg | echo "differ at:" | echohl None
echo a:expect[c :-1]
break
endif
endif
endfor
echo ""
throw "stop"
endfunction
function! s:test(...)
let type = get(a:000, 0, '')
let name = get(a:000, 1, '')
let index = get(a:000, 2, '')
let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'")))
for testgroup in testgroups
if len(type) > 0 && testgroup.type != type | continue | endif
call s:show_type(testgroup.type)
for category in testgroup.categories
if len(name) > 0 && substitute(category.name,' ','_','g') != name | continue | endif
call s:show_category(category.name)
let tests = category.tests
let start = reltime()
for n in range(len(tests))
if len(index) > 0 && n != index | continue | endif
let query = tests[n].query
let result = tests[n].result
if has_key(tests[n], 'skip') && tests[n].skip != 0
call s:show_skip(n+1, query)
continue
endif
if stridx(query, '$$$$') != -1
silent! 1new
silent! exe "setlocal ft=".testgroup.type
silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$')
if len(key) > 0
exe printf('let key = "%s"', key)
else
let key = "\<c-y>,"
endif
silent! let query = substitute(query, '\$\$\$\$.*\$\$\$\$', '$$$$', '')
silent! call setline(1, split(query, "\n"))
let cmd = "normal gg0/\\$\\$\\$\\$\ri\<del>\<del>\<del>\<del>".key
if stridx(result, '$$$$') != -1
let cmd .= '$$$$'
endif
silent! exe cmd
unlet! res | let res = join(getline(1, line('$')), "\n")
silent! bw!
call s:show_title(n+1, query)
else
call s:show_title(n+1, query)
unlet! res | let res = zencoding#ExpandWord(query, testgroup.type, 0)
endif
if stridx(result, '$$$$') != -1
if res ==# result
call s:show_ok()
else
call s:show_ng(n+1, result, res)
endif
else
if res ==# result
call s:show_ok()
else
call s:show_ng(n+1, result, res)
endif
endif
endfor
call s:show_pass(reltimestr(reltime(start)))
endfor
endfor
endfunction
function! s:do_tests(...)
try
if exists('g:user_zen_settings')
let s:old_user_zen_settings = g:user_zen_settings
let g:user_zen_settings = { 'indentation': "\t" }
endif
let oldmore = &more
call s:reload(fnamemodify(s:sfile, ':h'))
let &more = 0
call call('s:test', a:000)
call s:show_done()
catch
echohl ErrorMsg | echomsg v:exception | echohl None
finally
let &more=oldmore
if exists('g:user_zen_settings')
let g:user_zen_settings = s:old_user_zen_settings
endif
endtry
endfunction
function! g:zencoding_unittest_complete(arglead, cmdline, cmdpos)
let args = split(a:cmdline, '\s\+', 1)
let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'")))
try
if len(args) == 2
return filter(map(testgroups, 'v:val.type'), 'stridx(v:val,args[1])!=-1')
elseif len(args) == 3
return map(filter(testgroups, 'v:val.type==args[1]')[0].categories, 'substitute(v:val.name," ","_","g")')
endif
catch
endtry
return []
endfunction
command! -nargs=* -complete=customlist,g:zencoding_unittest_complete ZenCodingUnitTest call s:do_tests(<f-args>)
if s:sfile == expand('%:p')
ZenCodingUnitTest
endif
finish
[
{
'type': "html",
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div",
'result': "<div></div>\n",
},
{
'query': "div#wrapper",
'result': "<div id=\"wrapper\"></div>\n",
},
{
'query': "div.box",
'result': "<div class=\"box\"></div>\n",
},
{
'query': "a[title=TITLE]",
'result': "<a href=\"\" title=\"TITLE\"></a>\n",
},
{
'query': "div#wrapper.box",
'result': "<div id=\"wrapper\" class=\"box\"></div>\n",
},
{
'query': "div#wrapper.box.current",
'result': "<div id=\"wrapper\" class=\"box current\"></div>\n",
},
{
'query': "div#wrapper.box.current[title=TITLE rel]",
'result': "<div id=\"wrapper\" class=\"box current\" title=\"TITLE\" rel=\"\"></div>\n",
},
{
'query': "div#main+div#sub",
'result': "<div id=\"main\"></div>\n<div id=\"sub\"></div>\n",
},
{
'query': "div#main>div#sub",
'result': "<div id=\"main\">\n\t<div id=\"sub\"></div>\n</div>\n",
},
{
'query': "html:xt>div#header>div#logo+ul#nav>li.item-$*5>a",
'result': "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" />\n\t<title></title>\n</head>\n<body>\n\t<div id=\"header\">\n\t\t<div id=\"logo\"></div>\n\t\t<ul id=\"nav\">\n\t\t\t<li class=\"item-1\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-2\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-3\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-4\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-5\"><a href=\"\"></a></li>\n\t\t</ul>\n\t</div>\n\t\n</body>\n</html>",
},
{
'query': "ol>li*2",
'result': "<ol>\n\t<li></li>\n\t<li></li>\n</ol>\n",
},
{
'query': "a",
'result': "<a href=\"\"></a>\n",
},
{
'query': "obj",
'result': "<object data=\"\" type=\"\"></object>\n",
},
{
'query': "cc:ie6>p+blockquote#sample$.so.many.classes*2",
'result': "<!--[if lte IE 6]>\n\t<p></p>\n\t<blockquote id=\"sample1\" class=\"so many classes\"></blockquote>\n\t<blockquote id=\"sample2\" class=\"so many classes\"></blockquote>\n\t\n<![endif]-->",
},
{
'query': "html:4t>div#wrapper>div#header+div#contents+div#footer",
'result': "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">\n\t<title></title>\n</head>\n<body>\n\t<div id=\"wrapper\">\n\t\t<div id=\"header\"></div>\n\t\t<div id=\"contents\"></div>\n\t\t<div id=\"footer\"></div>\n\t</div>\n\t\n</body>\n</html>",
},
{
'query': "a[href=http://www.google.com/].foo#hoge",
'result': "<a id=\"hoge\" class=\"foo\" href=\"http://www.google.com/\"></a>\n",
},
{
'query': "a[href=http://www.google.com/]{Google}",
'result': "<a href=\"http://www.google.com/\">Google</a>\n",
},
{
'query': "{ZenCoding}",
'result': "ZenCoding",
},
{
'query': "a+b",
'result': "<a href=\"\"></a>\n<b></b>\n",
},
{
'query': "a>b>i<b",
'result': "<a href=\"\"><b><i></i></b><b></b></a>\n",
},
{
'query': "a>b>i^b",
'result': "<a href=\"\"><b><i></i></b><b></b></a>\n",
},
{
'query': "a>b>i<<b",
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>\n",
},
{
'query': "a>b>i^^b",
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>\n",
},
{
'query': "blockquote>b>i<<b",
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>\n",
},
{
'query': "blockquote>b>i^^b",
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>\n",
},
{
'query': "a[href=foo][class=bar]",
'result': "<a class=\"bar\" href=\"foo\"></a>\n",
},
{
'query': "a[a=b][b=c=d][e]{foo}*2",
'result': "<a href=\"\" a=\"b\" b=\"c=d\" e=\"\">foo</a>\n<a href=\"\" a=\"b\" b=\"c=d\" e=\"\">foo</a>\n",
},
{
'query': "a[a=b][b=c=d][e]*2{foo}",
'result': "<a href=\"\" a=\"b\" b=\"c=d\" e=\"\"></a>\n<a href=\"\" a=\"b\" b=\"c=d\" e=\"\"></a>\nfoo",
},
{
'query': "a*2{foo}a",
'result': "<a href=\"\"></a>\n<a href=\"\"></a>\nfoo<a href=\"\"></a>\n",
},
{
'query': "a{foo}*2>b",
'result': "<a href=\"\">foo<b></b></a>\n<a href=\"\">foo<b></b></a>\n",
},
{
'query': "a*2{foo}>b",
'result': "<a href=\"\"></a>\n<a href=\"\"></a>\nfoo",
},
{
'query': "table>tr>td.name#foo+td*3",
'result': "<table>\n\t<tr>\n\t\t<td id=\"foo\" class=\"name\"></td>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n</table>\n",
},
{
'query': "div#header + div#footer",
'result': "<div id=\"header\"></div>\n<div id=\"footer\"></div>\n",
},
{
'query': "#header + div#footer",
'result': "<div id=\"header\"></div>\n<div id=\"footer\"></div>\n",
},
{
'query': "#header > ul > li < p{Footer}",
'result': "<div id=\"header\">\n\t<ul>\n\t\t<li></li>\n\t</ul>\n\t<p>Footer</p>\n</div>\n",
},
{
'query': "#header > ul > li ^ p{Footer}",
'result': "<div id=\"header\">\n\t<ul>\n\t\t<li></li>\n\t</ul>\n\t<p>Footer</p>\n</div>\n",
},
{
'query': "a#foo$$$*3",
'result': "<a id=\"foo001\" href=\"\"></a>\n<a id=\"foo002\" href=\"\"></a>\n<a id=\"foo003\" href=\"\"></a>\n",
},
{
'query': "ul+",
'result': "<ul>\n\t<li></li>\n</ul>\n",
},
{
'query': "table+",
'result': "<table>\n\t<tr>\n\t\t<td></td>\n\t</tr>\n</table>\n",
},
{
'query': "#header>li<#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "#header>li^#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "(#header>li)<#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "(#header>li)^#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "a>b>i<<div",
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
},
{
'query': "a>b>i^^div",
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
},
{
'query': "(#header>h1)+#content+#footer",
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\"></div>\n<div id=\"footer\"></div>\n",
},
{
'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\">\n\t<div id=\"main\">\n\t\t<h2></h2>\n\t\t<div id=\"entry1\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry2\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry3\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry4\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry5\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id=\"utilities\"></div>\n</div>\n<div id=\"footer\">\n\t<address></address>\n</div>\n",
},
{
'query': "(div>(ul*2)*2)+(#utilities)",
'result': "<div>\n\t<ul></ul>\n\t<ul></ul>\n\t<ul></ul>\n\t<ul></ul>\n</div>\n<div id=\"utilities\"></div>\n",
},
{
'query': "table>(tr>td*3)*4",
'result': "<table>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n</table>\n",
},
{
'query': "(((a#foo+a#bar)*2)*3)",
'result': "<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n",
},
{
'query': "div#box$*3>h3+p*2",
'result': "<div id=\"box1\">\n\t<h3></h3>\n\t<p></p>\n\t<p></p>\n</div>\n<div id=\"box2\">\n\t<h3></h3>\n\t<p></p>\n\t<p></p>\n</div>\n<div id=\"box3\">\n\t<h3></h3>\n\t<p></p>\n\t<p></p>\n</div>\n"
},
{
'query': "div#box.foo$$$.bar$$$*3",
'result': "<div id=\"box\" class=\"foo001 bar001\"></div>\n<div id=\"box\" class=\"foo002 bar002\"></div>\n<div id=\"box\" class=\"foo003 bar003\"></div>\n",
},
{
'query': "div#box$*3>h3+p.bar*2|e",
'result': "&lt;div id=\"box1\"&gt;\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n&lt;/div&gt;\n&lt;div id=\"box2\"&gt;\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n&lt;/div&gt;\n&lt;div id=\"box3\"&gt;\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n&lt;/div&gt;\n",
},
{
'query': "div>div#page>p.title+p|c",
'result': "<div>\n\t<!-- #page -->\n\t<div id=\"page\">\n\t\t<!-- .title -->\n\t\t<p class=\"title\"></p>\n\t\t<!-- /.title -->\n\t\t<p></p>\n\t</div>\n\t<!-- /#page -->\n</div>\n",
},
{
'query': "link:css",
'result': "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" media=\"all\" />\n",
},
{
'query': "a[title=\"Hello', world\" rel]",
'result': "<a href=\"\" title=\"Hello', world\" rel=\"\"></a>\n",
},
{
'query': "div>a#foo{bar}",
'result': "<div><a id=\"foo\" href=\"\">bar</a></div>\n",
},
{
'query': ".content{Hello!}",
'result': "<div class=\"content\">Hello!</div>\n",
},
{
'query': "div.logo+(div#navigation)+(div#links)",
'result': "<div class=\"logo\"></div>\n<div id=\"navigation\"></div>\n<div id=\"links\"></div>\n",
},
{
'query': "h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}",
'result': "<h1>header</h1>\nText<a href=\"http://link.org\">linktext</a>\nagain some text<a href=\"http://anoterlink.org\">click me!</a>\nsome final text",
},
{
'query': "a{&}+div{&&}",
'result': "<a href=\"\">&</a>\n<div>&&</div>\n",
},
{
'query': "<foo/>span$$$$\\<c-y>,$$$$",
'result': "<foo/><span></span>",
},
{
'query': "foo span$$$$\\<c-y>,$$$$",
'result': "foo <span></span>",
},
{
'query': "foo span$$$$\\<c-y>,$$$$ bar",
'result': "foo <span></span> bar",
},
{
'query': "foo $$$$\\<c-o>ve\\<c-y>,p\\<cr>$$$$bar baz",
'result': "foo <p>bar</p> baz",
},
{
'query': "foo $$$$\\<c-o>vee\\<c-y>,p\\<cr>$$$$bar baz",
'result': "foo <p>bar baz</p>",
},
{
'query': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$",
'result': "f <div class=\"boxes\">\n\t<article class=\"box2\">\n\t\t<header>\n\t\t\t<hgroup>\n\t\t\t\t<h2>aaa</h2>\n\t\t\t\t<h3>bbb</h3>\n\t\t\t</hgroup>\n\t\t\t<p>ccc</p>\n\t\t</header>\n\t</article>\n</div>",
},
{
'query': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})",
'result': "<div class=\"boxes\">\n\t<div class=\"box2\">\n\t\t<section>\n\t\t\t<h2>a</h2>\n\t\t\t<p>b</p>\n\t\t</section>\n\t</div>\n\t<div class=\"box1\">\n\t\t<section>\n\t\t\t<h2>c</h2>\n\t\t\t<p>d</p>\n\t\t\t<p>e</p>\n\t\t\t<blockquote>\n\t\t\t\t<h2>f</h2>\n\t\t\t\t<h3>g</h3>\n\t\t\t</blockquote>\n\t\t\t<p>h</p>\n\t\t</section>\n\t</div>\n</div>\n",
},
{
'query': "(div>(label+input))+div",
'result': "<div>\n\t<label for=\"\"></label>\n\t<input type=\"\" />\n</div>\n<div></div>\n",
},
{
'query': "test1\ntest2\ntest3$$$$\\<esc>ggVG\\<c-y>,ul>li>span*>a\\<cr>$$$$",
'result': "<ul>\n\t<li>\n\t\t<span><a href=\"\">test1</a></span>\n\t\t<span><a href=\"\">test2</a></span>\n\t\t<span><a href=\"\">test3</a></span>\n\t</li>\n</ul>",
},
{
'query': "test1\ntest2\ntest3$$$$\\<esc>ggVG\\<c-y>,input[type=input value=$#]*\\<cr>$$$$",
'result': "<input type=\"input\" value=\"test1\" />\n<input type=\"input\" value=\"test2\" />\n<input type=\"input\" value=\"test3\" />",
},
{
'query': "div#id-$*5>div#id2-$",
'result': "<div id=\"id-1\">\n\t<div id=\"id2-1\"></div>\n</div>\n<div id=\"id-2\">\n\t<div id=\"id2-2\"></div>\n</div>\n<div id=\"id-3\">\n\t<div id=\"id2-3\"></div>\n</div>\n<div id=\"id-4\">\n\t<div id=\"id2-4\"></div>\n</div>\n<div id=\"id-5\">\n\t<div id=\"id2-5\"></div>\n</div>\n",
},
{
'query': "{test case $ }*3",
'result': "test case 1 test case 2 test case 3 ",
},
{
'query': "{test case $${nr}}*3",
'result': "test case 1\ntest case 2\ntest case 3\n",
},
{
'query': "{test case \\$ }*3",
'result': "test case $ test case $ test case $ ",
},
{
'query': "{test case $$$ }*3",
'result': "test case 001 test case 002 test case 003 ",
},
{
'query': "a[title=$#]{foo}",
'result': "<a href=\"\" title=\"foo\">foo</a>\n",
},
],
},
{
'name': 'split join tag',
'tests': [
{
'query': "<div>\n\t<span>$$$$\\<c-y>j$$$$</span>\n</div>",
'result': "<div>\n\t<span/>\n</div>",
},
{
'query': "<div>\n\t<span$$$$\\<c-y>j$$$$/>\n</div>",
'result': "<div>\n\t<span></span>\n</div>",
},
],
},
{
'name': 'toggle comment',
'tests': [
{
'query': "<div>\n\t<span>$$$$\\<c-y>/$$$$</span>\n</div>",
'result': "<div>\n\t<!-- <span></span> -->\n</div>",
},
{
'query': "<div>\n\t<!-- <span>$$$$\\<c-y>/$$$$</span> -->\n</div>",
'result': "<div>\n\t<span></span>\n</div>",
},
],
},
{
'name': 'image size',
'tests': [
{
'query': "img[src=http://mattn.kaoriya.net/images/logo.png]$$$$\\<c-y>,\\<c-y>i$$$$",
'result': "<img src=\"http://mattn.kaoriya.net/images/logo.png\" alt=\"\" width=\"96\" height=\"96\" />",
},
{
'query': "img[src=/logo.png]$$$$\\<c-y>,\\<c-y>i$$$$",
'result': "<img src=\"/logo.png\" alt=\"\" />",
},
],
},
{
'name': 'move next prev',
'tests': [
{
'query': "foo+bar+baz[dankogai=\"\"]$$$$\\<c-y>,\\<esc>gg0\\<c-y>n\\<c-y>n\\<c-y>n\\<esc>Byw:%d _\\<cr>p$$$$",
'result': "dankogai",
},
],
},
],
},
{
'type': 'css',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "@i",
'result': "@import url();",
},
{
'query': "fs:n",
'result': "font-style: normal;",
},
{
'query': "fl:l|fc",
'result': "float: left;",
},
{
'query': "bg+$$$$",
'result': "background: #FFF url($$$$) 0 0 no-repeat;",
},
{
'query': "bg+!$$$$",
'result': "background: #FFF url($$$$) 0 0 no-repeat !important;",
},
{
'query': "m$$$$",
'result': "margin: $$$$;",
},
{
'query': "m0.1p$$$$",
'result': "margin: 0.1%;",
},
{
'query': "m1.0$$$$",
'result': "margin: 1.0em;",
},
{
'query': "m2$$$$",
'result': "margin: 2px;",
},
{
'query': "bdrs10$$$$",
'result': "border-radius: 10px;",
},
{
'query': "-bdrs20$$$$",
'result': "-webkit-border-radius: 20px;\n-moz-border-radius: 20px;\nborder-radius: 20px;",
},
{
'query': "lg(top,#fff,#000)$$$$",
'result': "background-image: -webkit-gradient(top, 0 0, 0 100, from(#fff), to(#000));\nbackground-image: -webkit-linear-gradient(#fff, #000);\nbackground-image: -moz-linear-gradient(#fff, #000);\nbackground-image: -o-linear-gradient(#fff, #000);\nbackground-image: linear-gradient(#fff, #000);\n",
},
{
'query': "m10-5-0$$$$",
'result': "margin: 10px 5px 0px;",
},
{
'query': "m-10--5$$$$",
'result': "margin: -10px -5px;",
},
{
'query': "m10-auto$$$$",
'result': "margin: 10px auto;",
},
{
'query': "w100p$$$$",
'result': "width: 100%;",
},
{
'query': "h50e$$$$",
'result': "height: 50em;",
},
{
'query': "(bg+)+c$$$$",
'result': "background: #FFF url($$$$) 0 0 no-repeat;\ncolor: #000;",
},
],
},
],
},
{
'type': 'haml',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}",
'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n",
},
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml",
'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n",
},
{
'query': "a*3|haml",
'result': "%a{ :href => \"\" }\n%a{ :href => \"\" }\n%a{ :href => \"\" }\n",
},
{
'query': ".content{Hello!}|haml",
'result': "%div.content Hello!\n",
},
{
'query': "a[title=$#]{foo}",
'result': "%a{ :href => \"\", :title => \"foo\" } foo\n",
},
],
},
{
'name': 'expand abbreviation',
'tests': [
{
'query': "%a foo\n bar$$$$\\<c-y>j$$$$",
'result': "%a ",
},
{
'query': "$$$$\\<c-y>j$$$$%a ",
'result': "%a $$$$",
},
],
},
{
'name': 'toggle comment',
'tests': [
{
'query': "%a{ :href => \"http://www.google.com\"$$$$\\<c-y>/$$$$ } hello",
'result': "-# %a{ :href => \"http://www.google.com\" } hello",
},
{
'query': "-# %a{ :href => \"http://www.google.com\"$$$$\\<c-y>/$$$$ } hello",
'result': "%a{ :href => \"http://www.google.com\" } hello",
},
],
},
],
},
{
'type': 'slim',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}",
'result': "div\n p\n ul id=\"foo\"\n li class=\"bar1\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar2\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar3\" foo=\"bar\" bar=\"baz\"\n | baz\n",
},
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim",
'result': "div\n p\n ul id=\"foo\"\n li class=\"bar1\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar2\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar3\" foo=\"bar\" bar=\"baz\"\n | baz\n",
},
{
'query': "a*3|slim",
'result': "a href=\"\"\na href=\"\"\na href=\"\"\n",
},
{
'query': ".content{Hello!}|slim",
'result': "div class=\"content\"\n | Hello!\n",
},
{
'query': "a[title=$#]{foo}",
'result': "a href=\"\" title=\"foo\"\n | foo\n",
},
],
},
{
'name': 'split join tag',
'tests': [
{
'query': "a\n | foo$$$$\\<c-y>j$$$$",
'result': "a",
},
{
'query': "a$$$$\\<c-y>j$$$$",
'result': "a\n | $$$$",
},
],
},
{
'name': 'toggle comment',
'tests': [
{
'query': "a href=\"http://www.google.com\"$$$$\\<c-y>/$$$$\n | hello",
'result': "/a href=\"http://www.google.com\"\n | hello",
},
{
'query': "/a href=\"http://www.google.com\"$$$$\\<c-y>/$$$$\n | hello",
'result': "a href=\"http://www.google.com\"\n | hello",
},
],
},
],
},
{
'type': 'xsl',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "vari",
'result': "<xsl:variable name=\"\"></xsl:variable>\n",
},
{
'query': "ap>wp",
'result': "<xsl:apply-templates select=\"\" mode=\"\">\n\t<xsl:with-param name=\"\" select=\"\"></xsl:with-param>\n</xsl:apply-templates>\n",
},
],
},
],
},
{
'type': 'xsd',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "xsd:w3c",
'result': "<?xml version=\"1.0\"?>\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n\t<xsd:element name=\"\" type=\"\"/>\n</xsd:schema>",
},
],
},
],
},
{
'type': 'mustache',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div#{{foo}}",
'result': "<div id=\"{{foo}}\"></div>\n",
},
{
'query': "div.{{foo}}",
'result': "<div class=\"{{foo}}\"></div>\n",
},
],
},
],
},
]
" vim:set et:

View file

@ -1,265 +0,0 @@
script_name: ZenCoding.vim
script_id: '2981'
script_type: utility
script_package: zencoding-vim.zip
script_version: '0.80'
required_vim_version: '7.0'
summary: vim plugins for HTML and CSS hi-speed coding.
detailed_description: |
This is vim script support expanding abbreviation like zen-coding.
ref: http://code.google.com/p/zen-coding/
There is a movie using zencoding.vim
ref: http://mattn.github.com/zencoding-vim
Source Repository.
ref: http://github.com/mattn/zencoding-vim
Type abbreviation
+-------------------------------------
| html:5_
+-------------------------------------
"_" is a cursor position. and type "<c-y>," (Ctrl + y and Comma)
NOTE: Don't worry about key map. you can change it easily.
+-------------------------------------
| <!DOCTYPE HTML>
| <html lang="en">
| <head>
| <title></title>
| <meta charset="UTF-8">
| </head>
| <body>
| _
| </body>
| </html>
+-------------------------------------
Type following
+-------------------------------------
| div#foo$*2>div.bar
+-------------------------------------
And type "<c-y>,"
+-------------------------------------
|<div id="foo1">
| <div class="bar">_</div>
|</div>
|<div id="foo2">
| <div class="bar"></div>
|</div>
| _
+-------------------------------------
Tutorial:
http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL
How work this:
http://mattn.github.com/zencoding-vim
Tips:
You can customize behavior of expanding with overriding config.
This configuration will be marged at loading plugin.
let g:user_zen_settings = {
\ 'indentation' : ' ',
\ 'perl' : {
\ 'aliases' : {
\ 'req' : 'require '
\ },
\ 'snippets' : {
\ 'use' : "use strict\nuse warnings\n\n",
\ 'warn' : "warn \"|\";",
\ }
\ }
\}
let g:user_zen_expandabbr_key = '<c-e>'
let g:use_zen_complete_tag = 1
You can set language attribute in html using zen_settings['lang'].
install_details: |
# cd ~/.vim
# unzip zencoding-vim.zip
or if you install pathogen.vim:
# cd ~/.vim/bundle # or make directory
# unzip /path/to/zencoding-vim.zip
if you get sources from repository:
# cd ~/.vim/bundle # or make directory
# git clone http://github.com/mattn/zencoding-vim.git
versions:
- '0.80': |
This is an upgrade for ZenCoding.vim: add emmet features.
- '0.74': |
This is an upgrade for ZenCoding.vim: many bug fixes.
- '0.73': |
This is an upgrade for ZenCoding.vim: many bug fixes. and support slim format (experimental).
- '0.72': |
This is an upgrade for ZenCoding.vim:
[fix] fix finding tokens.
- '0.71': |
This is an upgrade for ZenCoding.vim:
[fix] fix finding begin of tokens.
- '0.70': |
This is an upgrade for ZenCoding.vim:
[mod] Changed behavior of expanding. "div div>a|" should keep first div element.
[add] Supported slim formatter.
- '0.60': |
This is an upgrade for ZenCoding.vim:
[fix] fixed expanding {{}}.
- '0.59': |
This is an upgrade for ZenCoding.vim:
[fix] fixed toggleComment and mny bugs.
- '0.58': |
This is an upgrade for ZenCoding.vim:
[fix] fixed 'foo+' style expandos.
- '0.57': |
This is an upgrade for ZenCoding.vim:
[fix] fixed expandos that don't work 'choose' in xsl.
- '0.56': |
This is an upgrade for ZenCoding.vim:
[fix] fixed contents parser.
- '0.55': |
uploaded again: sorry, files was old.
- '0.54': |
[add] support sass, xsd.
[fix] expanding with html tag.
uploaded again: sorry, fileformat was DOS.
- '0.53': |
[fix] gif width/height was swapped.
- '0.52': |
[fix] broken wrap expanding.
- '0.51': |
This is an upgrade for ZenCoding.vim:
[fix] wrap expanding with '&'.
[fix] expand .content to class="content".
[fix] haml expanding.
[fix] bg+ snippet
- '0.50': |
This is an upgrade for ZenCoding.vim:
[fix] fixed parsing '#{{foo}}' and '.{{bar}}'.
- '0.49': |
This is an upgrade for ZenCoding.vim:
[doc] add help manual.
- '0.48': |
This is an upgrade for ZenCoding.vim:
[fix] install mappings to global.
- '0.47': |
This is an upgrade for ZenCoding.vim:
[drastic changes] enable autoload. you should whole replace older files.
package was empty. upload again.
- '0.46': |
This is an upgrade for ZenCoding.vim:
[drastic changes] enable autoload. you should whole replace older files.
- '0.45': |
This is an upgrade for ZenCoding.vim:
fixed attribute parsing like: a[href="hello', world" rel].
- '0.44': |
This is an upgrade for ZenCoding.vim:
fixed checking whether have mapping using maparg() / hasmapto().
- '0.43': |
This is an upgrade for ZenCoding.vim:
fixed behavior for nested block. like "html:5>#page>(header#globalHeader>(hgroup>h1+h2)+(nav>ul>li*3>a)+(form>p.siteSearch>input+input[type=button]))+(#contents>(#main>(section>h2+p*5)+p.pagetop>a[href=#page])+(#sub>p+(nav>ul>li>a)))+(footer#globalFoooter>(ul>li>a)+(p.copyright>small))"
- '0.42': |
This is an upgrade for ZenCoding.vim:
fixed select/option indent.
- '0.41': |
This is an upgrade for ZenCoding.vim:
fixed default filter. when using 'e' filter, output become empty.
- '0.40': |
This is an upgrade for ZenCoding.vim:
add the pure vimscript code for 'get image size'. you can use it without perl interface just now.
change key assign of ZenCodingExpandWord from ',' to ';'. it don't effect to most users.
- '0.39': |
This is an upgrade for ZenCoding.vim: fixed problem about 'selection'. see http://github.com/mattn/zencoding-vim/issues/#issue/2
- '0.38': |
This is an upgrade for ZenCoding.vim: use v7h"_s instead of v7hs for backspace.
- '0.37': |
This is an upgrade for ZenCoding.vim: fixed problem that won't working with some 'backspace' options.
- '0.36': |
This is an upgrade for ZenCoding.vim: fixed problem that filter does not work.
- '0.35': |
This is an upgrade for ZenCoding.vim: enable zencoding for other languages. (meaning php also)
- '0.34': |
This is an upgrade for ZenCoding.vim: enable zencoding for xsl. (you should add ~/.vim/ftplugin/xslt/zencoding.vim)
- '0.33': |
This is an upgrade for ZenCoding.vim: fixed problem breaking multibyte when cursor is in a part of line. enabled zencoding for javascript in html.
- '0.32': |
This is an upgrade for ZenCoding.vim: fixed indentation. supported extends so that you can enable zencoding for php/xhtml/haml other's section 14 in http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL
- '0.31': |
This is an upgrade for ZenCoding.vim: fixed indentation and $$$ problem. fixed about missing support multiple classes.
- '0.30': |
This is an upgrade for ZenCoding.vim: Fixed key assign.
- '0.29': |
This is an upgrade for ZenCoding.vim: Changed leading key to '<c-y>' from '<c-z>'.
- '0.28': |
This is an upgrade for ZenCoding.vim: supported 'Balance Tag Inward/Outward', 'Go to Next/Previous Edit Point', 'Update <img> Size', 'Remove Tag', 'Split/Join Tag', 'Toggle Comment'
- '0.27': |
This is an upgrade for ZenCoding.vim: fixed problem that can't work on the part of multibyte characters. fixed inline elements behavior.
- '0.26': |
This is an upgrade for ZenCoding.vim: The count of '(((a#foo + a#bar)*2)*3)' should be 12.
- '0.25': |
This is an upgrade for ZenCoding.vim: store undo before working. good luck about 'table>(tr>td*3)*4'.
- '0.24': |
This is an upgrade for ZenCoding.vim: fixed behavior of parsing area of visual selection.
- '0.23': |
This is an upgrade for ZenCoding.vim: pre-expand '#header>li<#content' to 'div#header>li<div#content'. support () expression.
- '0.22': |
This is an upgrade for ZenCoding.vim: expand 'ul+' to 'ul>li'. fix undo ring. support visual selection. when type trigger key on visual select, it request you leader like 'ul>li'. if you give 'ul>li*' as leader, you'll get each separate 'ul>li' tags. and when you give 'blockquote' as leader, you'll get blocked text.
- '0.21': |
This is an upgrade for ZenCoding.vim: treat xhtml as html.
- '0.20': |
This is an upgrade for ZenCoding.vim: add option use_zen_complete_tag for complete abbr.
- '0.19': |
This is an upgrade for ZenCoding.vim: fixed problem that couldn't expand 'link:css' correctly.
- '0.18': |
This is an upgrade for ZenCoding.vim: ignore duplicate key map.
- '0.17': |
This is an upgrade for ZenCoding.vim: fixed key map.
- '0.16': |
This is an upgrade for ZenCoding.vim: fixed problem 'endless loop'.
- '0.15': |
This is an upgrade for ZenCoding.vim: set default filetype to 'html'.
- '0.14': |
This is an upgrade for ZenCoding.vim: fixed tag name like 'fs:n' in 'css'.
- '0.14': |
This is an upgrade for ZenCoding.vim: indentation for each languages.
- '0.13': |
This is an upgrade for ZenCoding.vim: user key map.
- '0.12': |
This is an upgrade for ZenCoding.vim: few extensive notation.
- '0.11': |
This is an upgrade for ZenCoding.vim: fixed indent.
- '0.10': |
This is an upgrade for ZenCoding.vim: fixed behavior of '+' operator
- '0.9': |
This is an upgrade for ZenCoding.vim: fixed single line behavior
- '0.8': |
This is an upgrade for ZenCoding.vim: support 'a[href=http://www.google.com]{Google}'
- '0.7': |
This is an upgrade for ZenCoding.vim: fixed behavior in 'a+b'.
- '0.6': |
This is an upgrade for ZenCoding.vim: fixed strange behavior about '<a href="">b_</a>'.
- '0.5': |
This is an upgrade for ZenCoding.vim: recover rest part in line.
- '0.4': |
This is an upgrade for ZenCoding.vim: fixed cursor position. fixed ${lang} replacement.
- '0.3': |
This is an upgrade for ZenCoding.vim: fixed line expanding.
- '0.2': |
This is an upgrade for ZenCoding.vim: fixed problem that moving cursor with expanding.
- '0.1': |
Initial upload
# __END__
# vim: filetype=yaml

View file

@ -1,154 +0,0 @@
function! ack#Ack(cmd, args)
redraw
echo "Searching ..."
" If no pattern is provided, search for the word under the cursor
if empty(a:args)
let l:grepargs = expand("<cword>")
else
let l:grepargs = a:args . join(a:000, ' ')
end
echom l:grepargs
let l:ackprg_run = g:ackprg
" Format, used to manage column jump
if a:cmd =~# '-g$'
let g:ackformat="%f"
let l:ackprg_run = substitute(l:ackprg_run, '-H\|--column', '', 'g')
else
let g:ackformat="%f:%l:%c:%m,%f:%l:%m"
endif
let grepprg_bak = &grepprg
let grepformat_bak = &grepformat
let &grepprg=l:ackprg_run
let &grepformat=g:ackformat
try
" NOTE: we escape special chars, but not everything using shellescape to
" allow for passing arguments etc
if g:ack_use_dispatch
let &l:errorformat = g:ackformat
let &l:makeprg=g:ackprg." " . escape(l:grepargs, '|#%')
Make
else
silent execute a:cmd . " " . escape(l:grepargs, '|#%')
endif
finally
let &grepprg=grepprg_bak
let &grepformat=grepformat_bak
endtry
if a:cmd =~# '^l'
let s:handler = g:ack_lhandler
let s:apply_mappings = g:ack_apply_lmappings
let s:close_cmd = ':lclose<CR>'
else
let s:handler = g:ack_qhandler
let s:apply_mappings = g:ack_apply_qmappings
let s:close_cmd = ':cclose<CR>'
endif
if !g:ack_use_dispatch
call ack#show_results()
else
copen
endif
call <SID>apply_maps()
call <SID>highlight(l:grepargs)
redraw!
endfunction
function! ack#show_results()
execute s:handler
endfunction
function! s:apply_maps()
let g:ack_mappings.q = s:close_cmd
execute "nnoremap <buffer> <silent> ? :call ack#quick_help()<CR>"
if s:apply_mappings && &ft == "qf"
if g:ack_autoclose
for key_map in items(g:ack_mappings)
execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1) . s:close_cmd)
endfor
execute "nnoremap <buffer> <silent> <CR> <CR>" . s:close_cmd
else
for key_map in items(g:ack_mappings)
execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1))
endfor
endif
if exists("g:ackpreview") " if auto preview in on, remap j and k keys
execute "nnoremap <buffer> <silent> j j<CR><C-W><C-W>"
execute "nnoremap <buffer> <silent> k k<CR><C-W><C-W>"
endif
endif
endfunction
function! ack#quick_help()
execute "edit " . globpath(&rtp, "doc/ack_quick_help.txt")
silent normal gg
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
setlocal nobuflisted
setlocal nomodifiable
setlocal filetype=help
setlocal nonumber
setlocal norelativenumber
setlocal nowrap
setlocal foldlevel=20
setlocal foldmethod=diff
nnoremap <buffer> <silent> ? :q!<CR>:call ack#show_results()<CR>
endfunction
function! s:highlight(args)
if !g:ackhighlight
return
endif
let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]")
call feedkeys(":let &l:hlsearch=1 \| echo \<CR>", "n")
endfunction
function! ack#AckFromSearch(cmd, args)
let search = getreg('/')
" translate vim regular expression to perl regular expression.
let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g')
call ack#Ack(a:cmd, '"' . search . '" ' . a:args)
endfunction
function! s:GetDocLocations()
let dp = ''
for p in split(&rtp, ',')
let p = p . '/doc/'
if isdirectory(p)
let dp = p . '*.txt ' . dp
endif
endfor
return dp
endfunction
function! ack#AckHelp(cmd, args)
let args = a:args . ' ' . s:GetDocLocations()
call ack#Ack(a:cmd, args)
endfunction
function! ack#AckWindow(cmd, args)
let files = tabpagebuflist()
" remove duplicated filenames (files appearing in more than one window)
let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1')
call map(files, "bufname(v:val)")
" remove unnamed buffers as quickfix (empty strings before shellescape)
call filter(files, 'v:val != ""')
" expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre)
let files = map(files, "shellescape(fnamemodify(v:val, ':p'))")
let args = a:args . ' ' . join(files)
call ack#Ack(a:cmd, args)
endfunction

View file

@ -1,14 +0,0 @@
==== ack.vim quick help ===============
*?:* Show this help
*t:* Open in a new tab
*T:* Open in a new tab silently
*o:* Open
*O:* Open and close result window
*go:* Preview
*h:* Horizontal open
*H:* Horizontal open silently
*v:* Vertical open
*gv:* Vertical open silently
========================================

View file

@ -1,9 +0,0 @@
if exists("g:ack_autofold_results") && g:ack_autofold_results
setlocal foldlevel=0
setlocal foldmethod=expr
setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1'
setlocal foldenable
setlocal foldclose=all
setlocal foldopen=all
nnoremap <buffer> j jzz
endif

View file

@ -1,644 +0,0 @@
if exists("g:loaded_nerdtree_ui_glue_autoload")
finish
endif
let g:loaded_nerdtree_ui_glue_autoload = 1
" FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1
function! nerdtree#ui_glue#createDefaultBindings()
let s = '<SNR>' . s:SID() . '_'
call NERDTreeAddKeyMap({ 'key': '<MiddleRelease>', 'scope': "all", 'callback': s."handleMiddleMouse" })
call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', 'scope': "all", 'callback': s."handleLeftClick" })
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" })
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" })
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" })
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Bookmark", 'callback': s."openHSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Bookmark", 'callback': s."openVSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Bookmark", 'callback': s."previewNodeCurrent" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Bookmark", 'callback': s."previewNodeVSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Bookmark", 'callback': s."previewNodeHSplit" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': "all", 'callback': s."upDirCurrentRootClosed" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': "all", 'callback': s."upDirCurrentRootOpen" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': "Node", 'callback': s."chRoot" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#ui_glue#chRootCwd" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Node", 'callback': s."openInNewTab" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Node", 'callback': s."openInNewTabSilent" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Bookmark", 'callback': s."openInNewTab" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Bookmark", 'callback': s."openInNewTabSilent" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" })
endfunction
"SECTION: Interface bindings {{{1
"============================================================
"FUNCTION: s:activateAll() {{{1
"handle the user activating the updir line
function! s:activateAll()
if getline(".") ==# nerdtree#treeUpDirLine()
return nerdtree#ui_glue#upDir(0)
endif
endfunction
"FUNCTION: s:activateDirNode() {{{1
"handle the user activating a tree node
function! s:activateDirNode(node)
call a:node.activate({'reuse': 1})
endfunction
"FUNCTION: s:activateFileNode() {{{1
"handle the user activating a tree node
function! s:activateFileNode(node)
call a:node.activate({'reuse': 1, 'where': 'p'})
endfunction
"FUNCTION: s:activateBookmark() {{{1
"handle the user activating a bookmark
function! s:activateBookmark(bm)
call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {})
endfunction
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
" Associate the current node with the given name
function! nerdtree#ui_glue#bookmarkNode(...)
let currentNode = g:NERDTreeFileNode.GetSelected()
if currentNode != {}
let name = a:1
if empty(name)
let name = currentNode.path.getLastPathComponent(0)
endif
try
call currentNode.bookmark(name)
call b:NERDTree.render()
catch /^NERDTree.IllegalBookmarkNameError/
call nerdtree#echo("bookmark names must not contain spaces")
endtry
else
call nerdtree#echo("select a node first")
endif
endfunction
" FUNCTION: s:chCwd(node) {{{1
function! s:chCwd(node)
try
call a:node.path.changeToDir()
catch /^NERDTree.PathChangeError/
call nerdtree#echoWarning("could not change cwd")
endtry
endfunction
" FUNCTION: s:chRoot(node) {{{1
" changes the current root to the selected one
function! s:chRoot(node)
call a:node.makeRoot()
call b:NERDTree.render()
call b:NERDTreeRoot.putCursorHere(0, 0)
endfunction
" FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1
" changes the current root to CWD
function! nerdtree#ui_glue#chRootCwd()
try
let cwd = g:NERDTreePath.New(getcwd())
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("current directory does not exist.")
return
endtry
if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str()
return
endif
call s:chRoot(g:NERDTreeDirNode.New(cwd))
endfunction
" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1
function! nerdtree#ui_glue#clearBookmarks(bookmarks)
if a:bookmarks ==# ''
let currentNode = g:NERDTreeFileNode.GetSelected()
if currentNode != {}
call currentNode.clearBookmarks()
endif
else
for name in split(a:bookmarks, ' ')
let bookmark = g:NERDTreeBookmark.BookmarkFor(name)
call bookmark.delete()
endfor
endif
call b:NERDTree.render()
endfunction
" FUNCTION: s:closeChildren(node) {{{1
" closes all childnodes of the current node
function! s:closeChildren(node)
call a:node.closeChildren()
call b:NERDTree.render()
call a:node.putCursorHere(0, 0)
endfunction
" FUNCTION: s:closeCurrentDir(node) {{{1
" closes the parent dir of the current node
function! s:closeCurrentDir(node)
let parent = a:node.parent
if parent ==# {} || parent.isRoot()
call nerdtree#echo("cannot close tree root")
else
while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot()
if parent.parent.getVisibleChildCount() == 1
call parent.close()
let parent = parent.parent
else
break
endif
endwhile
call parent.close()
call b:NERDTree.render()
call parent.putCursorHere(0, 0)
endif
endfunction
" FUNCTION: s:closeTreeWindow() {{{1
" close the tree window
function! s:closeTreeWindow()
if b:NERDTreeType ==# "secondary" && b:NERDTreePreviousBuf != -1
exec "buffer " . b:NERDTreePreviousBuf
else
if winnr("$") > 1
call nerdtree#closeTree()
else
call nerdtree#echo("Cannot close last window")
endif
endif
endfunction
" FUNCTION: s:deleteBookmark(bm) {{{1
" if the cursor is on a bookmark, prompt to delete
function! s:deleteBookmark(bm)
echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):"
if nr2char(getchar()) ==# 'y'
try
call a:bm.delete()
call b:NERDTree.render()
redraw
catch /^NERDTree/
call nerdtree#echoWarning("Could not remove bookmark")
endtry
else
call nerdtree#echo("delete aborted" )
endif
endfunction
" FUNCTION: s:displayHelp() {{{1
" toggles the help display
function! s:displayHelp()
let b:treeShowHelp = b:treeShowHelp ? 0 : 1
call b:NERDTree.render()
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:findAndRevealPath() {{{1
function! s:findAndRevealPath()
try
let p = g:NERDTreePath.New(expand("%:p"))
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("no file for the current buffer")
return
endtry
if p.isUnixHiddenPath()
let showhidden=g:NERDTreeShowHidden
let g:NERDTreeShowHidden = 1
endif
if !g:NERDTree.ExistsForTab()
try
let cwd = g:NERDTreePath.New(getcwd())
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("current directory does not exist.")
let cwd = p.getParent()
endtry
if p.isUnder(cwd)
call g:NERDTreeCreator.CreatePrimary(cwd.str())
else
call g:NERDTreeCreator.CreatePrimary(p.getParent().str())
endif
else
if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path)
if !nerdtree#isTreeOpen()
call g:NERDTreeCreator.TogglePrimary('')
else
call nerdtree#putCursorInTreeWin()
endif
let b:NERDTreeShowHidden = g:NERDTreeShowHidden
call s:chRoot(g:NERDTreeDirNode.New(p.getParent()))
else
if !nerdtree#isTreeOpen()
call g:NERDTreeCreator.TogglePrimary("")
endif
endif
endif
call nerdtree#putCursorInTreeWin()
call b:NERDTreeRoot.reveal(p)
if p.isUnixHiddenFile()
let g:NERDTreeShowHidden = showhidden
endif
endfunction
"FUNCTION: s:handleLeftClick() {{{1
"Checks if the click should open the current node
function! s:handleLeftClick()
let currentNode = g:NERDTreeFileNode.GetSelected()
if currentNode != {}
"the dir arrows are multibyte chars, and vim's string functions only
"deal with single bytes - so split the line up with the hack below and
"take the line substring manually
let line = split(getline(line(".")), '\zs')
let startToCur = ""
for i in range(0,len(line)-1)
let startToCur .= line[i]
endfor
if currentNode.path.isDirectory
if startToCur =~# nerdtree#treeMarkupReg() && startToCur =~# '[+~▾▸] \?$'
call currentNode.activate()
return
endif
endif
if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
let char = strpart(startToCur, strlen(startToCur)-1, 1)
if char !~# nerdtree#treeMarkupReg()
if currentNode.path.isDirectory
call currentNode.activate()
else
call currentNode.activate({'reuse': 1, 'where': 'p'})
endif
return
endif
endif
endif
endfunction
" FUNCTION: s:handleMiddleMouse() {{{1
function! s:handleMiddleMouse()
let curNode = g:NERDTreeFileNode.GetSelected()
if curNode ==# {}
call nerdtree#echo("Put the cursor on a node first" )
return
endif
if curNode.path.isDirectory
call nerdtree#openExplorer(curNode)
else
call curNode.open({'where': 'h'})
endif
endfunction
" FUNCTION: s:jumpToChild(direction) {{{2
" Args:
" direction: 0 if going to first child, 1 if going to last
function! s:jumpToChild(currentNode, direction)
if a:currentNode.isRoot()
return nerdtree#echo("cannot jump to " . (a:direction ? "last" : "first") . " child")
end
let dirNode = a:currentNode.parent
let childNodes = dirNode.getVisibleChildren()
let targetNode = childNodes[0]
if a:direction
let targetNode = childNodes[len(childNodes) - 1]
endif
if targetNode.equals(a:currentNode)
let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction)
if siblingDir != {}
let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0
let targetNode = siblingDir.getChildByIndex(indx, 1)
endif
endif
call targetNode.putCursorHere(1, 0)
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1
"this is needed since I cant figure out how to invoke dict functions from a
"key map
function! nerdtree#ui_glue#invokeKeyMap(key)
call g:NERDTreeKeyMap.Invoke(a:key)
endfunction
" FUNCTION: s:jumpToFirstChild() {{{1
" wrapper for the jump to child method
function! s:jumpToFirstChild(node)
call s:jumpToChild(a:node, 0)
endfunction
" FUNCTION: s:jumpToLastChild() {{{1
" wrapper for the jump to child method
function! s:jumpToLastChild(node)
call s:jumpToChild(a:node, 1)
endfunction
" FUNCTION: s:jumpToParent(node) {{{1
" moves the cursor to the parent of the current node
function! s:jumpToParent(node)
if !empty(a:node.parent)
call a:node.parent.putCursorHere(1, 0)
call b:NERDTree.ui.centerView()
else
call nerdtree#echo("cannot jump to parent")
endif
endfunction
" FUNCTION: s:jumpToRoot() {{{1
" moves the cursor to the root node
function! s:jumpToRoot()
call b:NERDTreeRoot.putCursorHere(1, 0)
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:jumpToNextSibling(node) {{{1
function! s:jumpToNextSibling(node)
call s:jumpToSibling(a:node, 1)
endfunction
" FUNCTION: s:jumpToPrevSibling(node) {{{1
function! s:jumpToPrevSibling(node)
call s:jumpToSibling(a:node, 0)
endfunction
" FUNCTION: s:jumpToSibling(currentNode, forward) {{{2
" moves the cursor to the sibling of the current node in the given direction
"
" Args:
" forward: 1 if the cursor should move to the next sibling, 0 if it should
" move back to the previous sibling
function! s:jumpToSibling(currentNode, forward)
let sibling = a:currentNode.findSibling(a:forward)
if !empty(sibling)
call sibling.putCursorHere(1, 0)
call b:NERDTree.ui.centerView()
endif
endfunction
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
" put the cursor on the given bookmark and, if its a file, open it
function! nerdtree#ui_glue#openBookmark(name)
try
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0)
call targetNode.putCursorHere(0, 1)
redraw!
catch /^NERDTree.BookmarkedNodeNotFoundError/
call nerdtree#echo("note - target node is not cached")
let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
let targetNode = g:NERDTreeFileNode.New(bookmark.path)
endtry
if targetNode.path.isDirectory
call targetNode.openExplorer()
else
call targetNode.open({'where': 'p'})
endif
endfunction
" FUNCTION: s:openHSplit(target) {{{1
function! s:openHSplit(target)
call a:target.activate({'where': 'h'})
endfunction
" FUNCTION: s:openVSplit(target) {{{1
function! s:openVSplit(target)
call a:target.activate({'where': 'v'})
endfunction
" FUNCTION: s:openExplorer(node) {{{1
function! s:openExplorer(node)
call a:node.openExplorer()
endfunction
" FUNCTION: s:openInNewTab(target) {{{1
function! s:openInNewTab(target)
call a:target.activate({'where': 't'})
endfunction
" FUNCTION: s:openInNewTabSilent(target) {{{1
function! s:openInNewTabSilent(target)
call a:target.activate({'where': 't', 'stay': 1})
endfunction
" FUNCTION: s:openNodeRecursively(node) {{{1
function! s:openNodeRecursively(node)
call nerdtree#echo("Recursively opening node. Please wait...")
call a:node.openRecursively()
call b:NERDTree.render()
redraw
call nerdtree#echo("Recursively opening node. Please wait... DONE")
endfunction
"FUNCTION: s:previewNodeCurrent(node) {{{1
function! s:previewNodeCurrent(node)
call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1})
endfunction
"FUNCTION: s:previewNodeHSplit(node) {{{1
function! s:previewNodeHSplit(node)
call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1})
endfunction
"FUNCTION: s:previewNodeVSplit(node) {{{1
function! s:previewNodeVSplit(node)
call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1})
endfunction
" FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1
" put the cursor on the node associate with the given name
function! nerdtree#ui_glue#revealBookmark(name)
try
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0)
call targetNode.putCursorHere(0, 1)
catch /^NERDTree.BookmarkNotFoundError/
call nerdtree#echo("Bookmark isnt cached under the current root")
endtry
endfunction
" FUNCTION: s:refreshRoot() {{{1
" Reloads the current root. All nodes below this will be lost and the root dir
" will be reloaded.
function! s:refreshRoot()
call nerdtree#echo("Refreshing the root node. This could take a while...")
call b:NERDTreeRoot.refresh()
call b:NERDTree.render()
redraw
call nerdtree#echo("Refreshing the root node. This could take a while... DONE")
endfunction
" FUNCTION: s:refreshCurrent(node) {{{1
" refreshes the root for the current node
function! s:refreshCurrent(node)
let node = a:node
if !node.path.isDirectory
let node = node.parent
endif
call nerdtree#echo("Refreshing node. This could take a while...")
call node.refresh()
call b:NERDTree.render()
redraw
call nerdtree#echo("Refreshing node. This could take a while... DONE")
endfunction
" FUNCTION: nerdtree#ui_glue#setupCommands() {{{1
function! nerdtree#ui_glue#setupCommands()
command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreatePrimary('<args>')
command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.TogglePrimary('<args>')
command! -n=0 -bar NERDTreeClose :call nerdtree#closeTreeIfOpen()
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreatePrimary('<args>')
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
command! -n=0 -bar NERDTreeFind call s:findAndRevealPath()
command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
endfunction
" Function: s:SID() {{{1
function s:SID()
if !exists("s:sid")
let s:sid = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
endif
return s:sid
endfun
" FUNCTION: s:showMenu(node) {{{1
function! s:showMenu(node)
let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled())
call mc.showMenu()
endfunction
" FUNCTION: s:toggleIgnoreFilter() {{{1
function! s:toggleIgnoreFilter()
call b:NERDTree.ui.toggleIgnoreFilter()
endfunction
" FUNCTION: s:toggleShowBookmarks() {{{1
function! s:toggleShowBookmarks()
call b:NERDTree.ui.toggleShowBookmarks()
endfunction
" FUNCTION: s:toggleShowFiles() {{{1
function! s:toggleShowFiles()
call b:NERDTree.ui.toggleShowFiles()
endfunction
" FUNCTION: s:toggleShowHidden() {{{1
" toggles the display of hidden files
function! s:toggleShowHidden()
call b:NERDTree.ui.toggleShowHidden()
endfunction
" FUNCTION: s:toggleZoom() {{{1
function! s:toggleZoom()
call b:NERDTree.ui.toggleZoom()
endfunction
"FUNCTION: nerdtree#ui_glue#upDir(keepState) {{{1
"moves the tree up a level
"
"Args:
"keepState: 1 if the current root should be left open when the tree is
"re-rendered
function! nerdtree#ui_glue#upDir(keepState)
let cwd = b:NERDTreeRoot.path.str({'format': 'UI'})
if cwd ==# "/" || cwd =~# '^[^/]..$'
call nerdtree#echo("already at top dir")
else
if !a:keepState
call b:NERDTreeRoot.close()
endif
let oldRoot = b:NERDTreeRoot
if empty(b:NERDTreeRoot.parent)
let path = b:NERDTreeRoot.path.getParent()
let newRoot = g:NERDTreeDirNode.New(path)
call newRoot.open()
call newRoot.transplantChild(b:NERDTreeRoot)
let b:NERDTreeRoot = newRoot
else
let b:NERDTreeRoot = b:NERDTreeRoot.parent
endif
if g:NERDTreeChDirMode ==# 2
call b:NERDTreeRoot.path.changeToDir()
endif
call b:NERDTree.render()
call oldRoot.putCursorHere(0, 0)
endif
endfunction
" FUNCTION: s:upDirCurrentRootOpen() {{{1
function! s:upDirCurrentRootOpen()
call nerdtree#ui_glue#upDir(1)
endfunction
" FUNCTION: s:upDirCurrentRootClosed() {{{1
function! s:upDirCurrentRootClosed()
call nerdtree#ui_glue#upDir(0)
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -1,13 +0,0 @@
"CLASS: Event
"============================================================
let s:Event = {}
let g:NERDTreeEvent = s:Event
function! s:Event.New(nerdtree, subject, action, params) abort
let newObj = copy(self)
let newObj.nerdtree = a:nerdtree
let newObj.subject = a:subject
let newObj.action = a:action
let newObj.params = a:params
return newObj
endfunction

View file

@ -1,56 +0,0 @@
"CLASS: FlagSet
"============================================================
let s:FlagSet = {}
let g:NERDTreeFlagSet = s:FlagSet
"FUNCTION: FlagSet.addFlag(scope, flag) {{{1
function! s:FlagSet.addFlag(scope, flag)
let flags = self._flagsForScope(a:scope)
if index(flags, a:flag) == -1
call add(flags, a:flag)
end
endfunction
"FUNCTION: FlagSet.clearFlags(scope) {{{1
function! s:FlagSet.clearFlags(scope)
let self._flags[a:scope] = []
endfunction
"FUNCTION: FlagSet._flagsForScope(scope) {{{1
function! s:FlagSet._flagsForScope(scope)
if !has_key(self._flags, a:scope)
let self._flags[a:scope] = []
endif
return self._flags[a:scope]
endfunction
"FUNCTION: FlagSet.New() {{{1
function! s:FlagSet.New()
let newObj = copy(self)
let newObj._flags = {}
return newObj
endfunction
"FUNCTION: FlagSet.removeFlag(scope, flag) {{{1
function! s:FlagSet.removeFlag(scope, flag)
let flags = self._flagsForScope(a:scope)
let i = index(flags, a:flag)
if i >= 0
call remove(flags, i)
endif
endfunction
"FUNCTION: FlagSet.renderToString() {{{1
function! s:FlagSet.renderToString()
let flagstring = ""
for i in values(self._flags)
let flagstring .= join(i)
endfor
if len(flagstring) == 0
return ""
endif
return '[' . flagstring . ']'
endfunction

View file

@ -1,39 +0,0 @@
"CLASS: NERDTree
"============================================================
let s:NERDTree = {}
let g:NERDTree = s:NERDTree
" Function: s:NERDTree.ExistsForBuffer() {{{1
" Returns 1 if a nerd tree root exists in the current buffer
function! s:NERDTree.ExistsForBuf()
return exists("b:NERDTreeRoot")
endfunction
" Function: s:NERDTree.ExistsForTab() {{{1
" Returns 1 if a nerd tree root exists in the current tab
function! s:NERDTree.ExistsForTab()
return exists("t:NERDTreeBufName")
endfunction
function! s:NERDTree.ForCurrentBuf()
if s:NERDTree.ExistsForBuf()
return b:NERDTree
else
return {}
endif
endfunction
function! s:NERDTree.New(path)
let newObj = copy(self)
let newObj.ui = g:NERDTreeUI.New(newObj)
let newObj.root = g:NERDTreeDirNode.New(a:path)
return newObj
endfunction
"FUNCTION: s:NERDTree.render() {{{1
"A convenience function - since this is called often
function! s:NERDTree.render()
call self.ui.render()
endfunction

View file

@ -1,35 +0,0 @@
"CLASS: Notifier
"============================================================
let s:Notifier = {}
function! s:Notifier.AddListener(event, funcname)
let listeners = s:Notifier.GetListenersForEvent(a:event)
if listeners == []
let listenersMap = s:Notifier.GetListenersMap()
let listenersMap[a:event] = listeners
endif
call add(listeners, a:funcname)
endfunction
function! s:Notifier.NotifyListeners(event, path, params)
let event = g:NERDTreeEvent.New(b:NERDTree, a:path, a:event, a:params)
for listener in s:Notifier.GetListenersForEvent(a:event)
call {listener}(event)
endfor
endfunction
function! s:Notifier.GetListenersMap()
if !exists("s:refreshListenersMap")
let s:refreshListenersMap = {}
endif
return s:refreshListenersMap
endfunction
function! s:Notifier.GetListenersForEvent(name)
let listenersMap = s:Notifier.GetListenersMap()
return get(listenersMap, a:name, [])
endfunction
let g:NERDTreePathNotifier = deepcopy(s:Notifier)

View file

@ -1,332 +0,0 @@
"CLASS: UI
"============================================================
let s:UI = {}
let g:NERDTreeUI = s:UI
function! s:UI.lolcats()
echomsg "lolcats"
endfunction
"FUNCTION: s:UI.centerView() {{{2
"centers the nerd tree window around the cursor (provided the nerd tree
"options permit)
function! s:UI.centerView()
if g:NERDTreeAutoCenter
let current_line = winline()
let lines_to_top = current_line
let lines_to_bottom = winheight(nerdtree#getTreeWinNum()) - current_line
if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold
normal! zz
endif
endif
endfunction
"FUNCTION: s:UI.new(nerdtree) {{{1
function! s:UI.New(nerdtree)
let newObj = copy(self)
let newObj.nerdtree = a:nerdtree
return newObj
endfunction
"FUNCTION: s:UI.getPath(ln) {{{1
"Gets the full path to the node that is rendered on the given line number
"
"Args:
"ln: the line number to get the path for
"
"Return:
"A path if a node was selected, {} if nothing is selected.
"If the 'up a dir' line was selected then the path to the parent of the
"current root is returned
function! s:UI.getPath(ln)
let line = getline(a:ln)
let rootLine = self.getRootLineNum()
"check to see if we have the root node
if a:ln == rootLine
return b:NERDTreeRoot.path
endif
if !g:NERDTreeDirArrows
" in case called from outside the tree
if line !~# '^ *[|`▸▾ ]' || line =~# '^$'
return {}
endif
endif
if line ==# nerdtree#treeUpDirLine()
return b:NERDTreeRoot.path.getParent()
endif
let indent = self._indentLevelFor(line)
"remove the tree parts and the leading space
let curFile = nerdtree#stripMarkupFromLine(line, 0)
let wasdir = 0
if curFile =~# '/$'
let wasdir = 1
let curFile = substitute(curFile, '/\?$', '/', "")
endif
let dir = ""
let lnum = a:ln
while lnum > 0
let lnum = lnum - 1
let curLine = getline(lnum)
let curLineStripped = nerdtree#stripMarkupFromLine(curLine, 1)
"have we reached the top of the tree?
if lnum == rootLine
let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir
break
endif
if curLineStripped =~# '/$'
let lpindent = self._indentLevelFor(curLine)
if lpindent < indent
let indent = indent - 1
let dir = substitute (curLineStripped,'^\\', "", "") . dir
continue
endif
endif
endwhile
let curFile = b:NERDTreeRoot.path.drive . dir . curFile
let toReturn = g:NERDTreePath.New(curFile)
return toReturn
endfunction
"FUNCTION: s:UI.getLineNum(file_node){{{1
"returns the line number this node is rendered on, or -1 if it isnt rendered
function! s:UI.getLineNum(file_node)
"if the node is the root then return the root line no.
if a:file_node.isRoot()
return b:NERDTree.ui.getRootLineNum()
endif
let totalLines = line("$")
"the path components we have matched so far
let pathcomponents = [substitute(b:NERDTreeRoot.path.str({'format': 'UI'}), '/ *$', '', '')]
"the index of the component we are searching for
let curPathComponent = 1
let fullpath = a:file_node.path.str({'format': 'UI'})
let lnum = b:NERDTree.ui.getRootLineNum()
while lnum > 0
let lnum = lnum + 1
"have we reached the bottom of the tree?
if lnum ==# totalLines+1
return -1
endif
let curLine = getline(lnum)
let indent = self._indentLevelFor(curLine)
if indent ==# curPathComponent
let curLine = nerdtree#stripMarkupFromLine(curLine, 1)
let curPath = join(pathcomponents, '/') . '/' . curLine
if stridx(fullpath, curPath, 0) ==# 0
if fullpath ==# curPath || strpart(fullpath, len(curPath)-1,1) ==# '/'
let curLine = substitute(curLine, '/ *$', '', '')
call add(pathcomponents, curLine)
let curPathComponent = curPathComponent + 1
if fullpath ==# curPath
return lnum
endif
endif
endif
endif
endwhile
return -1
endfunction
"FUNCTION: s:UI.getRootLineNum(){{{1
"gets the line number of the root node
function! s:UI.getRootLineNum()
let rootLine = 1
while getline(rootLine) !~# '^\(/\|<\)'
let rootLine = rootLine + 1
endwhile
return rootLine
endfunction
"FUNCTION: s:UI._indentLevelFor(line) {{{2
function! s:UI._indentLevelFor(line)
let level = match(a:line, '[^ \-+~▸▾`|]') / nerdtree#treeWid()
" check if line includes arrows
if match(a:line, '[▸▾]') > -1
" decrement level as arrow uses 3 ascii chars
let level = level - 1
endif
return level
endfunction
"FUNCTION: s:UI.restoreScreenState() {{{2
"
"Sets the screen state back to what it was when nerdtree#saveScreenState was last
"called.
"
"Assumes the cursor is in the NERDTree window
function! s:UI.restoreScreenState()
if !has_key(self, '_screenState')
return
endif
exec("silent vertical resize " . self._screenState['oldWindowSize'])
let old_scrolloff=&scrolloff
let &scrolloff=0
call cursor(self._screenState['oldTopLine'], 0)
normal! zt
call setpos(".", self._screenState['oldPos'])
let &scrolloff=old_scrolloff
endfunction
"FUNCTION: s:UI.saveScreenState() {{{2
"Saves the current cursor position in the current buffer and the window
"scroll position
function! s:UI.saveScreenState()
let win = winnr()
try
call nerdtree#putCursorInTreeWin()
let self._screenState = {}
let self._screenState['oldPos'] = getpos(".")
let self._screenState['oldTopLine'] = line("w0")
let self._screenState['oldWindowSize']= winwidth("")
call nerdtree#exec(win . "wincmd w")
catch /^NERDTree.InvalidOperationError/
endtry
endfunction
"FUNCTION: s:UI.render() {{{2
function! s:UI.render()
setlocal modifiable
"remember the top line of the buffer and the current line so we can
"restore the view exactly how it was
let curLine = line(".")
let curCol = col(".")
let topLine = line("w0")
"delete all lines in the buffer (being careful not to clobber a register)
silent 1,$delete _
call nerdtree#dumpHelp()
"delete the blank line before the help and add one after it
if g:NERDTreeMinimalUI == 0
call setline(line(".")+1, "")
call cursor(line(".")+1, col("."))
endif
if b:NERDTreeShowBookmarks
call nerdtree#renderBookmarks()
endif
"add the 'up a dir' line
if !g:NERDTreeMinimalUI
call setline(line(".")+1, nerdtree#treeUpDirLine())
call cursor(line(".")+1, col("."))
endif
"draw the header line
let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)})
call setline(line(".")+1, header)
call cursor(line(".")+1, col("."))
"draw the tree
let old_o = @o
let @o = b:NERDTreeRoot.renderToString()
silent put o
let @o = old_o
"delete the blank line at the top of the buffer
silent 1,1delete _
"restore the view
let old_scrolloff=&scrolloff
let &scrolloff=0
call cursor(topLine, 1)
normal! zt
call cursor(curLine, curCol)
let &scrolloff = old_scrolloff
setlocal nomodifiable
endfunction
"FUNCTION: UI.renderViewSavingPosition {{{1
"Renders the tree and ensures the cursor stays on the current node or the
"current nodes parent if it is no longer available upon re-rendering
function! s:UI.renderViewSavingPosition()
let currentNode = g:NERDTreeFileNode.GetSelected()
"go up the tree till we find a node that will be visible or till we run
"out of nodes
while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot()
let currentNode = currentNode.parent
endwhile
call b:NERDTree.render()
if currentNode != {}
call currentNode.putCursorHere(0, 0)
endif
endfunction
" FUNCTION: s:UI.toggleIgnoreFilter() {{{1
" toggles the use of the NERDTreeIgnore option
function! s:UI.toggleIgnoreFilter()
let b:NERDTreeIgnoreEnabled = !b:NERDTreeIgnoreEnabled
call b:NERDTree.ui.renderViewSavingPosition()
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:UI.toggleShowBookmarks() {{{1
" toggles the display of bookmarks
function! s:UI.toggleShowBookmarks()
let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks
if b:NERDTreeShowBookmarks
call b:NERDTree.render()
call nerdtree#putCursorOnBookmarkTable()
else
call b:NERDTree.ui.renderViewSavingPosition()
endif
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:UI.toggleShowFiles() {{{1
" toggles the display of hidden files
function! s:UI.toggleShowFiles()
let b:NERDTreeShowFiles = !b:NERDTreeShowFiles
call b:NERDTree.ui.renderViewSavingPosition()
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:UI.toggleShowHidden() {{{1
" toggles the display of hidden files
function! s:UI.toggleShowHidden()
let b:NERDTreeShowHidden = !b:NERDTreeShowHidden
call b:NERDTree.ui.renderViewSavingPosition()
call self.centerView()
endfunction
" FUNCTION: s:UI.toggleZoom() {{{1
" zoom (maximize/minimize) the NERDTree window
function! s:UI.toggleZoom()
if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
exec "silent vertical resize ". size
let b:NERDTreeZoomed = 0
else
exec "vertical resize"
let b:NERDTreeZoomed = 1
endif
endfunction

View file

@ -1,26 +0,0 @@
"============================================================================
"File: avrgcc.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Karel <karelishere at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_arduino_avrgcc_checker')
finish
endif
let g:loaded_syntastic_arduino_avrgcc_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'arduino',
\ 'name': 'avrgcc',
\ 'exec': 'avr-gcc',
\ 'redirect': 'c/avrgcc'})
" vim: set et sts=4 sw=4:

View file

@ -1,45 +0,0 @@
"============================================================================
"File: bro.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Justin Azoff <justin.azoff@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_bro_bro_checker")
finish
endif
let g:loaded_syntastic_bro_bro_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_bro_bro_IsAvailable() dict
return system(self.getExecEscaped() . ' --help') =~# '--parse-only'
endfunction
function! SyntaxCheckers_bro_bro_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '--parse-only' })
"example: error in ./foo.bro, line 3: unknown identifier banana, at or "near "banana"
let errorformat =
\ '%trror in %f\, line %l: %m,' .
\ '%tarning in %f\, line %l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'bro',
\ 'name': 'bro'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,65 +0,0 @@
"============================================================================
"File: clang_check.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_clang_check_checker")
finish
endif
let g:loaded_syntastic_c_clang_check_checker = 1
if !exists('g:syntastic_clang_check_config_file')
let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_clang_check_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_clang_check_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args':
\ '-- ' .
\ syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' .
\ '-fshow-column ' .
\ '-fshow-source-location ' .
\ '-fno-caret-diagnostics ' .
\ '-fno-color-diagnostics ' .
\ '-fdiagnostics-format=clang' })
let errorformat =
\ '%E%f:%l:%c: fatal error: %m,' .
\ '%E%f:%l:%c: error: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'clang_check',
\ 'exec': 'clang-check'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,65 +0,0 @@
"============================================================================
"File: clang_tidy.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_clang_tidy_checker")
finish
endif
let g:loaded_syntastic_c_clang_tidy_checker = 1
if !exists('g:syntastic_clang_tidy_config_file')
let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_clang_tidy_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args':
\ '-- ' .
\ syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' .
\ '-fshow-column ' .
\ '-fshow-source-location ' .
\ '-fno-caret-diagnostics ' .
\ '-fno-color-diagnostics ' .
\ '-fdiagnostics-format=clang' })
let errorformat =
\ '%E%f:%l:%c: fatal error: %m,' .
\ '%E%f:%l:%c: error: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'clang_tidy',
\ 'exec': 'clang-tidy'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,65 +0,0 @@
"============================================================================
"File: pc_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Steve Bragg <steve at empresseffects dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_c_pc_lint_checker")
finish
endif
let g:loaded_syntastic_c_pc_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_pc_lint_config_file')
let g:syntastic_pc_lint_config_file = 'options.lnt'
endif
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
let config = findfile(g:syntastic_pc_lint_config_file, '.;')
" -hFs1 - show filename, add space after messages, try to make message 1 line
" -width(0,0) - make sure there are no line breaks
" -t - set tab size
" -v - turn off verbosity
let makeprg = self.makeprgBuild({
\ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''),
\ 'args_after': ['-hFs1', '-width(0,0)', '-t' . &tabstop, '-format=%f:%l:%C:%t:%n:%m'] })
let errorformat =
\ '%E%f:%l:%v:Error:%n:%m,' .
\ '%W%f:%l:%v:Warning:%n:%m,' .
\ '%I%f:%l:%v:Info:%n:%m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['cygwinRemoveCR'] })
for e in loclist
if e['type'] ==? 'I'
let e['type'] = 'W'
let e['subtype'] = 'Style'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'pc_lint',
\ 'exec': 'lint-nt'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,55 +0,0 @@
"============================================================================
"File: cabal.vim
"Description: Haskell package description (.cabal file) linting and syntax
" validation via 'cabal check'
"Maintainer: Ian D. Bollinger <ian.bollinger@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_cabal_cabal_checker')
finish
endif
let g:loaded_syntastic_cabal_cabal_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+")
if field != ''
return '\v\c^\s*' . field . '\s*:\s*\zs.*$'
endif
let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'")
if field != ''
return '\V\c\<' . escape(field, '\') . '\>'
endif
return ''
endfunction
function! SyntaxCheckers_cabal_cabal_GetLocList() dict
let makeprg = self.getExecEscaped() . ' check'
let errorformat =
\ '%Ecabal: %f:%l: %m,' .
\ '%W* %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h'),
\ 'preprocess': 'cabal',
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cabal',
\ 'name': 'cabal'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,25 +0,0 @@
"============================================================================
"File: clang_check.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_clang_check_checker")
finish
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_check',
\ 'exec': 'clang-check',
\ 'redirect': 'c/clang_check'})
" vim: set et sts=4 sw=4:

View file

@ -1,25 +0,0 @@
"============================================================================
"File: clang_tidy.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Benjamin Bannier <bbannier at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_clang_tidy_checker")
finish
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_tidy',
\ 'exec': 'clang-tidy',
\ 'redirect': 'c/clang_tidy'})
" vim: set et sts=4 sw=4:

View file

@ -1,26 +0,0 @@
"============================================================================
"File: pc_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Steve Bragg <steve at empresseffects dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_cpp_pc_lint_checker")
finish
endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'pc_lint',
\ 'exec': 'lint-nt',
\ 'redirect': 'c/pc_lint'})
" vim: set et sts=4 sw=4:

View file

@ -1,26 +0,0 @@
"============================================================================
"File: recess.vim
"Description: Syntax checking plugin for syntastic.vim using `recess`
" (http://twitter.github.io/recess/).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_css_recess_checker")
finish
endif
let g:loaded_syntastic_css_recess_checker = 1
runtime! syntax_checkers/less/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'recess',
\ 'redirect': 'less/recess'})
" vim: set et sts=4 sw=4:

View file

@ -1,43 +0,0 @@
"============================================================================
"File: scan.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_haskell_scan_checker')
finish
endif
let g:loaded_syntastic_haskell_scan_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_haskell_scan_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l:%v: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell',
\ 'name': 'scan'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,44 +0,0 @@
"============================================================================
"File: recess.vim
"Description: Syntax checking plugin for syntastic.vim using `recess`
" (http://twitter.github.io/recess/).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_less_recess_checker')
finish
endif
let g:loaded_syntastic_less_recess_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_less_recess_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args_after': '--format=compact --stripColors' })
let errorformat =
\ '%E%m in %f,' .
\ '%Z %#%l.%.%#,' .
\ '%f:%l:%m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'less',
\ 'name': 'recess'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,91 +0,0 @@
"============================================================================
"File: phplint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_php_phplint_checker")
finish
endif
let g:loaded_syntastic_php_phplint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_php_phplint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\m\(class\|function\|method\) \zs\S\+\ze was declared as')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\maccess forbidden to \(private\|protected\) \(class\|constant\|method\|variable\|\(private\|protected\) property\) \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\musing deprecated \(class\|constant\|method\|property\|variable\) \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
if term != ''
return '\V' . escape(term, '\')
endif
let term = matchstr(a:item['text'], '\munresolved function \zs\S\+\ze')
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_php_phplint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after':
\ '--print-file-name ' .
\ '--print-line-numbers ' .
\ '--print-column-number ' .
\ '--print-errors ' .
\ '--print-warnings ' .
\ '--no-print-notices ' .
\ '--no-print-context ' .
\ '--no-print-source ' .
\ '--tab-size ' . &tabstop })
let errorformat =
\ '%E%f:%l:%v: %tRROR: %m,' .
\ '%W%f:%l:%v: %tarning: %m,' .
\ '%+C%\t%.%#,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['compressWhitespace'],
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
for e in loclist
let e['text'] = substitute(e['text'], '\m \(Hint\|Examples\):.*', '', '')
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'php',
\ 'name': 'phplint',
\ 'exec': 'phpl' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,81 +0,0 @@
"============================================================================
"File: lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_r_lint_checker")
finish
endif
let g:loaded_syntastic_r_lint_checker = 1
if !exists('g:syntastic_r_lint_styles')
let g:syntastic_r_lint_styles = 'lint.style'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_r_lint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m`\zs[^`]\+\ze`')
if term == ''
let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'")
endif
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_r_lint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
call system(self.getExecEscaped() . ' --slave --restore --no-save -e ' . syntastic#util#shescape('library(lint)'))
return v:shell_error == 0
endfunction
function! SyntaxCheckers_r_lint_GetLocList() dict
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let setwd = 'setwd("' . escape(getcwd(), '"\') . '"); '
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
\ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' .
\ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .
\ ' --args ' . syntastic#util#shexpand('%')
let errorformat =
\ '%t:%f:%l:%v: %m,' .
\ '%t:%f:%l: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'rparse',
\ 'returns': [0] })
for e in loclist
if e['type'] == 'F'
" parse error
let e['type'] = 'E'
call remove(e, 'subtype')
endif
endfor
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'r',
\ 'name': 'lint',
\ 'exec': 'R' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,78 +0,0 @@
"============================================================================
"File: svtools.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Security:
"
" This checker runs the code in your file. This is probably fine if you
" wrote the file yourself, but it can be a problem if you're trying to
" check third party files. If you are 100% willing to let Vim run the
" code in your file, set g:syntastic_enable_r_svtools_checker to 1 in
" your vimrc to enable this checker:
"
" let g:syntastic_enable_r_svtools_checker = 1
if exists("g:loaded_syntastic_r_svtools_checker")
finish
endif
let g:loaded_syntastic_r_svtools_checker = 1
if !exists('g:syntastic_r_svtools_styles')
let g:syntastic_r_svtools_styles = 'lint.style'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_r_svtools_GetHighlightRegex(item)
let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'")
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_r_svtools_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
call system(self.getExecEscaped() . ' --slave --restore --no-save -e ' . syntastic#util#shescape('library(svTools)'))
return v:shell_error == 0
endfunction
function! SyntaxCheckers_r_svtools_GetLocList() dict
if !exists('g:syntastic_enable_r_svtools_checker') || !g:syntastic_enable_r_svtools_checker
call syntastic#log#error('checker r/svtools: checks disabled for security reasons; set g:syntastic_enable_r_svtools_checker to 1 to override')
return []
endif
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
\ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' .
\ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') .
\ ' --args ' . syntastic#util#shexpand('%')
let errorformat =
\ '%trror:%f:%\s%#%l:%\s%#%v:%m,' .
\ '%tarning:%f:%\s%#%l:%\s%#%v:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'r',
\ 'name': 'svtools',
\ 'exec': 'R' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,38 +0,0 @@
"============================================================================
"File: sassc.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_sass_sassc_checker")
finish
endif
let g:loaded_syntastic_sass_sassc_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_sass_sassc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'fname_after': syntastic#util#DevNull() })
let errorformat = '%f:%l: %trror: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sass',
\ 'name': 'sassc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,71 +0,0 @@
"============================================================================
"File: scalastyle.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_scala_scalastyle_checker')
finish
endif
let g:loaded_syntastic_scala_scalastyle_checker = 1
if !exists('g:syntastic_scala_scalastyle_jar')
let g:syntastic_scala_scalastyle_jar = 'scalastyle-batch_2.10.jar'
endif
if !exists('g:syntastic_scala_scalastyle_config_file')
let g:syntastic_scala_scalastyle_config_file = 'scalastyle_config.xml'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_scala_scalastyle_IsAvailable() dict
return
\ executable(self.getExec()) &&
\ filereadable(expand(g:syntastic_scala_scalastyle_jar)) &&
\ filereadable(expand(g:syntastic_scala_scalastyle_config_file))
endfunction
function! SyntaxCheckers_scala_scalastyle_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe_after': ['-jar', expand(g:syntastic_scala_scalastyle_jar)],
\ 'args_before': ['-q', 'true', '-c', expand(g:syntastic_scala_scalastyle_config_file)] })
let errorformat =
\ '%trror file=%f message=%m line=%l column=%c,' .
\ '%trror file=%f message=%m line=%l,' .
\ '%tarning file=%f message=%m line=%l column=%c,' .
\ '%tarning file=%f message=%m line=%l'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
for e in loclist
if has_key(e, 'col')
let e['col'] += 1
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scala',
\ 'name': 'scalastyle',
\ 'exec': 'java'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,25 +0,0 @@
"============================================================================
"File: sassc.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_scss_sassc_checker")
finish
endif
let g:loaded_syntastic_scss_sassc_checker = 1
runtime! syntax_checkers/sass/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'sassc',
\ 'redirect': 'sass/sassc'})
" vim: set et sts=4 sw=4:

View file

@ -1,43 +0,0 @@
"============================================================================
"File: rpmlint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_spec_rpmlint_checker')
finish
endif
let g:loaded_syntastic_spec_rpmlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_spec_rpmlint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%E%f:%l: E: %m,' .
\ '%E%f: E: %m,' .
\ '%W%f:%l: W: %m,' .
\ '%W%f: W: %m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'spec',
\ 'name': 'rpmlint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,46 +0,0 @@
"============================================================================
"File: typescript/tslint.vim
"Description: TypeScript linter
"Maintainer: Seon-Wook Park <seon.wook@swook.net>
"============================================================================
if exists("g:loaded_syntastic_typescript_tslint_checker")
finish
endif
let g:loaded_syntastic_typescript_tslint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], "\\m\\s'\\zs.\\{-}\\ze'\\s")
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_typescript_tslint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--format verbose',
\ 'fname_before': '-f' })
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
let errorformat = '%f[%l\, %c]: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'tslint',
\ 'returns': [0, 2] })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'typescript',
\ 'name': 'tslint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,42 +0,0 @@
"============================================================================
"File: plutil.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_xml_plutil_checker")
finish
endif
let g:loaded_syntastic_xml_plutil_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_xml_plutil_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': '-lint -s',
\ 'fname_before': '--' })
let errorformat =
\ '%E%f: %m at line %l'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xml',
\ 'name': 'plutil'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -1,127 +0,0 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Last Change: 2014-06-30.
" @Revision: 25
if !exists('g:tlib#sys#windows')
let g:tlib#sys#windows = &shell !~ 'sh' && (has('win16') || has('win32') || has('win64')) "{{{2
endif
if !exists('g:tlib#sys#null')
let g:tlib#sys#null = g:tlib#sys#windows ? 'NUL' : (filereadable('/dev/null') ? '/dev/null' : '') "{{{2
endif
let s:executables = {}
function! tlib#sys#IsExecutable(cmd, ...) "{{{3
" TLogVAR a:cmd
" echom "DBG has_key(s:executables, a:cmd)" has_key(s:executables, a:cmd)
if !has_key(s:executables, a:cmd)
let executable = executable(a:cmd)
" TLogVAR 1, executable
let ignore_cyg = a:0 >= 1 ? a:1 : !g:tlib#sys#windows
if !executable && !ignore_cyg
let executable = tlib#sys#IsCygwinBin(a:cmd)
" TLogVAR 2, executable
endif
let s:executables[a:cmd] = executable
endif
" echom "DBG s:executables[a:cmd]" s:executables[a:cmd]
return s:executables[a:cmd]
endf
if !exists('g:tlib#sys#check_cygpath')
" If true, check whether we have to convert a path via cyppath --
" see |tlib#sys#MaybeUseCygpath|
let g:tlib#sys#check_cygpath = g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath') "{{{2
endif
if !exists('g:tlib#sys#cygwin_path_rx')
" If a full windows filename (with slashes instead of backslashes)
" matches this |regexp|, it is assumed to be a cygwin executable.
let g:tlib#sys#cygwin_path_rx = '/cygwin/' "{{{2
endif
if !exists('g:tlib#sys#cygwin_expr')
" For cygwin binaries, convert command calls using this vim
" expression.
let g:tlib#sys#cygwin_expr = '"bash -c ''". escape(%s, "''\\") ."''"' "{{{2
endif
let s:cygwin = {}
function! tlib#sys#IsCygwinBin(cmd) "{{{3
" TLogVAR a:cmd
if !g:tlib#sys#windows
return 0
elseif has_key(s:cygwin, a:cmd)
let rv = s:cygwin[a:cmd]
else
if !tlib#sys#IsExecutable('cygpath', 1) || !tlib#sys#IsExecutable('which', 1)
let rv = 0
else
let which = substitute(system('which '. shellescape(a:cmd)), '\n$', '', '')
" echom "DBG which:" which
if which =~ '^/'
let filename = system('cygpath -ma '. shellescape(which))
" echom "DBG filename:" filename
let rv = filename =~ g:tlib#sys#cygwin_path_rx
else
let rv = 0
endif
endif
let s:cygwin[a:cmd] = rv
endif
" TLogVAR rv
return rv
endf
function! tlib#sys#GetCmd(cmd) "{{{3
if !empty(g:tlib#sys#cygwin_expr) && tlib#sys#IsCygwinBin(matchstr(a:cmd, '^\S\+'))
let cmd = eval(printf(g:tlib#sys#cygwin_expr, string(a:cmd)))
" TLogVAR cmd
return cmd
else
return a:cmd
endif
endf
" If cmd seems to be a cygwin executable, use cygpath to convert
" filenames. This assumes that cygwin's which command returns full
" filenames for non-cygwin executables.
function! tlib#sys#MaybeUseCygpath(cmd) "{{{3
" echom "DBG" a:cmd
if g:tlib#sys#check_cygpath && tlib#sys#IsCygwinBin(a:cmd)
return 'cygpath -u "%s"'
endif
return ''
endf
function! tlib#sys#ConvertPath(converter, filename) "{{{3
return tlib#string#Chomp(system(printf(a:converter, shellescape(a:filename))))
endf
let s:native_filenames = {}
function! tlib#sys#FileArgs(cmd, files) "{{{3
let cygpath = tlib#sys#MaybeUseCygpath(a:cmd)
" TLogVAR cygpath
if empty(cygpath)
return a:files
else
let files = map(copy(a:files), 'has_key(s:native_filenames, v:val) ? s:native_filenames[v:val] : tlib#sys#CygPath(v:val)')
return files
endif
endf

View file

@ -1,14 +0,0 @@
" MIT License. Copyright (c) 2014 Mathias Andersson.
" vim: et ts=2 sts=2 sw=2
if !exists('*CapsLockStatusline')
finish
endif
function! airline#extensions#capslock#status()
return CapsLockStatusline() == '[caps]' ? 'CAPS' : ''
endfunction
function! airline#extensions#capslock#init(ext)
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
endfunction

View file

@ -1,54 +0,0 @@
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_nrrw_rgn', 0)
finish
endif
function! airline#extensions#nrrwrgn#apply(...)
if exists(":WidenRegion") == 2
let spc = g:airline_symbols.space
if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus())
call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn))
let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), ''))
call a:1.add_section('airline_c', spc.bufname.spc)
call a:1.split()
else
let dict=nrrwrgn#NrrwRgnStatus()
let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '}
let mode = dict.visual ? vmode[dict.visual] : vmode['V']
let winwidth = winwidth(0)
if winwidth < 80
let mode = mode[0]
endif
let title = (winwidth < 80 ? "Nrrw" : "Narrowed ")
let multi = (winwidth < 80 ? 'M' : 'Multi')
call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""),
\ title, mode, b:nrrw_instn, spc))
let name = dict.fullname
if name !=# '[No Name]'
if winwidth > 100
" need some space
let name = fnamemodify(dict.fullname, ':~')
if strlen(name) > 8
" shorten name
let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g')
endif
else
let name = fnamemodify(dict.fullname, ':t')
endif
endif
let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1]))
call a:1.add_section('airline_c', printf("%s %s %s", name, range, dict.enabled ? "\u2713" : '!'))
call a:1.split()
call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc)
call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc)
call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z'))
endif
return 1
endif
endfunction
function! airline#extensions#nrrwrgn#init(ext)
call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply')
endfunction

Some files were not shown because too many files have changed in this diff Show more