mirror of
https://github.com/amix/vimrc
synced 2025-07-08 18:04:59 +08:00
merge conflicts of .gitignore and README.md
This commit is contained in:
@ -309,10 +309,10 @@ elseif &background=='dark'
|
||||
hi SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0
|
||||
hi SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8
|
||||
endif
|
||||
hi Pmenu guifg=fg guibg=#800080
|
||||
hi PmenuSel guifg=#000000 guibg=#d0d0d0 gui=NONE
|
||||
hi PmenuSbar guifg=fg guibg=#000080 gui=NONE
|
||||
hi PmenuThumb guifg=fg guibg=#008000 gui=NONE
|
||||
|
||||
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
|
||||
@ -369,12 +369,12 @@ elseif &background=='dark'
|
||||
hi StatusLine ctermfg=Black ctermbg=DarkCyan
|
||||
hi Question ctermfg=Black ctermbg=DarkYellow
|
||||
hi Todo ctermfg=DarkRed ctermbg=DarkYellow
|
||||
hi Folded ctermfg=White ctermbg=DarkGreen
|
||||
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 FoldColumn ctermfg=White ctermbg=DarkGreen
|
||||
hi SignColumn ctermfg=White ctermbg=DarkGreen
|
||||
hi DiffText ctermfg=Black ctermbg=DarkYellow
|
||||
|
||||
@ -385,12 +385,12 @@ elseif &background=='dark'
|
||||
hi SpellRare ctermfg=NONE ctermbg=DarkMagenta
|
||||
hi SpellLocal ctermfg=NONE ctermbg=DarkGreen
|
||||
endif
|
||||
hi Pmenu ctermfg=fg ctermbg=DarkMagenta
|
||||
hi PmenuSel ctermfg=Black ctermbg=fg
|
||||
hi PmenuSbar ctermfg=fg ctermbg=DarkBlue
|
||||
hi PmenuThumb ctermfg=fg ctermbg=DarkGreen
|
||||
hi TabLine ctermfg=fg ctermbg=DarkGreen cterm=underline
|
||||
hi TabLineFill ctermfg=fg ctermbg=DarkGreen cterm=underline
|
||||
|
||||
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
|
||||
@ -524,8 +524,8 @@ elseif &background=='dark'
|
||||
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=22 cterm=NONE
|
||||
hi FoldColumn ctermfg=254 ctermbg=28 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
|
||||
@ -552,13 +552,14 @@ elseif &background=='dark'
|
||||
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=NONE
|
||||
endif
|
||||
endif
|
||||
hi Pmenu ctermfg=fg ctermbg=90
|
||||
hi PmenuSel ctermfg=16 ctermbg=252 cterm=NONE
|
||||
hi PmenuSbar ctermfg=fg ctermbg=18 cterm=NONE
|
||||
hi PmenuThumb ctermfg=fg ctermbg=28 cterm=NONE
|
||||
hi TabLine ctermfg=fg ctermbg=28 cterm=NONE
|
||||
hi TabLineFill ctermfg=fg ctermbg=28 cterm=NONE
|
||||
|
||||
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
|
||||
|
File diff suppressed because one or more lines are too long
0
sources_forked/vim-powerline/README.md
Normal file
0
sources_forked/vim-powerline/README.md
Normal file
107
sources_forked/vim-powerline/README.rst
Executable file
107
sources_forked/vim-powerline/README.rst
Executable file
@ -0,0 +1,107 @@
|
||||
=================
|
||||
Powerline for vim
|
||||
=================
|
||||
|
||||
:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com)
|
||||
:Source: https://github.com/Lokaltog/vim-powerline
|
||||
:Version: β
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Powerline is a utility plugin which allows you to create better-looking,
|
||||
more functional vim statuslines. See the screenshots below for
|
||||
a demonstration of the plugin's capabilities.
|
||||
|
||||
It's recommended that you install the plugin using Pathogen_ or Vundle_.
|
||||
After the plugin is installed update your help tags and see ``:help
|
||||
Powerline`` for instructions on how to enable and configure the plugin.
|
||||
|
||||
See the `Troubleshooting`_ section below if you're having any issues with
|
||||
the plugin or the font patcher.
|
||||
|
||||
**Note:** You need a patched font to be able to use the symbols in the
|
||||
statusline. An experimental Python/fontforge-based font patcher is included
|
||||
in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage
|
||||
instructions.
|
||||
|
||||
.. _Pathogen: https://github.com/tpope/vim-pathogen
|
||||
.. _Vundle: https://github.com/gmarik/vundle
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
.. image:: http://i.imgur.com/MsuIB.png
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
I can't see the fancy symbols, what's wrong?
|
||||
Make sure that you have ``let g:Powerline_symbols = 'fancy'`` in your
|
||||
``vimrc`` file. The settings may be loaded too late if you have this in
|
||||
``gvimrc``, so always put this in your ``vimrc``.
|
||||
|
||||
Clear the cache using ``:PowerlineClearCache`` and restart vim.
|
||||
|
||||
Make sure that you've configured gvim or your terminal emulator to use
|
||||
a patched font.
|
||||
|
||||
Make sure that vim is compiled with the ``--with-features=big`` flag.
|
||||
|
||||
The fancy symbols look a bit blurry or "off"!
|
||||
Make sure that you have patched all variants of your font (i.e. both the
|
||||
regular and the bold font files).
|
||||
|
||||
I'm unable to patch my font, what should I do?
|
||||
Font patching is only known to work on most Linux and OS X machines. If
|
||||
you have followed the instructions in the fontpatcher README and still
|
||||
have problems, please submit an issue on GitHub.
|
||||
|
||||
You can download some community-contributed patched fonts from the
|
||||
`Powerline wiki`_ if you don't want to mess around with the font
|
||||
patcher.
|
||||
|
||||
The Syntastic/Fugitive statusline flags don't work!
|
||||
These flags should work without any configuration. If you installed
|
||||
either plugin after Powerline, you'll have to clear the cache using
|
||||
``:PowerlineClearCache`` and restart vim.
|
||||
|
||||
The colors are weird in the default OS X Terminal app!
|
||||
The default OS X Terminal app is known to have some issues with the
|
||||
Powerline colors. Please use another terminal emulator. iTerm2 should
|
||||
work fine.
|
||||
|
||||
The arrows may have the wrong colors if you have changed the "minimum
|
||||
contrast" slider in the color tab of your OS X settings.
|
||||
|
||||
The statusline has strange characters like ``^B`` in it!
|
||||
Please add ``set encoding=utf-8`` to your ``vimrc``.
|
||||
|
||||
You may also need to set your ``LANG`` and ``LC_*`` environment
|
||||
variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your
|
||||
Linux distro's documentation for information about setting these
|
||||
variables correctly.
|
||||
|
||||
The statusline has a lot of ``^`` or underline characters in it!
|
||||
You need to configure the ``fillchars`` setting to disable statusline
|
||||
fillchars (see ``:h fillchars`` for details). Add this to your
|
||||
``vimrc`` to solve this issue::
|
||||
|
||||
set fillchars+=stl:\ ,stlnc:\
|
||||
|
||||
The statusline is hidden/only appears in split windows!
|
||||
Make sure that you have ``set laststatus=2`` in your ``vimrc``.
|
||||
|
||||
I'm using tmux and Powerline looks like crap, what's wrong?
|
||||
You need to tell tmux that it has 256-color capabilities. Add this to
|
||||
your ``.tmux.conf`` to solve this issue::
|
||||
|
||||
set -g default-terminal "screen-256color"
|
||||
|
||||
If you use iTerm2, make sure that you have enabled the setting 'Set
|
||||
locale variables automatically' in Profiles > Terminal > Environment.
|
||||
|
||||
If you have any other issues and you can't find the answer in the docs,
|
||||
please submit an issue on GitHub.
|
||||
|
||||
.. _`Powerline wiki`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts
|
183
sources_forked/vim-powerline/autoload/Pl.vim
Executable file
183
sources_forked/vim-powerline/autoload/Pl.vim
Executable file
@ -0,0 +1,183 @@
|
||||
" Powerline - The ultimate statusline utility
|
||||
"
|
||||
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
||||
" Source repository: https://github.com/Lokaltog/vim-powerline
|
||||
|
||||
" Script variables {{{
|
||||
let g:Pl#OLD_STL = ''
|
||||
let g:Pl#THEME = []
|
||||
let g:Pl#THEME_CALLBACKS = []
|
||||
let g:Pl#HL = []
|
||||
|
||||
" Cache revision, this must be incremented whenever the cache format is changed
|
||||
let s:CACHE_REVISION = 7
|
||||
" }}}
|
||||
" Script initialization {{{
|
||||
function! Pl#LoadCache() " {{{
|
||||
if filereadable(g:Powerline_cache_file) && g:Powerline_cache_enabled
|
||||
exec 'source' escape(g:Powerline_cache_file, ' \')
|
||||
|
||||
if ! exists('g:Powerline_cache_revision') || g:Powerline_cache_revision != s:CACHE_REVISION
|
||||
" Cache revision differs, cache is invalid
|
||||
unlet! g:Powerline_cache_revision
|
||||
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Create highlighting groups
|
||||
for hi_cmd in g:Pl#HL
|
||||
exec hi_cmd
|
||||
endfor
|
||||
|
||||
" Run theme callbacks
|
||||
for callback in g:Pl#THEME_CALLBACKS
|
||||
" Substitute {{NEWLINE}} with newlines (strings must be
|
||||
" stored without newlines characters to avoid vim errors)
|
||||
exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g')
|
||||
exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g')
|
||||
endfor
|
||||
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunction " }}}
|
||||
function! Pl#ClearCache() " {{{
|
||||
if filereadable(g:Powerline_cache_file)
|
||||
" Delete the cache file
|
||||
call delete(g:Powerline_cache_file)
|
||||
endif
|
||||
|
||||
echo 'Powerline cache cleared. Please restart vim for the changes to take effect.'
|
||||
endfunction " }}}
|
||||
function! Pl#ReloadColorscheme() " {{{
|
||||
call Pl#ClearCache()
|
||||
|
||||
" The colorscheme and theme files must be manually sourced because
|
||||
" vim won't reload previously autoloaded files
|
||||
"
|
||||
" This is a bit hackish, but it works
|
||||
unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme
|
||||
exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0]
|
||||
|
||||
unlet! g:Powerline#Themes#{g:Powerline_theme}#theme
|
||||
exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0]
|
||||
|
||||
let g:Pl#THEME = []
|
||||
|
||||
call Pl#Load()
|
||||
endfunction " }}}
|
||||
function! Pl#Load() " {{{
|
||||
if empty(g:Pl#OLD_STL)
|
||||
" Store old statusline
|
||||
let g:Pl#OLD_STL = &statusline
|
||||
endif
|
||||
|
||||
if ! Pl#LoadCache()
|
||||
try
|
||||
" Autoload the theme dict first
|
||||
let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme
|
||||
catch
|
||||
echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.'
|
||||
|
||||
return
|
||||
endtry
|
||||
|
||||
" Create list with parsed statuslines
|
||||
for buffer_statusline in raw_theme
|
||||
unlet! mode_statuslines
|
||||
let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments)
|
||||
|
||||
if ! empty(buffer_statusline.callback)
|
||||
" The callback function passes its arguments on to
|
||||
" Pl#StatuslineCallback along with the normal/current mode
|
||||
" statusline.
|
||||
let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n"
|
||||
let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n"
|
||||
let s:cb_func .= "endfunction"
|
||||
|
||||
" The callback expression should be used to initialize any
|
||||
" variables that will use the callback function. The
|
||||
" expression requires a %s which will be replaced by the
|
||||
" callback function name.
|
||||
let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1])
|
||||
|
||||
exec s:cb_func
|
||||
exec s:cb_expr
|
||||
|
||||
" Newlines must be substituted with another character
|
||||
" because vim doesn't like newlines in strings
|
||||
call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')])
|
||||
|
||||
unlet! s:cb_func s:cb_expr
|
||||
|
||||
continue
|
||||
endif
|
||||
|
||||
" Store the statuslines for matching specific buffers
|
||||
call add(g:Pl#THEME, {
|
||||
\ 'matches': buffer_statusline.matches,
|
||||
\ 'mode_statuslines': mode_statuslines
|
||||
\ })
|
||||
endfor
|
||||
|
||||
if ! g:Powerline_cache_enabled
|
||||
" Don't cache anything if caching is disabled or cache file isn't writeable
|
||||
return
|
||||
endif
|
||||
|
||||
" Prepare commands and statuslines for caching
|
||||
let cache = [
|
||||
\ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION),
|
||||
\ 'let g:Pl#HL = '. string(g:Pl#HL),
|
||||
\ 'let g:Pl#THEME = '. string(g:Pl#THEME),
|
||||
\ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS),
|
||||
\ ]
|
||||
|
||||
call writefile(cache, g:Powerline_cache_file)
|
||||
endif
|
||||
endfunction " }}}
|
||||
" }}}
|
||||
" Statusline updater {{{
|
||||
function! Pl#Statusline(statusline, current) " {{{
|
||||
let mode = mode()
|
||||
|
||||
if ! a:current
|
||||
let mode = 'N' " Normal (non-current)
|
||||
elseif mode =~# '\v(v|V|)'
|
||||
let mode = 'v' " Visual mode
|
||||
elseif mode =~# '\v(s|S|)'
|
||||
let mode = 's' " Select mode
|
||||
elseif mode =~# '\vi'
|
||||
let mode = 'i' " Insert mode
|
||||
elseif mode =~# '\v(R|Rv)'
|
||||
let mode = 'r' " Replace mode
|
||||
else
|
||||
" Fallback to normal mode
|
||||
let mode = 'n' " Normal (current)
|
||||
endif
|
||||
|
||||
return g:Pl#THEME[a:statusline].mode_statuslines[mode]
|
||||
endfunction " }}}
|
||||
function! Pl#StatuslineCallback(statusline, args) " {{{
|
||||
" Replace %1, %2, etc. in the statusline with the callback args
|
||||
return substitute(
|
||||
\ a:statusline,
|
||||
\ '\v\%(\d+)',
|
||||
\ '\=a:args[submatch(1)]',
|
||||
\ 'g')
|
||||
endfunction " }}}
|
||||
function! Pl#UpdateStatusline(current) " {{{
|
||||
if empty(g:Pl#THEME)
|
||||
" Load statuslines if they aren't loaded yet
|
||||
call Pl#Load()
|
||||
endif
|
||||
|
||||
for i in range(0, len(g:Pl#THEME) - 1)
|
||||
if Pl#Match#Validate(g:Pl#THEME[i])
|
||||
" Update window-local statusline
|
||||
let &l:statusline = '%!Pl#Statusline('. i .','. a:current .')'
|
||||
endif
|
||||
endfor
|
||||
endfunction " }}}
|
||||
" }}}
|
145
sources_forked/vim-powerline/autoload/Pl/Colorscheme.vim
Executable file
145
sources_forked/vim-powerline/autoload/Pl/Colorscheme.vim
Executable file
@ -0,0 +1,145 @@
|
||||
function! Pl#Colorscheme#Init(hi) " {{{
|
||||
let colorscheme = {}
|
||||
|
||||
for hi in a:hi
|
||||
" Ensure that the segments are a list
|
||||
let segments = type(hi[0]) == type('') ? [ hi[0] ] : hi[0]
|
||||
let mode_hi_dict = hi[1]
|
||||
|
||||
for segment in segments
|
||||
let colorscheme[segment] = mode_hi_dict
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return colorscheme
|
||||
endfunction " }}}
|
||||
function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{
|
||||
" Set color parameters for all segments in a:buffer_segments
|
||||
|
||||
" TODO This function should be recursive and work on both segments and groups
|
||||
" TODO We could probably handle the NS stuff here...
|
||||
|
||||
try
|
||||
let colorscheme = g:Powerline#Colorschemes#{a:colorscheme}#colorscheme
|
||||
catch
|
||||
echom 'Color scheme "'. a:colorscheme .'" doesn''t exist!'
|
||||
|
||||
return
|
||||
endtry
|
||||
|
||||
let buffer_segments = a:buffer_segments
|
||||
|
||||
" This is a bit complex, I'll walk you through exactly what happens here...
|
||||
"
|
||||
" First of all we loop through the buffer_segments, which are the segments that
|
||||
" this specific buffer will have.
|
||||
for buffer_segment in buffer_segments
|
||||
" The buffer_segment consists of a 'matches' list and a 'segments' list.
|
||||
" The 'matches' list has conditions to limit this statusline to specific buffers/windows.
|
||||
" The 'segments' list has each segment and segment group for this buffer
|
||||
for segment in buffer_segment.segments
|
||||
let type = get(segment, 'type', '')
|
||||
|
||||
if type == 'segment_group'
|
||||
" We're going to handle segment groups different from single segments. Segment groups
|
||||
" have child segments which may have their own highlighting (e.g. fileinfo.flags),
|
||||
" and these child segments may be grouped (e.g. fileinfo.flags.ro) to provide very
|
||||
" specific highlighting. So here we'll handle all that:
|
||||
|
||||
" Set the default/fallback colors for this group
|
||||
for i in range(len(segment.variants), 0, -1)
|
||||
" Check for available highlighting for the main group segment
|
||||
"
|
||||
" This works like the segment highlighting below
|
||||
" TODO Create a function for this
|
||||
let seg_variants = join(segment.variants[0:i], '.')
|
||||
|
||||
let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name
|
||||
let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name
|
||||
|
||||
if has_key(colorscheme, seg_ns_name)
|
||||
" We have a namespaced highlight group
|
||||
let segment.colors = colorscheme[seg_ns_name]
|
||||
break
|
||||
elseif has_key(colorscheme, seg_name)
|
||||
" We have a non-namespaced group
|
||||
let segment.colors = colorscheme[seg_name]
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
" The reason why we need to deepcopy the group's segments is that the child segments
|
||||
" all point to the same base segments and that screws up highlighting if we highlight
|
||||
" some child segments with different namespaced colors
|
||||
let segment.segments = deepcopy(segment.segments)
|
||||
|
||||
" Apply colors to each child segment
|
||||
for child_segment in segment.segments
|
||||
" Check if this child segment is grouped (e.g. fileinfo.flags.group.subgroup)
|
||||
" We're going to prioritize the most specific grouping and then work back to the
|
||||
" most common group (e.g. fileinfo.flags)
|
||||
|
||||
" FIXME We don't have the variants from before because group children aren't run through Pl#Segment#Get
|
||||
let child_segment.variants = [seg_name] + split(child_segment.name, '\.')
|
||||
|
||||
" Use the parent group's namespace
|
||||
let child_segment.ns = segment.ns
|
||||
|
||||
for i in range(len(child_segment.variants), 0, -1)
|
||||
" Check for available highlighting for the main group segment
|
||||
let child_seg_name = join(child_segment.variants[0:i], '.')
|
||||
|
||||
let child_seg_ns_name = len(child_segment.ns) > 0 ? child_segment.ns .':'. child_seg_name : child_seg_name
|
||||
|
||||
if has_key(colorscheme, child_seg_ns_name)
|
||||
" We have a namespaced highlight group
|
||||
let child_segment.colors = colorscheme[child_seg_ns_name]
|
||||
break
|
||||
elseif has_key(colorscheme, child_seg_name)
|
||||
" We have a non-namespaced group
|
||||
let child_segment.colors = colorscheme[child_seg_name]
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
elseif type == 'segment'
|
||||
for i in range(len(segment.variants), 0, -1)
|
||||
" Check for available highlighting
|
||||
"
|
||||
" This is done in the following manner, using the segment gundo:static_filename.text.buffer as an example:
|
||||
"
|
||||
" * Look for the hl group: gundo:static_filename.text.buffer
|
||||
" * Look for the hl group: static_filename.text.buffer
|
||||
" * Look for the hl group: gundo:static_filename.text
|
||||
" * Look for the hl group: static_filename.text
|
||||
" * Look for the hl group: gundo:static_filename
|
||||
" * Look for the hl group: static_filename
|
||||
" * Return the segment without highlighting, causing an error in the parser
|
||||
let seg_variants = join(segment.variants[0:i], '.')
|
||||
|
||||
let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name
|
||||
let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name
|
||||
|
||||
if has_key(colorscheme, seg_ns_name)
|
||||
" We have a namespaced highlight group
|
||||
let segment.colors = colorscheme[seg_ns_name]
|
||||
break
|
||||
elseif has_key(colorscheme, seg_name)
|
||||
" We have a non-namespaced group
|
||||
let segment.colors = colorscheme[seg_name]
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
unlet! segment
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" Good luck parsing this return value
|
||||
"
|
||||
" It's a huge dict with all segments for all buffers with their respective syntax highlighting.
|
||||
" It will be parsed by the main Powerline code, where all the data will be shortened to a simple
|
||||
" array consiting of a statusline for each mode, with generated highlighting groups and dividers.
|
||||
return buffer_segments
|
||||
endfunction " }}}
|
140
sources_forked/vim-powerline/autoload/Pl/Hi.vim
Executable file
140
sources_forked/vim-powerline/autoload/Pl/Hi.vim
Executable file
@ -0,0 +1,140 @@
|
||||
" cterm -> gui color dict {{{
|
||||
let s:cterm2gui_dict = {
|
||||
\ 16: 0x000000, 17: 0x00005f, 18: 0x000087, 19: 0x0000af, 20: 0x0000d7, 21: 0x0000ff,
|
||||
\ 22: 0x005f00, 23: 0x005f5f, 24: 0x005f87, 25: 0x005faf, 26: 0x005fd7, 27: 0x005fff,
|
||||
\ 28: 0x008700, 29: 0x00875f, 30: 0x008787, 31: 0x0087af, 32: 0x0087d7, 33: 0x0087ff,
|
||||
\ 34: 0x00af00, 35: 0x00af5f, 36: 0x00af87, 37: 0x00afaf, 38: 0x00afd7, 39: 0x00afff,
|
||||
\ 40: 0x00d700, 41: 0x00d75f, 42: 0x00d787, 43: 0x00d7af, 44: 0x00d7d7, 45: 0x00d7ff,
|
||||
\ 46: 0x00ff00, 47: 0x00ff5f, 48: 0x00ff87, 49: 0x00ffaf, 50: 0x00ffd7, 51: 0x00ffff,
|
||||
\ 52: 0x5f0000, 53: 0x5f005f, 54: 0x5f0087, 55: 0x5f00af, 56: 0x5f00d7, 57: 0x5f00ff,
|
||||
\ 58: 0x5f5f00, 59: 0x5f5f5f, 60: 0x5f5f87, 61: 0x5f5faf, 62: 0x5f5fd7, 63: 0x5f5fff,
|
||||
\ 64: 0x5f8700, 65: 0x5f875f, 66: 0x5f8787, 67: 0x5f87af, 68: 0x5f87d7, 69: 0x5f87ff,
|
||||
\ 70: 0x5faf00, 71: 0x5faf5f, 72: 0x5faf87, 73: 0x5fafaf, 74: 0x5fafd7, 75: 0x5fafff,
|
||||
\ 76: 0x5fd700, 77: 0x5fd75f, 78: 0x5fd787, 79: 0x5fd7af, 80: 0x5fd7d7, 81: 0x5fd7ff,
|
||||
\ 82: 0x5fff00, 83: 0x5fff5f, 84: 0x5fff87, 85: 0x5fffaf, 86: 0x5fffd7, 87: 0x5fffff,
|
||||
\ 88: 0x870000, 89: 0x87005f, 90: 0x870087, 91: 0x8700af, 92: 0x8700d7, 93: 0x8700ff,
|
||||
\ 94: 0x875f00, 95: 0x875f5f, 96: 0x875f87, 97: 0x875faf, 98: 0x875fd7, 99: 0x875fff,
|
||||
\ 100: 0x878700, 101: 0x87875f, 102: 0x878787, 103: 0x8787af, 104: 0x8787d7, 105: 0x8787ff,
|
||||
\ 106: 0x87af00, 107: 0x87af5f, 108: 0x87af87, 109: 0x87afaf, 110: 0x87afd7, 111: 0x87afff,
|
||||
\ 112: 0x87d700, 113: 0x87d75f, 114: 0x87d787, 115: 0x87d7af, 116: 0x87d7d7, 117: 0x87d7ff,
|
||||
\ 118: 0x87ff00, 119: 0x87ff5f, 120: 0x87ff87, 121: 0x87ffaf, 122: 0x87ffd7, 123: 0x87ffff,
|
||||
\ 124: 0xaf0000, 125: 0xaf005f, 126: 0xaf0087, 127: 0xaf00af, 128: 0xaf00d7, 129: 0xaf00ff,
|
||||
\ 130: 0xaf5f00, 131: 0xaf5f5f, 132: 0xaf5f87, 133: 0xaf5faf, 134: 0xaf5fd7, 135: 0xaf5fff,
|
||||
\ 136: 0xaf8700, 137: 0xaf875f, 138: 0xaf8787, 139: 0xaf87af, 140: 0xaf87d7, 141: 0xaf87ff,
|
||||
\ 142: 0xafaf00, 143: 0xafaf5f, 144: 0xafaf87, 145: 0xafafaf, 146: 0xafafd7, 147: 0xafafff,
|
||||
\ 148: 0xafd700, 149: 0xafd75f, 150: 0xafd787, 151: 0xafd7af, 152: 0xafd7d7, 153: 0xafd7ff,
|
||||
\ 154: 0xafff00, 155: 0xafff5f, 156: 0xafff87, 157: 0xafffaf, 158: 0xafffd7, 159: 0xafffff,
|
||||
\ 160: 0xd70000, 161: 0xd7005f, 162: 0xd70087, 163: 0xd700af, 164: 0xd700d7, 165: 0xd700ff,
|
||||
\ 166: 0xd75f00, 167: 0xd75f5f, 168: 0xd75f87, 169: 0xd75faf, 170: 0xd75fd7, 171: 0xd75fff,
|
||||
\ 172: 0xd78700, 173: 0xd7875f, 174: 0xd78787, 175: 0xd787af, 176: 0xd787d7, 177: 0xd787ff,
|
||||
\ 178: 0xd7af00, 179: 0xd7af5f, 180: 0xd7af87, 181: 0xd7afaf, 182: 0xd7afd7, 183: 0xd7afff,
|
||||
\ 184: 0xd7d700, 185: 0xd7d75f, 186: 0xd7d787, 187: 0xd7d7af, 188: 0xd7d7d7, 189: 0xd7d7ff,
|
||||
\ 190: 0xd7ff00, 191: 0xd7ff5f, 192: 0xd7ff87, 193: 0xd7ffaf, 194: 0xd7ffd7, 195: 0xd7ffff,
|
||||
\ 196: 0xff0000, 197: 0xff005f, 198: 0xff0087, 199: 0xff00af, 200: 0xff00d7, 201: 0xff00ff,
|
||||
\ 202: 0xff5f00, 203: 0xff5f5f, 204: 0xff5f87, 205: 0xff5faf, 206: 0xff5fd7, 207: 0xff5fff,
|
||||
\ 208: 0xff8700, 209: 0xff875f, 210: 0xff8787, 211: 0xff87af, 212: 0xff87d7, 213: 0xff87ff,
|
||||
\ 214: 0xffaf00, 215: 0xffaf5f, 216: 0xffaf87, 217: 0xffafaf, 218: 0xffafd7, 219: 0xffafff,
|
||||
\ 220: 0xffd700, 221: 0xffd75f, 222: 0xffd787, 223: 0xffd7af, 224: 0xffd7d7, 225: 0xffd7ff,
|
||||
\ 226: 0xffff00, 227: 0xffff5f, 228: 0xffff87, 229: 0xffffaf, 230: 0xffffd7, 231: 0xffffff,
|
||||
\ 232: 0x080808, 233: 0x121212, 234: 0x1c1c1c, 235: 0x262626, 236: 0x303030, 237: 0x3a3a3a,
|
||||
\ 238: 0x444444, 239: 0x4e4e4e, 240: 0x585858, 241: 0x626262, 242: 0x6c6c6c, 243: 0x767676,
|
||||
\ 244: 0x808080, 245: 0x8a8a8a, 246: 0x949494, 247: 0x9e9e9e, 248: 0xa8a8a8, 249: 0xb2b2b2,
|
||||
\ 250: 0xbcbcbc, 251: 0xc6c6c6, 252: 0xd0d0d0, 253: 0xdadada, 254: 0xe4e4e4, 255: 0xeeeeee
|
||||
\ }
|
||||
" }}}
|
||||
" Allocated color dict {{{
|
||||
let s:allocated_colors = {
|
||||
\ 'NONE': 'NONE',
|
||||
\ }
|
||||
" }}}
|
||||
function! s:Cterm2GUI(cterm) " {{{
|
||||
if toupper(a:cterm) == 'NONE'
|
||||
return 'NONE'
|
||||
endif
|
||||
|
||||
if ! has_key(s:cterm2gui_dict, a:cterm)
|
||||
return 0xff0000
|
||||
endif
|
||||
|
||||
return s:cterm2gui_dict[a:cterm]
|
||||
endfunction " }}}
|
||||
function! Pl#Hi#Segments(segments, mode_colors) " {{{
|
||||
let mode_translate = {
|
||||
\ 'normal': 'n',
|
||||
\ 'noncurrent': 'N',
|
||||
\ 'insert': 'i',
|
||||
\ 'visual': 'v',
|
||||
\ 'replace': 'r',
|
||||
\ 'select': 's',
|
||||
\ }
|
||||
|
||||
let attributes = ['bold', 'italic', 'underline']
|
||||
|
||||
let segments = a:segments
|
||||
let mode_hi_dict = {}
|
||||
|
||||
" Mode dict
|
||||
for [mode, colors] in items(a:mode_colors)
|
||||
if has_key(mode_translate, mode)
|
||||
let mode = mode_translate[mode]
|
||||
endif
|
||||
|
||||
unlet! fg
|
||||
let fg = s:allocated_colors[colors[0]]
|
||||
|
||||
let hi = {
|
||||
\ 'cterm': [fg['cterm'], ''],
|
||||
\ 'gui' : [fg['gui'], ''],
|
||||
\ 'attr' : []
|
||||
\ }
|
||||
|
||||
if exists('colors[1]')
|
||||
if type(colors[1]) == type([])
|
||||
" We don't have a BG color, but we have attributes
|
||||
let hi.attr = colors[1]
|
||||
else
|
||||
" The second parameter is the background color
|
||||
unlet! bg
|
||||
let bg = s:allocated_colors[colors[1]]
|
||||
|
||||
let hi.cterm[1] = bg['cterm']
|
||||
let hi.gui[1] = bg['gui']
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('colors[2]') && type(colors[2]) == type([])
|
||||
" The third parameter is always an attribute list
|
||||
let hi.attr = colors[2]
|
||||
endif
|
||||
|
||||
let mode_hi_dict[mode] = {
|
||||
\ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])),
|
||||
\ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])),
|
||||
\ 'guifg' : (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])),
|
||||
\ 'guibg' : (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])),
|
||||
\ 'attr' : (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ','))
|
||||
\ }
|
||||
endfor
|
||||
|
||||
return [segments, mode_hi_dict]
|
||||
endfunction " }}}
|
||||
function! Pl#Hi#Allocate(colors) " {{{
|
||||
for [key, color] in items(a:colors)
|
||||
if type(color) == type(0)
|
||||
" Only terminal color
|
||||
let cterm = color
|
||||
let gui = s:Cterm2GUI(color)
|
||||
elseif type(color) == type([]) && len(color) == 2
|
||||
" Terminal and GUI colors
|
||||
let cterm = color[0]
|
||||
let gui = color[1]
|
||||
endif
|
||||
|
||||
let s:allocated_colors[key] = {
|
||||
\ 'cterm': cterm,
|
||||
\ 'gui': gui,
|
||||
\ }
|
||||
|
||||
unlet! color
|
||||
endfor
|
||||
endfunction " }}}
|
43
sources_forked/vim-powerline/autoload/Pl/Match.vim
Executable file
43
sources_forked/vim-powerline/autoload/Pl/Match.vim
Executable file
@ -0,0 +1,43 @@
|
||||
function! Pl#Match#Add(pat, expr) " {{{
|
||||
return [a:pat, a:expr]
|
||||
endfunction " }}}
|
||||
function! Pl#Match#Any(...) " {{{
|
||||
let matches = []
|
||||
|
||||
for match_name in a:000
|
||||
if empty(match_name)
|
||||
" Skip empty match parameters
|
||||
continue
|
||||
endif
|
||||
|
||||
if has_key(g:Powerline#Matches#matches, match_name)
|
||||
call add(matches, g:Powerline#Matches#matches[match_name])
|
||||
endif
|
||||
|
||||
unlet! match_name
|
||||
endfor
|
||||
|
||||
return ['match', 'any', matches]
|
||||
endfunction " }}}
|
||||
function! Pl#Match#Validate(theme) " {{{
|
||||
let match = a:theme.matches[1]
|
||||
|
||||
if match == 'none'
|
||||
return 0
|
||||
elseif match == 'any'
|
||||
let matches = a:theme.matches[2]
|
||||
|
||||
if ! len(matches)
|
||||
" Empty match array matches everything
|
||||
return 1
|
||||
endif
|
||||
|
||||
for [eval, re] in matches
|
||||
if match(eval(eval), '\v'. re) != -1
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endif
|
||||
endfunction " }}}
|
40
sources_forked/vim-powerline/autoload/Pl/Mod.vim
Executable file
40
sources_forked/vim-powerline/autoload/Pl/Mod.vim
Executable file
@ -0,0 +1,40 @@
|
||||
let s:segment_mods = []
|
||||
|
||||
function! Pl#Mod#AddSegmentMod(action, properties) " {{{
|
||||
call add(s:segment_mods, [a:action, a:properties])
|
||||
endfunction " }}}
|
||||
function! Pl#Mod#ApplySegmentMods(theme) " {{{
|
||||
let theme = deepcopy(a:theme)
|
||||
|
||||
for mod in s:segment_mods
|
||||
let [action, properties] = mod
|
||||
|
||||
" We have to loop through the segments instead of using index() because some
|
||||
" segments are lists!
|
||||
let target_seg_idx = -1
|
||||
|
||||
for i in range(0, len(theme) - 1)
|
||||
unlet! segment
|
||||
let segment = theme[i]
|
||||
|
||||
if type(segment) == type(properties.target_segment) && segment == properties.target_segment
|
||||
let target_seg_idx = i
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if action == 'insert_segment'
|
||||
" Insert segment
|
||||
if target_seg_idx != -1
|
||||
call insert(theme, properties.new_segment, (properties.where == 'before' ? target_seg_idx : target_seg_idx + 1))
|
||||
endif
|
||||
elseif action == 'remove_segment'
|
||||
" Remove segment
|
||||
if target_seg_idx != -1
|
||||
call remove(theme, target_seg_idx)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return theme
|
||||
endfunction " }}}
|
371
sources_forked/vim-powerline/autoload/Pl/Parser.vim
Executable file
371
sources_forked/vim-powerline/autoload/Pl/Parser.vim
Executable file
@ -0,0 +1,371 @@
|
||||
let g:Pl#Parser#Symbols = {
|
||||
\ 'compatible': {
|
||||
\ 'dividers': [ '', [0x2502], '', [0x2502] ]
|
||||
\ , 'symbols' : {
|
||||
\ 'BRANCH': 'BR:'
|
||||
\ , 'RO' : 'RO'
|
||||
\ , 'FT' : 'FT'
|
||||
\ , 'LINE' : 'LN'
|
||||
\ }
|
||||
\ },
|
||||
\ 'unicode': {
|
||||
\ 'dividers': [ [0x25b6], [0x276f], [0x25c0], [0x276e] ]
|
||||
\ , 'symbols' : {
|
||||
\ 'BRANCH': [0x26a1]
|
||||
\ , 'RO' : [0x2613]
|
||||
\ , 'FT' : [0x2691]
|
||||
\ , 'LINE' : [0x204b]
|
||||
\ },
|
||||
\ },
|
||||
\ 'fancy': {
|
||||
\ 'dividers': [ [0x2b80], [0x2b81], [0x2b82], [0x2b83] ]
|
||||
\ , 'symbols' : {
|
||||
\ 'BRANCH': [0x2b60]
|
||||
\ , 'RO' : [0x2b64]
|
||||
\ , 'FT' : [0x2b62, 0x2b63]
|
||||
\ , 'LINE' : [0x2b61]
|
||||
\ }
|
||||
\ }
|
||||
\ }
|
||||
|
||||
" Handle symbol overrides
|
||||
for [s:key, s:value] in items(g:Powerline_symbols_override)
|
||||
let g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[s:key] = s:value
|
||||
|
||||
unlet! s:key s:value
|
||||
endfor
|
||||
|
||||
" Handle divider overrides
|
||||
if len(g:Powerline_dividers_override) == 4
|
||||
let g:Pl#Parser#Symbols[g:Powerline_symbols].dividers = g:Powerline_dividers_override
|
||||
endif
|
||||
|
||||
let s:LEFT_SIDE = 0
|
||||
let s:RIGHT_SIDE = 2
|
||||
|
||||
let s:PADDING = 1
|
||||
|
||||
let s:EMPTY_SEGMENT = { 'type': 'empty' }
|
||||
|
||||
let s:HARD_DIVIDER = 0
|
||||
let s:SOFT_DIVIDER = 1
|
||||
|
||||
function! Pl#Parser#GetStatusline(segments) " {{{
|
||||
let statusline = {
|
||||
\ 'n': ''
|
||||
\ , 'N': ''
|
||||
\ , 'v': ''
|
||||
\ , 'i': ''
|
||||
\ , 'r': ''
|
||||
\ , 's': ''
|
||||
\ }
|
||||
|
||||
" Run through the different modes and create the statuslines
|
||||
for mode in keys(statusline)
|
||||
" Create an empty statusline list
|
||||
let stl = []
|
||||
|
||||
call extend(stl, s:ParseSegments(mode, s:LEFT_SIDE, a:segments))
|
||||
|
||||
let statusline[mode] .= join(stl, '')
|
||||
endfor
|
||||
|
||||
return statusline
|
||||
endfunction " }}}
|
||||
function! Pl#Parser#ParseChars(arg) " {{{
|
||||
" Handles symbol arrays which can be either an array of hex values,
|
||||
" or a string. Will convert the hex array to a string, or return the
|
||||
" string as-is.
|
||||
let arg = a:arg
|
||||
|
||||
if type(arg) == type([])
|
||||
" Hex array
|
||||
call map(arg, 'nr2char(v:val)')
|
||||
|
||||
return join(arg, '')
|
||||
endif
|
||||
|
||||
" Anything else, just return it as it is
|
||||
return arg
|
||||
endfunction " }}}
|
||||
function! s:ParseSegments(mode, side, segments, ...) " {{{
|
||||
let mode = a:mode
|
||||
let side = a:side
|
||||
let segments = a:segments
|
||||
|
||||
let level = exists('a:1') ? a:1 : 0
|
||||
let base_color = exists('a:2') ? a:2 : {}
|
||||
|
||||
let ret = []
|
||||
|
||||
for i in range(0, len(segments) - 1)
|
||||
unlet! seg_prev seg_curr seg_next
|
||||
|
||||
" Prepare some resources (fetch previous, current and next segment)
|
||||
let seg_curr = deepcopy(get(segments, i))
|
||||
|
||||
" Find previous segment
|
||||
let seg_prev = s:EMPTY_SEGMENT
|
||||
|
||||
" If we're currently at i = 0 we have to start on 0 or else we will start on the last segment (list[-1])
|
||||
let range_start = (i == 0 ? i : i - 1)
|
||||
for j in range(range_start, 0, -1)
|
||||
let seg = deepcopy(get(segments, j))
|
||||
if get(seg, 'name') ==# 'TRUNCATE'
|
||||
" Skip truncate segments
|
||||
continue
|
||||
endif
|
||||
|
||||
" Look ahead for another segment that's visible in this mode
|
||||
if index(get(seg, 'modes'), mode) != -1
|
||||
" Use this segment
|
||||
let seg_prev = seg
|
||||
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
"" Find next segment
|
||||
let seg_next = s:EMPTY_SEGMENT
|
||||
|
||||
" If we're currently at i = len(segments) - 1 we have to start on i or else we will get an error because the index doesn't exist
|
||||
let range_start = (i == len(segments) - 1 ? i : i + 1)
|
||||
for j in range(range_start, len(segments) - 1, 1)
|
||||
let seg = deepcopy(get(segments, j))
|
||||
if get(seg, 'name') ==# 'TRUNCATE'
|
||||
" Skip truncate segments
|
||||
continue
|
||||
endif
|
||||
|
||||
" Look ahead for another segment that's visible in this mode
|
||||
if index(get(seg, 'modes'), mode) != -1
|
||||
" Use this segment
|
||||
let seg_next = seg
|
||||
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if index(get(seg_curr, 'modes', []), mode) == -1
|
||||
" The segment is invisible in this mode, skip it
|
||||
" FIXME When two segments after each other are hidden, a gap appears where the segments would be, this is probably due to segment padding
|
||||
continue
|
||||
endif
|
||||
|
||||
" Handle the different segment types
|
||||
if seg_curr.type == 'segment'
|
||||
if seg_curr.name ==# 'TRUNCATE'
|
||||
" Truncate statusline
|
||||
call add(ret, '%<')
|
||||
elseif seg_curr.name ==# 'SPLIT'
|
||||
" Split statusline
|
||||
|
||||
" Switch sides
|
||||
let side = s:RIGHT_SIDE
|
||||
|
||||
" Handle highlighting
|
||||
let mode_colors = get(seg_curr.colors, mode, seg_curr.colors['n'])
|
||||
let hl_group = s:HlCreate(mode_colors)
|
||||
|
||||
" Add segment text
|
||||
call add(ret, '%#'. hl_group .'#%=')
|
||||
else
|
||||
" Add segment text
|
||||
let text = seg_curr.text
|
||||
|
||||
" Decide on whether to use the group's colors or the segment's colors
|
||||
let colors = get(seg_curr, 'colors', base_color)
|
||||
|
||||
" Fallback to normal (current) highlighting if we don't have mode-specific highlighting
|
||||
let mode_colors = get(colors, mode, get(colors, 'n', {}))
|
||||
|
||||
if empty(mode_colors)
|
||||
echom 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"'
|
||||
|
||||
continue
|
||||
endif
|
||||
|
||||
" Check if we're in a group (level > 0)
|
||||
if level > 0
|
||||
" If we're in a group we don't have dividers between
|
||||
" segments, so we should only pad one side, but only pad
|
||||
" if the segment doesn't have Pl#Segment#NoPadding() set
|
||||
let padding_right = (seg_curr.padding && side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '')
|
||||
let padding_left = (seg_curr.padding && side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '')
|
||||
|
||||
" Check if we lack a bg/fg color for this segment
|
||||
" If we do, use the bg/fg color from base_color
|
||||
let base_color_mode = ! has_key(base_color, mode) ? base_color['n'] : base_color[mode]
|
||||
|
||||
for col in ['ctermbg', 'ctermfg', 'guibg', 'guifg']
|
||||
if empty(mode_colors[col])
|
||||
let mode_colors[col] = base_color_mode[col]
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
"" If we're outside a group we have dividers and must pad both sides
|
||||
let padding_left = repeat(' ', s:PADDING)
|
||||
let padding_right = repeat(' ', s:PADDING)
|
||||
endif
|
||||
|
||||
" Get main hl group for segment
|
||||
let hl_group = s:HlCreate(mode_colors)
|
||||
|
||||
" Prepare segment text
|
||||
let text = '%(%#'. hl_group .'#'. padding_left . text . padding_right . '%)'
|
||||
|
||||
if level == 0
|
||||
" Add divider to single segments
|
||||
let text = s:AddDivider(text, side, mode, colors, seg_prev, seg_curr, seg_next)
|
||||
endif
|
||||
|
||||
call add(ret, text)
|
||||
endif
|
||||
elseif seg_curr.type == 'segment_group'
|
||||
" Recursively parse segment group
|
||||
let func_params = [mode, side, seg_curr.segments, level + 1]
|
||||
|
||||
if has_key(seg_curr, 'colors')
|
||||
" Pass the base colors on to the child segments
|
||||
call add(func_params, seg_curr.colors)
|
||||
endif
|
||||
|
||||
" Get segment group string
|
||||
let text = join(call('s:ParseSegments', func_params), '')
|
||||
|
||||
" Pad on the opposite side of the divider
|
||||
let padding_right = (side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '')
|
||||
let padding_left = (side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '')
|
||||
|
||||
let text = s:AddDivider(padding_left . text . padding_right, side, mode, seg_curr.colors, seg_prev, seg_curr, seg_next)
|
||||
|
||||
call add(ret, text)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ret
|
||||
endfunction " }}}
|
||||
function! s:HlCreate(hl) " {{{
|
||||
" Create a short and unique highlighting group name
|
||||
" It uses the hex values of all the color properties and an attribute flag at the end
|
||||
" NONE colors are translated to NN for cterm and NNNNNN for gui colors
|
||||
let hi_group = printf('Pl%s%s%s%s%s'
|
||||
\ , (a:hl['ctermfg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermfg']))
|
||||
\ , (a:hl['guifg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guifg'] ))
|
||||
\ , (a:hl['ctermbg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermbg']))
|
||||
\ , (a:hl['guibg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guibg'] ))
|
||||
\ , substitute(a:hl['attr'], '\v([a-zA-Z])[a-zA-Z]*,?', '\1', 'g')
|
||||
\ )
|
||||
|
||||
if ! s:HlExists(hi_group)
|
||||
let ctermbg = a:hl['ctermbg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermbg'])
|
||||
if (has('win32') || has('win64')) && !has('gui_running') && ctermbg != 'NONE' && ctermbg > 128
|
||||
let ctermbg -= 128
|
||||
endif
|
||||
let hi_cmd = printf('hi %s ctermfg=%s ctermbg=%s cterm=%s guifg=%s guibg=%s gui=%s'
|
||||
\ , hi_group
|
||||
\ , a:hl['ctermfg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermfg'])
|
||||
\ , ctermbg
|
||||
\ , a:hl['attr']
|
||||
\ , (a:hl['guifg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guifg']))
|
||||
\ , (a:hl['guibg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guibg']))
|
||||
\ , a:hl['attr']
|
||||
\ )
|
||||
|
||||
exec hi_cmd
|
||||
|
||||
" Add command to Pl#HL list for caching
|
||||
call add(g:Pl#HL, hi_cmd)
|
||||
endif
|
||||
|
||||
" Return only the highlighting group name
|
||||
return hi_group
|
||||
endfunction " }}}
|
||||
function! s:HlExists(hl) " {{{
|
||||
if ! hlexists(a:hl)
|
||||
return 0
|
||||
endif
|
||||
|
||||
redir => hlstatus
|
||||
silent exec 'hi' a:hl
|
||||
redir END
|
||||
|
||||
return (hlstatus !~ 'cleared')
|
||||
endfunction " }}}
|
||||
function! s:AddDivider(text, side, mode, colors, prev, curr, next) " {{{
|
||||
let seg_prev = a:prev
|
||||
let seg_curr = a:curr
|
||||
let seg_next = a:next
|
||||
|
||||
" Set default color/type for the divider
|
||||
let div_colors = get(a:colors, a:mode, a:colors['n'])
|
||||
let div_type = s:SOFT_DIVIDER
|
||||
|
||||
" Define segment to compare
|
||||
let cmp_seg = a:side == s:LEFT_SIDE ? seg_next : seg_prev
|
||||
|
||||
let cmp_all_colors = get(cmp_seg, 'colors', {})
|
||||
let cmp_colors = get(cmp_all_colors, a:mode, get(cmp_all_colors, 'n', {}))
|
||||
|
||||
if ! empty(cmp_colors)
|
||||
" Compare the highlighting groups
|
||||
"
|
||||
" If the background color for cterm is equal, use soft divider with the current segment's highlighting
|
||||
" If not, use hard divider with a new highlighting group
|
||||
"
|
||||
" Note that if the previous/next segment is the split, a hard divider is always used
|
||||
if get(div_colors, 'ctermbg') != get(cmp_colors, 'ctermbg') || get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT'
|
||||
let div_type = s:HARD_DIVIDER
|
||||
|
||||
" Create new highlighting group
|
||||
if div_colors['attr'] =~ 'reverse' && cmp_colors['attr'] =~ 'reverse'
|
||||
" Use FG = CURRENT FG, BG = CMP FG
|
||||
let div_colors['ctermbg'] = get(cmp_colors, 'ctermfg')
|
||||
let div_colors['guibg'] = get(cmp_colors, 'guifg')
|
||||
|
||||
let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE'
|
||||
elseif div_colors['attr'] =~ 'reverse'
|
||||
" Use FG = CURRENT FG, BG = CMP BG
|
||||
let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg')
|
||||
let div_colors['guibg'] = get(cmp_colors, 'guibg')
|
||||
|
||||
let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE'
|
||||
elseif cmp_colors['attr'] =~ 'reverse'
|
||||
" Use FG = CMP FG, BG = CURRENT BG : reversed
|
||||
let div_colors['ctermfg'] = get(cmp_colors, 'ctermfg')
|
||||
let div_colors['guifg'] = get(cmp_colors, 'guifg')
|
||||
|
||||
let div_colors['attr'] = 'reverse'
|
||||
|
||||
else
|
||||
" Use FG = CURRENT BG, BG = CMP BG
|
||||
let div_colors['ctermfg'] = get(div_colors, 'ctermbg')
|
||||
let div_colors['guifg'] = get(div_colors, 'guibg')
|
||||
|
||||
let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg')
|
||||
let div_colors['guibg'] = get(cmp_colors, 'guibg')
|
||||
|
||||
let div_colors['attr'] = 'NONE'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
" Prepare divider
|
||||
let divider_raw = deepcopy(g:Pl#Parser#Symbols[g:Powerline_symbols].dividers[a:side + div_type])
|
||||
let divider = Pl#Parser#ParseChars(divider_raw)
|
||||
|
||||
" Don't add dividers for segments adjacent to split (unless it's a hard divider)
|
||||
if ((get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT') && div_type != s:HARD_DIVIDER)
|
||||
return ''
|
||||
endif
|
||||
|
||||
if a:side == s:LEFT_SIDE
|
||||
" Left side
|
||||
" Divider to the right
|
||||
return printf('%%(%s%%#%s#%s%%)', a:text, s:HlCreate(div_colors), divider)
|
||||
else
|
||||
" Right side
|
||||
" Divider to the left
|
||||
return printf('%%(%%#%s#%s%s%%)', s:HlCreate(div_colors), divider, a:text)
|
||||
endif
|
||||
endfunction " }}}
|
188
sources_forked/vim-powerline/autoload/Pl/Segment.vim
Executable file
188
sources_forked/vim-powerline/autoload/Pl/Segment.vim
Executable file
@ -0,0 +1,188 @@
|
||||
let s:default_modes = ['n', 'N', 'v', 'i', 'r', 's']
|
||||
|
||||
function! s:CheckConditions(params) " {{{
|
||||
" Check conditions for a segment/group
|
||||
" Integer parameters are always conditions
|
||||
for param in a:params
|
||||
if type(param) == type(0) && param == 0
|
||||
" Break here if it's an integer parameter and it's false (0)
|
||||
return 0
|
||||
endif
|
||||
unlet! param
|
||||
endfor
|
||||
|
||||
return 1
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#Create(name, ...) " {{{
|
||||
" Check condition parameters
|
||||
if ! s:CheckConditions(a:000)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let name = a:name
|
||||
let modes = s:default_modes
|
||||
let padding = 1
|
||||
let segments = []
|
||||
|
||||
for param in a:000
|
||||
" Lookup modes for this segment/group
|
||||
if type(param) == type([]) && param[0] == 'modes'
|
||||
let modes = param[1]
|
||||
elseif type(param) == type([]) && param[0] == 'nopadding'
|
||||
let padding = 0
|
||||
elseif type(a:1) == type([]) && a:1[0] == 'segment'
|
||||
call add(segments, param[1])
|
||||
endif
|
||||
|
||||
unlet! param
|
||||
endfor
|
||||
|
||||
if type(a:1) == type([]) && a:1[0] == 'segment'
|
||||
" This is a segment group
|
||||
return ['segment_group', {
|
||||
\ 'type': 'segment_group'
|
||||
\ , 'name': name
|
||||
\ , 'segments': segments
|
||||
\ , 'modes': modes
|
||||
\ , 'padding': padding
|
||||
\ }]
|
||||
else
|
||||
" This is a single segment
|
||||
let text = a:1
|
||||
|
||||
" Search/replace symbols
|
||||
for [key, symbol] in items(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols)
|
||||
let text = substitute(
|
||||
\ text,
|
||||
\ '\v\$('. key .')',
|
||||
\ '\=Pl#Parser#ParseChars(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[submatch(1)])',
|
||||
\ 'g')
|
||||
|
||||
unlet! key symbol
|
||||
endfor
|
||||
|
||||
return ['segment', {
|
||||
\ 'type': 'segment'
|
||||
\ , 'name': name
|
||||
\ , 'text': text
|
||||
\ , 'modes': modes
|
||||
\ , 'padding': padding
|
||||
\ }]
|
||||
endif
|
||||
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#Init(params) " {{{
|
||||
" Check condition parameters
|
||||
if ! s:CheckConditions(a:params)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let segments = {}
|
||||
let ns = ''
|
||||
|
||||
for param in a:params
|
||||
if type(param) == type('')
|
||||
" String parameters is the namespace
|
||||
let ns = param
|
||||
elseif type(param) == type([])
|
||||
" The data dict is in param[1]
|
||||
" By default we don't have a namespace for the segment
|
||||
let segment = param[1]
|
||||
|
||||
if ! empty(ns)
|
||||
" Update segment so that it includes the namespace
|
||||
" Add the namespace to the segment dict key
|
||||
let segment.ns = ns
|
||||
let segment.name = join([segment.ns, segment.name], ':')
|
||||
endif
|
||||
|
||||
let key = segment.name
|
||||
|
||||
let segments[key] = segment
|
||||
endif
|
||||
|
||||
unlet! param
|
||||
endfor
|
||||
|
||||
return segments
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#Modes(modes) " {{{
|
||||
" Handle modes for both segments and groups
|
||||
let modes = split(a:modes, '\zs')
|
||||
|
||||
if modes[0] == '!'
|
||||
" Filter modes (e.g. "!nr" will ignore the segment in normal and replace modes)
|
||||
let modes = filter(deepcopy(s:default_modes), 'v:val !~# "['. join(modes[1:]) .']"')
|
||||
endif
|
||||
|
||||
return ['modes', modes]
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#NoPadding() " {{{
|
||||
return ['nopadding']
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#Split(...) " {{{
|
||||
return a:0 ? a:1 .':SPLIT' : 'SPLIT'
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#Truncate() " {{{
|
||||
return 'TRUNCATE'
|
||||
endfunction " }}}
|
||||
function! Pl#Segment#Get(name) " {{{
|
||||
" Return a segment data dict
|
||||
let args = []
|
||||
|
||||
" Check for printf segments (lists)
|
||||
if type(a:name) == type([])
|
||||
" We're dealing with a segment with printf arguments
|
||||
let seg_orig_name = a:name[0]
|
||||
let args = a:name[1:]
|
||||
else
|
||||
let seg_orig_name = a:name
|
||||
endif
|
||||
|
||||
" Fetch namespace and variants for storing in the segment dict
|
||||
let seg_ns = ''
|
||||
let seg_variants = []
|
||||
|
||||
" Retrieve color scheme variants
|
||||
let seg_name_split = split(seg_orig_name, '\v\.')
|
||||
if len(seg_name_split) > 1
|
||||
let seg_variants = seg_name_split[1:]
|
||||
endif
|
||||
|
||||
" Retrieve segment name and namespace
|
||||
" Use the first piece of the split string, we can't have variants in the final segment name
|
||||
let seg_name_split = split(seg_name_split[0], '\v:')
|
||||
let seg_name = seg_name_split[0]
|
||||
|
||||
if len(seg_name_split) > 1
|
||||
let seg_ns = seg_name_split[0]
|
||||
let seg_name = seg_name_split[-1]
|
||||
endif
|
||||
|
||||
try
|
||||
" If we have a namespace, try to use the namespaced segment first (i.e. search for the segment in the namespaced file first)
|
||||
let return_segment = deepcopy(g:Powerline#Segments#{seg_ns}#segments[seg_ns .':'. seg_name])
|
||||
catch
|
||||
try
|
||||
" We didn't find a namespaced segment, fall back to common segments
|
||||
let return_segment = deepcopy(g:Powerline#Segments#segments[seg_name])
|
||||
catch
|
||||
" Didn't find the segment among the common segments either, just skip it
|
||||
return {}
|
||||
endtry
|
||||
endtry
|
||||
|
||||
if len(args) && has_key(return_segment, 'text')
|
||||
" Handle segment printf arguments
|
||||
" printf doesn't accept lists as its second argument, so we have to work around that
|
||||
let return_segment.text = call('printf', [ return_segment.text ] + args)
|
||||
endif
|
||||
|
||||
" Assign namespace, name and variants
|
||||
let return_segment.ns = seg_ns
|
||||
let return_segment.name = seg_name
|
||||
let return_segment.orig_name = seg_orig_name
|
||||
let return_segment.variants = seg_variants
|
||||
|
||||
return return_segment
|
||||
endfunction " }}}
|
100
sources_forked/vim-powerline/autoload/Pl/Theme.vim
Executable file
100
sources_forked/vim-powerline/autoload/Pl/Theme.vim
Executable file
@ -0,0 +1,100 @@
|
||||
function! Pl#Theme#Create(...) " {{{
|
||||
let buffer_segments = []
|
||||
|
||||
for buffer_segment in a:000
|
||||
" Remove empty segments (e.g. 'Pl#Theme#Function's)
|
||||
if empty(buffer_segment)
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(buffer_segments, buffer_segment)
|
||||
endfor
|
||||
|
||||
let buffer_segments = Pl#Colorscheme#Apply(g:Powerline_colorscheme, buffer_segments)
|
||||
|
||||
return buffer_segments
|
||||
endfunction " }}}
|
||||
function! Pl#Theme#Callback(name, expr) " {{{
|
||||
return ['callback', a:name, a:expr]
|
||||
endfunction " }}}
|
||||
function! Pl#Theme#Buffer(ns, ...) " {{{
|
||||
let segments = []
|
||||
let ns = ! empty(a:ns) ? a:ns .':' : ''
|
||||
|
||||
" Match namespace parameter by default
|
||||
let matches = Pl#Match#Any(a:ns)
|
||||
let callback = []
|
||||
|
||||
let args = a:000
|
||||
let args = Pl#Mod#ApplySegmentMods(args)
|
||||
|
||||
" Fetch segment data dicts
|
||||
for item in args
|
||||
if type(item) == type([])
|
||||
if item[0] == 'match'
|
||||
" Match item, overrides default namespace match
|
||||
let matches = item
|
||||
|
||||
unlet! item
|
||||
continue
|
||||
elseif item[0] == 'callback'
|
||||
" Store the item as a callback expression
|
||||
let matches = ['match', 'none']
|
||||
let callback = [a:ns, item[1], item[2]]
|
||||
|
||||
unlet! item
|
||||
continue
|
||||
endif
|
||||
|
||||
" printf segment, append ns to first item in list
|
||||
let item[0] = ns . item[0]
|
||||
else
|
||||
let item = ns . item
|
||||
endif
|
||||
|
||||
let segment = Pl#Segment#Get(item)
|
||||
|
||||
if ! empty(segment)
|
||||
" Skip empty (possible disabled) segments
|
||||
call add(segments, segment)
|
||||
endif
|
||||
|
||||
unlet! item
|
||||
endfor
|
||||
|
||||
return {
|
||||
\ 'matches': matches
|
||||
\ , 'callback': callback
|
||||
\ , 'segments': segments
|
||||
\ }
|
||||
endfunction " }}}
|
||||
function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{
|
||||
" It's very important to NOT refer to the theme dict until everything's loaded!
|
||||
"
|
||||
" Because these functions are called from the vimrc, we need to put the
|
||||
" actions in a list which will be parsed later.
|
||||
"
|
||||
" These functions don't accept a name parameter, because they work on the
|
||||
" currently selected theme (will change any selected theme)
|
||||
call Pl#Mod#AddSegmentMod('insert_segment', {
|
||||
\ 'new_segment': a:new_segment,
|
||||
\ 'where': a:where,
|
||||
\ 'target_segment': a:target_segment
|
||||
\ })
|
||||
endfunction " }}}
|
||||
function! Pl#Theme#RemoveSegment(target_segment) " {{{
|
||||
" It's very important to NOT refer to the theme dict until everything's loaded!
|
||||
"
|
||||
" Because these functions are called from the vimrc, we need to put the
|
||||
" actions in a list which will be parsed later.
|
||||
"
|
||||
" These functions don't accept a name parameter, because they work on the
|
||||
" currently selected theme (will change any selected theme)
|
||||
call Pl#Mod#AddSegmentMod('remove_segment', {
|
||||
\ 'target_segment': a:target_segment
|
||||
\ })
|
||||
endfunction " }}}
|
||||
function! Pl#Theme#ReplaceSegment(old_segment, new_segment) " {{{
|
||||
call Pl#Theme#InsertSegment(a:new_segment, 'after', a:old_segment)
|
||||
call Pl#Theme#RemoveSegment(a:old_segment)
|
||||
endfunction " }}}
|
166
sources_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim
Executable file
166
sources_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim
Executable file
@ -0,0 +1,166 @@
|
||||
call Pl#Hi#Allocate({
|
||||
\ 'black' : 16,
|
||||
\ 'white' : 231,
|
||||
\
|
||||
\ 'darkestgreen' : 22,
|
||||
\ 'darkgreen' : 28,
|
||||
\ 'mediumgreen' : 70,
|
||||
\ 'brightgreen' : 148,
|
||||
\
|
||||
\ 'darkestcyan' : 23,
|
||||
\ 'mediumcyan' : 117,
|
||||
\
|
||||
\ 'darkestblue' : 24,
|
||||
\ 'darkblue' : 31,
|
||||
\
|
||||
\ 'darkestred' : 52,
|
||||
\ 'darkred' : 88,
|
||||
\ 'mediumred' : 124,
|
||||
\ 'brightred' : 160,
|
||||
\ 'brightestred' : 196,
|
||||
\
|
||||
\ 'darkestpurple' : 55,
|
||||
\ 'mediumpurple' : 98,
|
||||
\ 'brightpurple' : 189,
|
||||
\
|
||||
\ 'brightorange' : 208,
|
||||
\ 'brightestorange': 214,
|
||||
\
|
||||
\ 'gray0' : 233,
|
||||
\ 'gray1' : 235,
|
||||
\ 'gray2' : 236,
|
||||
\ 'gray3' : 239,
|
||||
\ 'gray4' : 240,
|
||||
\ 'gray5' : 241,
|
||||
\ 'gray6' : 244,
|
||||
\ 'gray7' : 245,
|
||||
\ 'gray8' : 247,
|
||||
\ 'gray9' : 250,
|
||||
\ 'gray10' : 252,
|
||||
\ })
|
||||
|
||||
let g:Powerline#Colorschemes#default#colorscheme = Pl#Colorscheme#Init([
|
||||
\ Pl#Hi#Segments(['SPLIT'], {
|
||||
\ 'n': ['white', 'gray2'],
|
||||
\ 'N': ['white', 'gray0'],
|
||||
\ 'i': ['white', 'darkestblue'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['mode_indicator'], {
|
||||
\ 'n': ['gray10', 'gray0', ['bold']],
|
||||
\ 'i': ['darkestcyan', 'white', ['bold']],
|
||||
\ 'v': ['white', 'darkestblue', ['bold']],
|
||||
\ 'r': ['white', 'brightred', ['bold']],
|
||||
\ 's': ['white', 'gray5', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['branch', 'scrollpercent', 'raw', 'filesize'], {
|
||||
\ 'n': ['gray9', 'gray4'],
|
||||
\ 'N': ['gray4', 'gray1'],
|
||||
\ 'i': ['mediumcyan', 'darkblue'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['fileinfo', 'filename'], {
|
||||
\ 'n': ['white', 'gray4', ['bold']],
|
||||
\ 'N': ['gray7', 'gray0', ['bold']],
|
||||
\ 'i': ['white', 'darkblue', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['fileinfo.filepath'], {
|
||||
\ 'n': ['gray10'],
|
||||
\ 'N': ['gray5'],
|
||||
\ 'i': ['mediumcyan'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['static_str'], {
|
||||
\ 'n': ['white', 'gray4'],
|
||||
\ 'N': ['gray7', 'gray1'],
|
||||
\ 'i': ['white', 'darkblue'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['fileinfo.flags'], {
|
||||
\ 'n': ['brightestred', ['bold']],
|
||||
\ 'N': ['darkred'],
|
||||
\ 'i': ['brightestred', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], {
|
||||
\ 'n': ['gray8', 'gray2'],
|
||||
\ 'i': ['mediumcyan', 'darkestblue'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lineinfo'], {
|
||||
\ 'n': ['gray2', 'gray10', ['bold']],
|
||||
\ 'N': ['gray7', 'gray1', ['bold']],
|
||||
\ 'i': ['darkestcyan', 'mediumcyan', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['errors'], {
|
||||
\ 'n': ['brightestorange', 'gray2', ['bold']],
|
||||
\ 'i': ['brightestorange', 'darkestblue', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lineinfo.line.tot'], {
|
||||
\ 'n': ['gray6'],
|
||||
\ 'N': ['gray5'],
|
||||
\ 'i': ['darkestcyan'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], {
|
||||
\ 'n': ['white', 'brightred', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], {
|
||||
\ 'n': ['white', 'mediumred', ['bold']],
|
||||
\ 'N': ['brightred', 'darkestred', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], {
|
||||
\ 'n': ['white', 'darkred'],
|
||||
\ 'N': ['brightred', 'darkestred'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], {
|
||||
\ 'n': ['white', 'darkred'],
|
||||
\ 'N': ['white', 'darkestred'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], {
|
||||
\ 'n': ['white', 'mediumgreen', ['bold']],
|
||||
\ 'N': ['mediumgreen', 'darkestgreen', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], {
|
||||
\ 'n': ['brightgreen', 'darkgreen'],
|
||||
\ 'N': ['mediumgreen', 'darkestgreen'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], {
|
||||
\ 'n': ['white', 'darkgreen'],
|
||||
\ 'N': ['white', 'darkestgreen'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], {
|
||||
\ 'n': ['brightpurple', 'darkestpurple'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], {
|
||||
\ 'n': ['white', 'mediumpurple'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:item'], {
|
||||
\ 'n': ['darkestpurple', 'white', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:marked'], {
|
||||
\ 'n': ['brightestred', 'darkestpurple', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:count'], {
|
||||
\ 'n': ['darkestpurple', 'white'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:SPLIT'], {
|
||||
\ 'n': ['white', 'darkestpurple'],
|
||||
\ }),
|
||||
\ ])
|
192
sources_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim
Executable file
192
sources_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim
Executable file
@ -0,0 +1,192 @@
|
||||
" This theme is based on Solarized-dark colors, combined
|
||||
" with Powerline native colors
|
||||
call Pl#Hi#Allocate({
|
||||
\ 'black' : 16,
|
||||
\ 'white' : 231,
|
||||
\
|
||||
\ 'darkestgreen' : 22,
|
||||
\ 'darkgreen' : 28,
|
||||
\ 'mediumgreen' : 70,
|
||||
\ 'brightgreen' : 148,
|
||||
\
|
||||
\ 'darkestcyan' : 23,
|
||||
\ 'mediumcyan' : 117,
|
||||
\
|
||||
\ 'darkestblue' : 24,
|
||||
\ 'darkblue' : 31,
|
||||
\
|
||||
\ 'darkestred' : 52,
|
||||
\ 'darkred' : 88,
|
||||
\ 'mediumred' : 124,
|
||||
\ 'brightred' : 160,
|
||||
\ 'brightestred' : 196,
|
||||
\
|
||||
\ 'darkestpurple' : 55,
|
||||
\ 'mediumpurple' : 98,
|
||||
\ 'brightpurple' : 189,
|
||||
\
|
||||
\ 'brightorange' : 208,
|
||||
\ 'brightestorange': 214,
|
||||
\
|
||||
\ 'gray0' : 233,
|
||||
\ 'gray1' : 235,
|
||||
\ 'gray2' : 236,
|
||||
\ 'gray3' : 239,
|
||||
\ 'gray4' : 240,
|
||||
\ 'gray5' : 241,
|
||||
\ 'gray6' : 244,
|
||||
\ 'gray7' : 245,
|
||||
\ 'gray8' : 247,
|
||||
\ 'gray9' : 250,
|
||||
\ 'gray10' : 252,
|
||||
\
|
||||
\ 'base00' : [241, 0x657b83],
|
||||
\ 'base01' : [240, 0x586e75],
|
||||
\ 'base02' : [0, 0x073642],
|
||||
\ 'base03' : [234, 0x002b36],
|
||||
\ 'base0' : [244, 0x839496],
|
||||
\ 'base1' : [245, 0x93a1a1],
|
||||
\ 'base2' : [254, 0xeee8d5],
|
||||
\ 'base3' : [230, 0xfdf6e3],
|
||||
\ 'yellow' : [136, 0xb58900],
|
||||
\ 'orange' : [166, 0xcb4b16],
|
||||
\ 'red' : [160, 0xdc322f],
|
||||
\ 'magenta' : [125, 0xd33682],
|
||||
\ 'violet' : [61, 0x6c71c4],
|
||||
\ 'blue' : [33, 0x268bd2],
|
||||
\ 'cyan' : [37, 0x2aa198],
|
||||
\ 'green' : [64, 0x859900],
|
||||
\ })
|
||||
|
||||
let g:Powerline#Colorschemes#skwp#colorscheme = Pl#Colorscheme#Init([
|
||||
\ Pl#Hi#Segments(['SPLIT'], {
|
||||
\ 'n': ['white', 'base02'],
|
||||
\ 'N': ['white', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['mode_indicator'], {
|
||||
\ 'n': ['darkestgreen', 'brightgreen', ['bold']],
|
||||
\ 'i': ['darkestcyan', 'white', ['bold']],
|
||||
\ 'v': ['red', 'brightorange', ['bold']],
|
||||
\ 'r': ['white', 'violet', ['bold']],
|
||||
\ 's': ['white', 'gray5', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['branch', 'raw', 'filesize'], {
|
||||
\ 'n': ['base03', 'blue'],
|
||||
\ 'N': ['gray5', 'base03'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['scrollpercent'], {
|
||||
\ 'n': ['gray7', 'gray2'],
|
||||
\ 'N': ['base2', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], {
|
||||
\ 'n': ['base2', 'darkestblue', ['bold']],
|
||||
\ 'N': ['base1', 'base02', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['fileinfo.filepath'], {
|
||||
\ 'n': ['gray10'],
|
||||
\ 'N': ['gray5'],
|
||||
\ 'i': ['mediumcyan'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['static_str'], {
|
||||
\ 'n': ['base3', 'violet'],
|
||||
\ 'N': ['base1', 'base02'],
|
||||
\ 'i': ['white', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['fileinfo.flags'], {
|
||||
\ 'n': ['base03', ['bold']],
|
||||
\ 'N': ['gray5'],
|
||||
\ 'i': ['base03', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], {
|
||||
\ 'n': ['gray5', 'gray2'],
|
||||
\ 'i': ['mediumcyan', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lineinfo'], {
|
||||
\ 'n': ['gray2', 'gray10', ['bold']],
|
||||
\ 'N': ['gray7', 'gray1', ['bold']],
|
||||
\ 'i': ['darkestcyan', 'mediumcyan', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['errors'], {
|
||||
\ 'n': ['orange', 'base02', ['bold']],
|
||||
\ 'N': ['gray5', 'base03', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lineinfo.line.tot'], {
|
||||
\ 'n': ['gray6'],
|
||||
\ 'N': ['gray5'],
|
||||
\ 'i': ['darkestcyan'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], {
|
||||
\ 'n': ['base3', 'red', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], {
|
||||
\ 'n': ['base3', 'darkblue', ['bold']],
|
||||
\ 'N': ['base1', 'base03', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], {
|
||||
\ 'n': ['white', 'base02'],
|
||||
\ 'N': ['gray5', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], {
|
||||
\ 'n': ['white', 'base02'],
|
||||
\ 'N': ['white', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], {
|
||||
\ 'n': ['gray10', 'darkestblue', ['bold']],
|
||||
\ 'N': ['gray3', 'base02', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], {
|
||||
\ 'n': ['base3', 'blue'],
|
||||
\ 'N': ['gray5', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], {
|
||||
\ 'n': ['gray3', 'base02'],
|
||||
\ 'N': ['gray3', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], {
|
||||
\ 'n': ['green', 'base03'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], {
|
||||
\ 'n': ['green', 'base02'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:item'], {
|
||||
\ 'n': ['base2', 'darkestblue', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:marked'], {
|
||||
\ 'n': ['brightgreen', 'base03', ['bold']],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:count'], {
|
||||
\ 'n': ['base0', 'base03'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['ctrlp:SPLIT'], {
|
||||
\ 'n': ['white', 'base03'],
|
||||
\ }),
|
||||
\
|
||||
\ Pl#Hi#Segments(['status'], {
|
||||
\ 'n': ['green', 'base02'],
|
||||
\ 'N': ['gray5', 'base02'],
|
||||
\ }),
|
||||
\ ])
|
141
sources_forked/vim-powerline/autoload/Powerline/Functions.vim
Executable file
141
sources_forked/vim-powerline/autoload/Powerline/Functions.vim
Executable file
@ -0,0 +1,141 @@
|
||||
" Recalculate the trailing whitespace warning when idle, and after saving
|
||||
autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning
|
||||
|
||||
function! Powerline#Functions#GetFilepath() " {{{
|
||||
" Recalculate the filepath when cwd changes.
|
||||
let cwd = getcwd()
|
||||
if exists("b:Powerline_cwd") && cwd != b:Powerline_cwd
|
||||
unlet! b:Powerline_filepath
|
||||
endif
|
||||
let b:Powerline_cwd = cwd
|
||||
|
||||
if exists('b:Powerline_filepath')
|
||||
return b:Powerline_filepath
|
||||
endif
|
||||
|
||||
let dirsep = has('win32') && ! &shellslash ? '\' : '/'
|
||||
let filepath = expand('%:p')
|
||||
|
||||
if empty(filepath)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let ret = ''
|
||||
|
||||
if g:Powerline_stl_path_style == 'short'
|
||||
" Display a short path where the first directory is displayed with its
|
||||
" full name, and the subsequent directories are shortened to their
|
||||
" first letter, i.e. "/home/user/foo/foo/bar/baz.vim" becomes
|
||||
" "~/foo/f/b/baz.vim"
|
||||
"
|
||||
" This displays the shortest possible path, relative to ~ or the
|
||||
" current directory.
|
||||
let mod = (exists('+acd') && &acd) ? ':~:h' : ':~:.:h'
|
||||
let fpath = split(fnamemodify(filepath, mod), dirsep)
|
||||
let fpath_shortparts = map(fpath[1:], 'v:val[0]')
|
||||
let ret = join(extend([fpath[0]], fpath_shortparts), dirsep) . dirsep
|
||||
elseif g:Powerline_stl_path_style == 'relative'
|
||||
" Display a relative path, similar to the %f statusline item
|
||||
let ret = fnamemodify(filepath, ':~:.:h') . dirsep
|
||||
elseif g:Powerline_stl_path_style == 'full'
|
||||
" Display the full path, similar to the %F statusline item
|
||||
let ret = fnamemodify(filepath, ':h') . dirsep
|
||||
endif
|
||||
|
||||
if ret == ('.' . dirsep)
|
||||
let ret = ''
|
||||
endif
|
||||
|
||||
let b:Powerline_filepath = ret
|
||||
return ret
|
||||
endfunction " }}}
|
||||
function! Powerline#Functions#GetShortPath(threshold) " {{{
|
||||
let fullpath = split(substitute(expand('%:p:h'), $HOME, '~', 'g'), '/')
|
||||
|
||||
if len(fullpath) > a:threshold
|
||||
let fullpath = [fullpath[0], '…'] + fullpath[-a:threshold + 1 :]
|
||||
endif
|
||||
|
||||
return join(fullpath, '/')
|
||||
endfunction " }}}
|
||||
function! Powerline#Functions#GetMode() " {{{
|
||||
let mode = mode()
|
||||
|
||||
if mode ==# 'v'
|
||||
let mode = get(g:, "Powerline_mode_v", "VISUAL")
|
||||
elseif mode ==# 'V'
|
||||
let mode = get(g:, "Powerline_mode_V", "V⋅LINE")
|
||||
elseif mode ==# ''
|
||||
let mode = get(g:, "Powerline_mode_cv", "V⋅BLOCK")
|
||||
elseif mode ==# 's'
|
||||
let mode = get(g:, "Powerline_mode_s", "SELECT")
|
||||
elseif mode ==# 'S'
|
||||
let mode = get(g:, "Powerline_mode_S", "S⋅LINE")
|
||||
elseif mode ==# ''
|
||||
let mode = get(g:, "Powerline_mode_cs", "S⋅BLOCK")
|
||||
elseif mode =~# '\vi'
|
||||
let mode = get(g:, "Powerline_mode_i", "INSERT")
|
||||
elseif mode =~# '\v(R|Rv)'
|
||||
let mode = get(g:, "Powerline_mode_R", "REPLACE")
|
||||
else
|
||||
" Fallback to normal mode
|
||||
let mode = get(g:, "Powerline_mode_n", "NORMAL")
|
||||
endif
|
||||
|
||||
return mode
|
||||
endfunction " }}}
|
||||
function! Powerline#Functions#GetFilesize() " {{{
|
||||
let bytes = getfsize(expand("%:p"))
|
||||
|
||||
if bytes <= 0
|
||||
return ''
|
||||
endif
|
||||
|
||||
if bytes < 1024
|
||||
return bytes . 'B'
|
||||
else
|
||||
return (bytes / 1024) . 'kB'
|
||||
endif
|
||||
endfunction "}}}
|
||||
function! Powerline#Functions#GetCharCode() " {{{
|
||||
" Get the output of :ascii
|
||||
redir => ascii
|
||||
silent! ascii
|
||||
redir END
|
||||
|
||||
if match(ascii, 'NUL') != -1
|
||||
return 'NUL'
|
||||
endif
|
||||
|
||||
" Zero pad hex values
|
||||
let nrformat = '0x%02x'
|
||||
|
||||
let encoding = (&fenc == '' ? &enc : &fenc)
|
||||
|
||||
if encoding == 'utf-8'
|
||||
" Zero pad with 4 zeroes in unicode files
|
||||
let nrformat = '0x%04x'
|
||||
endif
|
||||
|
||||
" Get the character and the numeric value from the return value of :ascii
|
||||
" This matches the two first pieces of the return value, e.g.
|
||||
" "<F> 70" => char: 'F', nr: '70'
|
||||
let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)')
|
||||
|
||||
" Format the numeric value
|
||||
let nr = printf(nrformat, nr)
|
||||
|
||||
return "'". char ."' ". nr
|
||||
endfunction "}}}
|
||||
function! Powerline#Functions#GetWSMarker() " {{{
|
||||
" Return '...' if trailing white space is detected
|
||||
" Return '' otherwise
|
||||
if ! exists("b:statusline_trailing_space_warning")
|
||||
if search('\s$', 'nw') != 0
|
||||
let b:statusline_trailing_space_warning = ' … '
|
||||
else
|
||||
let b:statusline_trailing_space_warning = ''
|
||||
endif
|
||||
endif
|
||||
return b:statusline_trailing_space_warning
|
||||
endfunction " }}}
|
12
sources_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim
Executable file
12
sources_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim
Executable file
@ -0,0 +1,12 @@
|
||||
function! Powerline#Functions#ft_man#GetName() " {{{
|
||||
let matches = matchlist(getline(1), '\v^([a-zA-Z_\.\-]+)\((\d+)\)')
|
||||
|
||||
if ! len(matches)
|
||||
return 'n/a'
|
||||
endif
|
||||
|
||||
let file = tolower(matches[1])
|
||||
let num = matches[2]
|
||||
|
||||
return file
|
||||
endfunction " }}}
|
7
sources_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim
Executable file
7
sources_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim
Executable file
@ -0,0 +1,7 @@
|
||||
function! Powerline#Functions#fugitive#GetBranch(symbol) " {{{
|
||||
let ret = fugitive#statusline()
|
||||
|
||||
let ret = substitute(ret, '\c\v\[?GIT\(([a-z0-9\-_\./:]+)\)\]?', a:symbol .' \1', 'g')
|
||||
|
||||
return ret
|
||||
endfunction " }}}
|
17
sources_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim
Executable file
17
sources_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim
Executable file
@ -0,0 +1,17 @@
|
||||
function! Powerline#Functions#hgrev#Status(symbol) " {{{
|
||||
if ! exists('*HGRev')
|
||||
" HGRev hasn't been loaded yet
|
||||
return ''
|
||||
endif
|
||||
if !exists("b:statusline_hg_status")
|
||||
silent execute "RefreshMercurialRev"
|
||||
endif
|
||||
let b:statusline_hg_status=HGRev()
|
||||
if b:statusline_hg_status != '-'
|
||||
let ret = "\u26A1". '' . substitute(b:statusline_hg_status, '^[^ ]*', '\1', 'g')
|
||||
let ret=substitute(ret,' M$','+','g')
|
||||
else
|
||||
let ret=''
|
||||
endif
|
||||
return ret
|
||||
endfunction " }}}
|
16
sources_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim
Executable file
16
sources_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim
Executable file
@ -0,0 +1,16 @@
|
||||
function! Powerline#Functions#syntastic#GetErrors(line_symbol) " {{{
|
||||
if ! exists('g:syntastic_stl_format')
|
||||
" Syntastic hasn't been loaded yet
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Temporarily change syntastic output format
|
||||
let old_stl_format = g:syntastic_stl_format
|
||||
let g:syntastic_stl_format = '%E{ ERRORS (%e) '. a:line_symbol .' %fe }%W{ WARNINGS (%w) '. a:line_symbol .' %fw }'
|
||||
|
||||
let ret = SyntasticStatuslineFlag()
|
||||
|
||||
let g:syntastic_stl_format = old_stl_format
|
||||
|
||||
return ret
|
||||
endfunction " }}}
|
13
sources_forked/vim-powerline/autoload/Powerline/Matches.vim
Executable file
13
sources_forked/vim-powerline/autoload/Powerline/Matches.vim
Executable file
@ -0,0 +1,13 @@
|
||||
let g:Powerline#Matches#matches = {
|
||||
\ 'command_t' : Pl#Match#Add('bufname("%")', 'GoToFile'),
|
||||
\ 'bt_help' : Pl#Match#Add('&bt' , 'help'),
|
||||
\ 'ft_man' : Pl#Match#Add('&ft' , 'man'),
|
||||
\ 'ft_qf' : Pl#Match#Add('&ft' , 'qf'),
|
||||
\ 'ft_vimpager' : Pl#Match#Add('&ft' , 'vimpager'),
|
||||
\ 'gundo_preview' : Pl#Match#Add('bufname("%")', '__Gundo_Preview__'),
|
||||
\ 'gundo_tree' : Pl#Match#Add('bufname("%")', '__Gundo__'),
|
||||
\ 'lustyexplorer' : Pl#Match#Add('bufname("%")', '\[LustyExplorer-Buffers\]'),
|
||||
\ 'minibufexplorer' : Pl#Match#Add('bufname("%")', '\-MiniBufExplorer\-'),
|
||||
\ 'tagbar' : Pl#Match#Add('&ft' , 'tagbar'),
|
||||
\ 'nerdtree' : Pl#Match#Add('&ft' , 'nerdtree'),
|
||||
\ }
|
30
sources_forked/vim-powerline/autoload/Powerline/Segments.vim
Executable file
30
sources_forked/vim-powerline/autoload/Powerline/Segments.vim
Executable file
@ -0,0 +1,30 @@
|
||||
let g:Powerline#Segments#segments = Pl#Segment#Init([
|
||||
\ Pl#Segment#Create('SPLIT' , '__split__'),
|
||||
\ Pl#Segment#Create('TRUNCATE', '__truncate__'),
|
||||
\
|
||||
\ Pl#Segment#Create('paste_indicator' , '%{&paste ? "PASTE" : ""}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('mode_indicator' , '%{Powerline#Functions#GetMode()}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('fileinfo',
|
||||
\ Pl#Segment#Create('flags.ro' , '%{&readonly ? "$RO" : ""}'),
|
||||
\ Pl#Segment#Create('filepath' , '%{Powerline#Functions#GetFilepath()}', Pl#Segment#NoPadding()),
|
||||
\ Pl#Segment#Create('filename' , '%t'),
|
||||
\ Pl#Segment#Create('flags.mod' , '%M'),
|
||||
\ Pl#Segment#Create('flags.type' , '%H%W'),
|
||||
\ ),
|
||||
\ Pl#Segment#Create('filename' , '%t'),
|
||||
\ Pl#Segment#Create('filesize' , '%{Powerline#Functions#GetFilesize()}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('pwd' , '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'),
|
||||
\ Pl#Segment#Create('static_str' , '%%{"%s"}'),
|
||||
\ Pl#Segment#Create('raw' , '%s'),
|
||||
\ Pl#Segment#Create('fileformat' , '%{&fileformat}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('fileencoding' , '%{(&fenc == "" ? &enc : &fenc)}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('filetype' , '%{strlen(&ft) ? &ft : "no ft"}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('scrollpercent' , '%3p%%'),
|
||||
\ Pl#Segment#Create('lineinfo',
|
||||
\ Pl#Segment#Create('line.cur' , '$LINE %3l'),
|
||||
\ Pl#Segment#Create('line.tot' , ':%-2v', Pl#Segment#NoPadding()),
|
||||
\ ),
|
||||
\ Pl#Segment#Create('charcode' , '%{Powerline#Functions#GetCharCode()}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('ws_marker' , '%{Powerline#Functions#GetWSMarker()}', Pl#Segment#Modes('!N')),
|
||||
\ ])
|
20
sources_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim
Executable file
20
sources_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim
Executable file
@ -0,0 +1,20 @@
|
||||
if !exists("g:Powerline#Segments#ctrlp#segments#focus ")
|
||||
let g:Powerline#Segments#ctrlp#segments#focus = '%{"%0"}'
|
||||
endif
|
||||
if !exists("g:Powerline#Segments#ctrlp#segments#prev ")
|
||||
let g:Powerline#Segments#ctrlp#segments#prev = '%-3{"%3"}'
|
||||
endif
|
||||
if !exists("g:Powerline#Segments#ctrlp#segments#next ")
|
||||
let g:Powerline#Segments#ctrlp#segments#next = '%-3{"%5"}'
|
||||
endif
|
||||
|
||||
let g:Powerline#Segments#ctrlp#segments = Pl#Segment#Init(['ctrlp'
|
||||
\ , Pl#Segment#Create('focus', g:Powerline#Segments#ctrlp#segments#focus)
|
||||
\ , Pl#Segment#Create('byfname', '%{"%1"}')
|
||||
\ , Pl#Segment#Create('prev', g:Powerline#Segments#ctrlp#segments#prev)
|
||||
\ , Pl#Segment#Create('item', '%-9{"%4"}')
|
||||
\ , Pl#Segment#Create('next', g:Powerline#Segments#ctrlp#segments#next)
|
||||
\ , Pl#Segment#Create('marked', '%{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)}')
|
||||
\
|
||||
\ , Pl#Segment#Create('count', '%-6{"%0"}')
|
||||
\ ])
|
3
sources_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim
Executable file
3
sources_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim
Executable file
@ -0,0 +1,3 @@
|
||||
let g:Powerline#Segments#ft_man#segments = Pl#Segment#Init(['ft_man',
|
||||
\ Pl#Segment#Create('filename', '%{Powerline#Functions#ft_man#GetName()}')
|
||||
\ ])
|
5
sources_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim
Executable file
5
sources_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim
Executable file
@ -0,0 +1,5 @@
|
||||
let g:Powerline#Segments#fugitive#segments = Pl#Segment#Init(['fugitive',
|
||||
\ (exists('g:loaded_fugitive') && g:loaded_fugitive == 1),
|
||||
\
|
||||
\ Pl#Segment#Create('branch', '%{Powerline#Functions#fugitive#GetBranch("$BRANCH")}')
|
||||
\ ])
|
4
sources_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim
Executable file
4
sources_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim
Executable file
@ -0,0 +1,4 @@
|
||||
let g:Powerline#Segments#hgrev#segments = Pl#Segment#Init(['hgrev',
|
||||
\ (exists('hgrev_loaded')),
|
||||
\ Pl#Segment#Create('branch', '%{Powerline#Functions#hgrev#Status("$BRANCH")}')
|
||||
\ ])
|
6
sources_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim
Executable file
6
sources_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim
Executable file
@ -0,0 +1,6 @@
|
||||
let g:Powerline#Segments#rvm#segments = Pl#Segment#Init(['rvm',
|
||||
\ (exists('g:loaded_rvm') && g:loaded_rvm == 1),
|
||||
\
|
||||
\ Pl#Segment#Create('string', '%{rvm#string()}'),
|
||||
\ Pl#Segment#Create('statusline', '%{rvm#statusline()}')
|
||||
\ ])
|
5
sources_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim
Executable file
5
sources_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim
Executable file
@ -0,0 +1,5 @@
|
||||
let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init(['syntastic',
|
||||
\ (exists('g:loaded_syntastic_plugin') && g:loaded_syntastic_plugin == 1),
|
||||
\
|
||||
\ Pl#Segment#Create('errors', '%{Powerline#Functions#syntastic#GetErrors("$LINE")}', Pl#Segment#Modes('!N'))
|
||||
\ ])
|
6
sources_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim
Executable file
6
sources_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim
Executable file
@ -0,0 +1,6 @@
|
||||
let g:Powerline#Segments#tagbar#segments = Pl#Segment#Init(['tagbar',
|
||||
\ (exists(':Tagbar') > 0),
|
||||
\
|
||||
\ Pl#Segment#Create('currenttag', '%{tagbar#currenttag("%s", "")}', Pl#Segment#Modes('!N')),
|
||||
\ Pl#Segment#Create('fullcurrenttag', '%{tagbar#currenttag("%s", "", "f")}', Pl#Segment#Modes('!N'))
|
||||
\ ])
|
5
sources_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim
Executable file
5
sources_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim
Executable file
@ -0,0 +1,5 @@
|
||||
let g:Powerline#Segments#virtualenv#segments = Pl#Segment#Init(['virtualenv',
|
||||
\ has('python') && (exists('g:virtualenv_loaded') && g:virtualenv_loaded == 1),
|
||||
\
|
||||
\ Pl#Segment#Create('statusline', '%{virtualenv#statusline()}')
|
||||
\ ])
|
116
sources_forked/vim-powerline/autoload/Powerline/Themes/default.vim
Executable file
116
sources_forked/vim-powerline/autoload/Powerline/Themes/default.vim
Executable file
@ -0,0 +1,116 @@
|
||||
let g:Powerline#Themes#default#theme = Pl#Theme#Create(
|
||||
\ Pl#Theme#Buffer(''
|
||||
\ , 'paste_indicator'
|
||||
\ , 'mode_indicator'
|
||||
\ , 'fugitive:branch'
|
||||
\ , 'hgrev:branch'
|
||||
\ , 'fileinfo'
|
||||
\ , 'syntastic:errors'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , 'tagbar:currenttag'
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'rvm:string'
|
||||
\ , 'virtualenv:statusline'
|
||||
\ , 'fileformat'
|
||||
\ , 'fileencoding'
|
||||
\ , 'filetype'
|
||||
\ , 'scrollpercent'
|
||||
\ , 'lineinfo'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('command_t'
|
||||
\ , ['static_str.name', 'Command-T']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , ['raw.line', '%10(Match #%l%)']
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree')
|
||||
\ , ['static_str.name', 'Gundo']
|
||||
\ , ['static_str.buffer', 'Undo tree']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview')
|
||||
\ , ['static_str.name', 'Gundo']
|
||||
\ , ['static_str.buffer', 'Diff preview']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('bt_help'
|
||||
\ , ['static_str.name', 'Help']
|
||||
\ , 'filename'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'scrollpercent'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ft_vimpager'
|
||||
\ , ['static_str.name', 'Pager']
|
||||
\ , 'filename'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'scrollpercent'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('lustyexplorer'
|
||||
\ , ['static_str.name', 'LustyExplorer']
|
||||
\ , ['static_str.buffer', 'Buffer list']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ft_man'
|
||||
\ , ['static_str.name', 'Man page']
|
||||
\ , 'filename'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'scrollpercent'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('minibufexplorer'
|
||||
\ , ['static_str.name', 'MiniBufExplorer']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ft_qf'
|
||||
\ , ['static_str.name', 'Quickfix']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('tagbar'
|
||||
\ , ['static_str.name', 'Tagbar']
|
||||
\ , ['static_str.buffer', 'Tree']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"')
|
||||
\ , 'ctrlp:prev'
|
||||
\ , 'ctrlp:item'
|
||||
\ , 'ctrlp:next'
|
||||
\ , 'ctrlp:marked'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'ctrlp:focus'
|
||||
\ , 'ctrlp:byfname'
|
||||
\ , 'pwd'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"')
|
||||
\ , 'ctrlp:count'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'pwd'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('nerdtree'
|
||||
\ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ )
|
||||
\ )
|
116
sources_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim
Executable file
116
sources_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim
Executable file
@ -0,0 +1,116 @@
|
||||
" Disabled:
|
||||
" Add the following line into the first theme group to see the highlight
|
||||
" group
|
||||
" \ , 'currhigroup'
|
||||
"
|
||||
" Line info taken out - I know which line number I'm on from the gutter
|
||||
"\ , 'lineinfo'
|
||||
let g:Powerline#Themes#skwp#theme = Pl#Theme#Create(
|
||||
\ Pl#Theme#Buffer(''
|
||||
\ , 'fugitive:branch'
|
||||
\ , 'fileinfo'
|
||||
\ , 'flags.mod'
|
||||
\ , 'syntastic:errors'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'sass:status'
|
||||
\ , 'rvm:string'
|
||||
\ , 'paste_indicator'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('command_t'
|
||||
\ , ['static_str.name', 'Command-T']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , ['raw.line', '%10(Match #%l%)']
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree')
|
||||
\ , ['static_str.name', 'Gundo']
|
||||
\ , ['static_str.buffer', 'Undo tree']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview')
|
||||
\ , ['static_str.name', 'Gundo']
|
||||
\ , ['static_str.buffer', 'Diff preview']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('bt_help'
|
||||
\ , ['static_str.name', 'Help']
|
||||
\ , 'filename'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'scrollpercent'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ft_vimpager'
|
||||
\ , ['static_str.name', 'Pager']
|
||||
\ , 'filename'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'scrollpercent'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('lustyexplorer'
|
||||
\ , ['static_str.name', 'LustyExplorer']
|
||||
\ , ['static_str.buffer', 'Buffer list']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ft_man'
|
||||
\ , ['static_str.name', 'Man page']
|
||||
\ , 'filename'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'scrollpercent'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('minibufexplorer'
|
||||
\ , ['static_str.name', 'MiniBufExplorer']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ft_qf'
|
||||
\ , ['static_str.name', 'Quickfix']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('tagbar'
|
||||
\ , ['static_str.name', 'Tagbar']
|
||||
\ , ['static_str.buffer', 'Tree']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"')
|
||||
\ , 'ctrlp:prev'
|
||||
\ , 'ctrlp:item'
|
||||
\ , 'ctrlp:next'
|
||||
\ , 'ctrlp:marked'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'ctrlp:focus'
|
||||
\ , 'ctrlp:byfname'
|
||||
\ , 'pwd'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"')
|
||||
\ , 'ctrlp:count'
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ , 'pwd'
|
||||
\ ),
|
||||
\
|
||||
\ Pl#Theme#Buffer('nerdtree'
|
||||
\ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}']
|
||||
\ , Pl#Segment#Truncate()
|
||||
\ , Pl#Segment#Split()
|
||||
\ )
|
||||
\ )
|
429
sources_forked/vim-powerline/doc/Powerline.txt
Executable file
429
sources_forked/vim-powerline/doc/Powerline.txt
Executable file
@ -0,0 +1,429 @@
|
||||
*Powerline.txt* For Vim version 7.3. Last change: 2011 Nov 23
|
||||
|
||||
______
|
||||
_________ \ /__
|
||||
\_____ \______ _ _____________ / /'__' ___ ____
|
||||
| ___/ _ \ \/ \/ / __ \_ ___\ / | |/ \_/ __ \
|
||||
| | | (_) \ _ / ___/| | / /__| | | \ ___/
|
||||
'___' \____/ \/ \/ \___ |__' /___ /'__'__| /\___ \
|
||||
\/ / / \/ \/
|
||||
| /
|
||||
|/
|
||||
'
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *Powerline-contents*
|
||||
|
||||
1. Introduction ....................... |Powerline-introduction|
|
||||
2. Usage .............................. |Powerline-usage|
|
||||
3. Requirements ....................... |Powerline-requirements|
|
||||
3.1 Recommended settings ........... |Powerline-recommended-settings|
|
||||
4. Configuration ...................... |Powerline-configuration|
|
||||
4.1 Powerline_cache_file ........... |Powerline_cache_file|
|
||||
4.1.1 Clearing the cache ....... |:PowerlineClearCache|
|
||||
4.2 Powerline_cache_enabled ........ |Powerline_cache_enabled|
|
||||
4.3 Powerline_symbols .............. |Powerline_symbols|
|
||||
4.3.1 Compatible symbols ....... |Powerline-symbols-compatible|
|
||||
4.3.2 Fancy symbols ............ |Powerline-symbols-fancy|
|
||||
4.3.3 Overriding symbols ....... |Powerline_symbols_override|
|
||||
4.3.4 Overriding dividers ...... |Powerline_dividers_override|
|
||||
4.4 Powerline_theme ................ |Powerline_theme|
|
||||
4.5 Powerline_colorscheme .......... |Powerline_colorscheme|
|
||||
4.6 Powerline_stl_path_style ....... |Powerline_stl_path_style|
|
||||
5. Fonts .............................. |Powerline-fonts|
|
||||
6. Customization ...................... |Powerline-customization|
|
||||
6.1 Basic customization ............ |Powerline-basic-customization|
|
||||
6.2 Advanced customization ......... |Powerline-advanced-customization|
|
||||
6.2.1 Colorschemes ............. |Powerline-cust-colorschemes|
|
||||
6.2.2 Functions ................ |Powerline-cust-functions|
|
||||
6.2.3 Segments ................. |Powerline-cust-segments|
|
||||
6.2.4 Themes ................... |Powerline-cust-themes|
|
||||
7. License ............................ |Powerline-license|
|
||||
8. Known issues ....................... |Powerline-known-issues|
|
||||
9. Contributing ....................... |Powerline-contributing|
|
||||
|
||||
==============================================================================
|
||||
1. Introduction *Powerline* *Powerline-introduction*
|
||||
|
||||
Powerline is a utility plugin which allows you to create better-looking, more
|
||||
functional Vim statuslines.
|
||||
|
||||
==============================================================================
|
||||
2. Usage *Powerline-usage*
|
||||
|
||||
Powerline is automatically enabled when it's installed, either by unzipping
|
||||
the provided archive or by adding it as a Pathogen/Vundle bundle.
|
||||
|
||||
Powerline replaces the standard Vim 'statusline' with a custom statusline made
|
||||
up of Powerline segments.
|
||||
|
||||
Powerline ignores any 'statusline' customizations you have defined in your
|
||||
|vimrc|. If you remove Powerline, your 'statusline' customizations are
|
||||
restored.
|
||||
|
||||
==============================================================================
|
||||
3. Requirements *Powerline-requirements*
|
||||
|
||||
Powerline has been developed and tested in Vim 7.3, but it should run without
|
||||
any problems in Vim 7.2. The default configuration requires a Unix-like system
|
||||
to work properly.
|
||||
|
||||
The plugin only works with Vim running in an 88/256-color terminal or Gvim.
|
||||
|
||||
Vi-compatible mode must be disabled.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.1 Recommended settings *Powerline-recommended-settings*
|
||||
|
||||
The following configuration options should be set in your |vimrc|: >
|
||||
|
||||
set nocompatible " Disable vi-compatibility
|
||||
set laststatus=2 " Always show the statusline
|
||||
set encoding=utf-8 " Necessary to show Unicode glyphs
|
||||
|
||||
Note: If you're using an 88/256-color terminal but still don't see the colored
|
||||
statusline, you may have to set the following option as well: >
|
||||
|
||||
set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors
|
||||
|
||||
==============================================================================
|
||||
4. Configuration *Powerline-configuration*
|
||||
|
||||
Powerline will work fine without any user configuration, but default behavior
|
||||
can be overridden by setting configuration variables globally in your |vimrc|
|
||||
file.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.1 Powerline_cache_file *Powerline_cache_file*
|
||||
|
||||
By default Powerline caches all the statuslines and colors in a cache file in
|
||||
the plugin's directory (or the Vim directory, depending on the installation
|
||||
method used).
|
||||
|
||||
It's recommended that you enable the cache, as this dramatically improves Vim
|
||||
startup time after the cache file has been generated (the plugin usually loads
|
||||
within ~100ms without the cache and ~1ms with the cache).
|
||||
|
||||
Note: The default cache filename includes the current theme, colorscheme and
|
||||
symbol settings in order to tie the cache file to your current configuration,
|
||||
so the cache file will be regenerated when you change any settings. This may
|
||||
leave several old cache files in your Vim folder, and these may safely be
|
||||
deleted.
|
||||
|
||||
Defaults: "<plugin_directory>/Powerline_<theme>_<colorscheme>_<symbols>.cache"
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.1.1 Clearing the cache *:PowerlineClearCache*
|
||||
|
||||
Powerline provides a command to easily clear the cache after changing your
|
||||
settings or updating your theme. Simply run the following command to clear
|
||||
your cache, and restart Vim afterwards: >
|
||||
|
||||
:PowerlineClearCache
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
4.2 Powerline_cache_enabled *Powerline_cache_enabled*
|
||||
|
||||
It's possible to disable statusline caching by setting this option to 0. This
|
||||
is mostly useful when developing statuslines.
|
||||
|
||||
Example: >
|
||||
|
||||
let g:Powerline_cache_enabled = 0
|
||||
<
|
||||
|
||||
Default: 1
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3 Powerline_symbols *Powerline_symbols*
|
||||
|
||||
This option defines which set of symbols and dividers you want to use. There
|
||||
are currently three available options: "compatible", "unicode" and "fancy".
|
||||
|
||||
TYPE DESCRIPTION ~
|
||||
compatible Doesn't use any special characters.
|
||||
unicode Simulates icons and arrows using similar Unicode glyphs.
|
||||
fancy Custom icons and arrows. Requires a patched font.
|
||||
|
||||
Example: >
|
||||
|
||||
let g:Powerline_symbols = 'fancy'
|
||||
<
|
||||
|
||||
Default: "compatible"
|
||||
|
||||
Symbols can be inserted into statuslines by using the following variables
|
||||
(just insert the variables as text in your segments):
|
||||
|
||||
VARIABLE DESCRIPTION ~
|
||||
$BRANCH Inserts a branch symbol
|
||||
$RO Inserts a read-only symbol
|
||||
$FT Inserts a filetype symbol
|
||||
$LINE Inserts a line number symbol
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3.1 Compatible symbols *Powerline-symbols-compatible*
|
||||
|
||||
These symbols will work in any configuration, and do not require a special
|
||||
font to work. This option will replace the fancy icons with plain text, and
|
||||
the pointy dividers with straight lines.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3.2 Fancy symbols *Powerline-symbols-fancy*
|
||||
|
||||
These symbols require a custom font to work. A font patcher is provided for
|
||||
adding the required symbols to any outline font and some bitmap fonts, see
|
||||
|Powerline-fonts| and the provided README file for usage details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3.3 Overriding symbols *Powerline_symbols_override*
|
||||
|
||||
You can override symbols by adding your symbols to the
|
||||
g:Powerline_symbols_override dictionary. Example: If you want the branch
|
||||
symbol to be "∓" (hex code 0x2213) and the line symbol to be "L" you can add
|
||||
the following to your |vimrc|: >
|
||||
|
||||
let g:Powerline_symbols_override = {
|
||||
\ 'BRANCH': [0x2213],
|
||||
\ 'LINE': 'L',
|
||||
\ }
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
4.3.4 Overriding dividers *Powerline_dividers_override*
|
||||
|
||||
If you for some reason want to override the dividers then you can set
|
||||
g:Powerline_dividers_override to a list with exactly four elements:
|
||||
|
||||
1: Hard right-pointing arrow
|
||||
2: Soft right-pointing arrow
|
||||
3: Hard left-pointing arrow
|
||||
4: Soft left-pointing arrow
|
||||
|
||||
Example: >
|
||||
|
||||
let g:Powerline_dividers_override = ['>>', '>', '<<', '<']
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3.5 Overriding mode names *Powerline_mode*
|
||||
|
||||
You can change the names used for modes at the far left by setting some
|
||||
variables in your |vimrc|. For example you can change "N" to "NORMAL" with: >
|
||||
|
||||
let g:Powerline_mode_n = 'NORMAL'
|
||||
<
|
||||
The variables are all named beginning with 'g:Powerline_mode_', as follows:
|
||||
|
||||
mode name default note ~
|
||||
Normal n ' N ' (surrounded by spaces)
|
||||
Insert i INSERT
|
||||
Replace R REPLACE |Replace-mode|
|
||||
Visual v VISUAL |Visual-mode|
|
||||
Visual linewise V V⋅LINE
|
||||
Visual blockwise cv V⋅BLOCK
|
||||
Select s SELECT |Select-mode|
|
||||
Select linewise S S⋅LINE
|
||||
Select blockwise cs S⋅BLOCK
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
4.4 Powerline_theme *Powerline_theme*
|
||||
|
||||
This option defines the theme Powerline uses. The available themes are located
|
||||
in autoload/Powerline/Themes/. A theme is a pre-defined set of Powerline
|
||||
segments which make up the statusline.
|
||||
|
||||
Example: >
|
||||
|
||||
let g:Powerline_theme = 'skwp'
|
||||
<
|
||||
|
||||
Default: "default"
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.5 Powerline_colorscheme *Powerline_colorscheme*
|
||||
|
||||
This option defines the colorscheme Powerline uses. The available colorschemes
|
||||
are located in autoload/Powerline/Colorschemes/.
|
||||
|
||||
Example: >
|
||||
|
||||
let g:Powerline_colorscheme = 'skwp'
|
||||
<
|
||||
|
||||
Default: "default"
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.6 Powerline_stl_path_style *Powerline_stl_path_style*
|
||||
|
||||
There are currently four ways to display the current path and file name. The
|
||||
default is to only display the file name like the %t statusline item. By
|
||||
setting this configuration value you can choose from the following ways
|
||||
display the current path and file name:
|
||||
|
||||
VALUE DESCRIPTION ~
|
||||
filename Display only the file name using the %t statusline item.
|
||||
short Display a short path. The home directory is substituted with
|
||||
"~", the first directory is displayed with its full name, and
|
||||
subsequent directories are shortened to their first letter.
|
||||
I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and
|
||||
"long/relative/path/foo/bar/baz.vim becomes
|
||||
"long/r/p/f/b/baz.vim".
|
||||
relative Display a relative path, similar to the %f statusline item.
|
||||
full Display the full path, similar to the %F statusline item.
|
||||
|
||||
Example: >
|
||||
|
||||
let g:Powerline_stl_path_style = 'full'
|
||||
<
|
||||
|
||||
Default: "relative"
|
||||
|
||||
==============================================================================
|
||||
5. Fonts *Powerline-fonts*
|
||||
|
||||
TODO
|
||||
|
||||
==============================================================================
|
||||
6. Customization *Powerline-customization*
|
||||
|
||||
There are currently two ways of customizing Powerline: Basic customization
|
||||
using a couple of functions to insert and remove existing segments from the
|
||||
statusline, and advanced customization using your own autoload files. The
|
||||
customization features of Powerline allow you to create your own statuslines
|
||||
without ever touching the original source code.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.1 Basic customization *Powerline-basic-customization*
|
||||
|
||||
Powerline provides the following functions to alter the default statusline
|
||||
look. These functions should be called from your |vimrc| file or another file
|
||||
which is sourced at Vim startup.
|
||||
|
||||
Note: These functions are currently applied to all statuslines, so if you
|
||||
insert a segment after a segment which is present in many statuslines (e.g.
|
||||
the "filename" segment), all the statuslines will have the inserted segment.
|
||||
This behavior may be changed in a future version of Powerline.
|
||||
|
||||
Note: Remember to clear your cache with |:PowerlineClearCache| after changing
|
||||
your statusline!
|
||||
|
||||
Example: >
|
||||
|
||||
" Insert the charcode segment after the filetype segment
|
||||
call Pl#Theme#InsertSegment('charcode', 'after', 'filetype')
|
||||
|
||||
" Replace the scrollpercent segment with the charcode segment
|
||||
call Pl#Theme#ReplaceSegment('scrollpercent', 'fileinfo')
|
||||
<
|
||||
*Pl#Theme#InsertSegment*
|
||||
Pl#Theme#InsertSegment({newsegment}, {location}, {targetsegment})
|
||||
|
||||
This function inserts {newsegment} before or after {targetsegment}. The
|
||||
{location} parameter specifies the location of the new segment, valid values
|
||||
are "before" and "after". You can see all the available segments in
|
||||
autoload/Powerline/Segments.vim and the files specified in
|
||||
|Powerline-cust-segments|.
|
||||
|
||||
Pl#Theme#RemoveSegment({targetsegment}) *Pl#Theme#RemoveSegment*
|
||||
|
||||
This function removes the {targetsegment} segment entirely.
|
||||
|
||||
Pl#Theme#ReplaceSegment({oldsegment}, {newsegment}) *Pl#Theme#ReplaceSegment*
|
||||
|
||||
This function replaces {oldsegment} with {newsegment}.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.2 Advanced customization *Powerline-advanced-customization*
|
||||
|
||||
Because Powerline utilizes Vim's autoload functionality, you can easily create
|
||||
your own segments, themes, functions and colorschemes without touching the
|
||||
original source code. This is a bit more complex than using the utility
|
||||
functions, but it allows you to do a lot more with your statusline.
|
||||
|
||||
Your custom autoload files should be stored in your |runtimepath| (usually in
|
||||
"~/.vim/autoload/Powerline/*").
|
||||
|
||||
Note: Remember to clear your cache with |:PowerlineClearCache| after changing
|
||||
your statusline!
|
||||
|
||||
6.2.1 Colorschemes *Powerline-cust-colorschemes*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Colorschemes should be stored as separate files in
|
||||
{runtimepath}/autoload/Powerline/Colorschemes/.
|
||||
|
||||
SYNTAX ~
|
||||
|
||||
TODO
|
||||
|
||||
EXAMPLE ~
|
||||
|
||||
TODO
|
||||
|
||||
6.2.2 Functions *Powerline-cust-functions*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Functions should be stored as separate files in
|
||||
{runtimepath}/autoload/Powerline/Functions/.
|
||||
|
||||
SYNTAX ~
|
||||
|
||||
TODO
|
||||
|
||||
EXAMPLE ~
|
||||
|
||||
TODO
|
||||
|
||||
6.2.3 Segments *Powerline-cust-segments*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Segments should be stored as separate files in
|
||||
{runtimepath}/autoload/Powerline/Segments/.
|
||||
|
||||
SYNTAX ~
|
||||
|
||||
TODO
|
||||
|
||||
EXAMPLE ~
|
||||
|
||||
TODO
|
||||
|
||||
6.2.4 Themes *Powerline-cust-themes*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Themes should be stored as separate files in
|
||||
{runtimepath}/autoload/Powerline/Themes/.
|
||||
|
||||
SYNTAX ~
|
||||
|
||||
TODO
|
||||
|
||||
EXAMPLE ~
|
||||
|
||||
TODO
|
||||
|
||||
==============================================================================
|
||||
7. License *Powerline-license*
|
||||
|
||||
Creative Commons Attribution-ShareAlike 3.0 Unported
|
||||
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
==============================================================================
|
||||
8. Known issues *Powerline-known-issues*
|
||||
|
||||
See the issue tracker at
|
||||
https://github.com/Lokaltog/vim-powerline/issues
|
||||
|
||||
==============================================================================
|
||||
9. Contributing *Powerline-contributing*
|
||||
|
||||
If you experience any bugs or have feature requests, please open an issue on
|
||||
GitHub. Fork the source repository on GitHub and send a pull request if you
|
||||
have any code improvements.
|
||||
|
||||
Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
||||
Source repository: https://github.com/Lokaltog/vim-powerline
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:sw=4:ts=8:ft=help:norl:
|
34
sources_forked/vim-powerline/doc/tags
Normal file
34
sources_forked/vim-powerline/doc/tags
Normal file
@ -0,0 +1,34 @@
|
||||
:PowerlineClearCache Powerline.txt /*:PowerlineClearCache*
|
||||
Pl#Theme#InsertSegment Powerline.txt /*Pl#Theme#InsertSegment*
|
||||
Pl#Theme#RemoveSegment Powerline.txt /*Pl#Theme#RemoveSegment*
|
||||
Pl#Theme#ReplaceSegment Powerline.txt /*Pl#Theme#ReplaceSegment*
|
||||
Powerline Powerline.txt /*Powerline*
|
||||
Powerline-advanced-customization Powerline.txt /*Powerline-advanced-customization*
|
||||
Powerline-basic-customization Powerline.txt /*Powerline-basic-customization*
|
||||
Powerline-configuration Powerline.txt /*Powerline-configuration*
|
||||
Powerline-contents Powerline.txt /*Powerline-contents*
|
||||
Powerline-contributing Powerline.txt /*Powerline-contributing*
|
||||
Powerline-cust-colorschemes Powerline.txt /*Powerline-cust-colorschemes*
|
||||
Powerline-cust-functions Powerline.txt /*Powerline-cust-functions*
|
||||
Powerline-cust-segments Powerline.txt /*Powerline-cust-segments*
|
||||
Powerline-cust-themes Powerline.txt /*Powerline-cust-themes*
|
||||
Powerline-customization Powerline.txt /*Powerline-customization*
|
||||
Powerline-fonts Powerline.txt /*Powerline-fonts*
|
||||
Powerline-introduction Powerline.txt /*Powerline-introduction*
|
||||
Powerline-known-issues Powerline.txt /*Powerline-known-issues*
|
||||
Powerline-license Powerline.txt /*Powerline-license*
|
||||
Powerline-recommended-settings Powerline.txt /*Powerline-recommended-settings*
|
||||
Powerline-requirements Powerline.txt /*Powerline-requirements*
|
||||
Powerline-symbols-compatible Powerline.txt /*Powerline-symbols-compatible*
|
||||
Powerline-symbols-fancy Powerline.txt /*Powerline-symbols-fancy*
|
||||
Powerline-usage Powerline.txt /*Powerline-usage*
|
||||
Powerline.txt Powerline.txt /*Powerline.txt*
|
||||
Powerline_cache_enabled Powerline.txt /*Powerline_cache_enabled*
|
||||
Powerline_cache_file Powerline.txt /*Powerline_cache_file*
|
||||
Powerline_colorscheme Powerline.txt /*Powerline_colorscheme*
|
||||
Powerline_dividers_override Powerline.txt /*Powerline_dividers_override*
|
||||
Powerline_mode Powerline.txt /*Powerline_mode*
|
||||
Powerline_stl_path_style Powerline.txt /*Powerline_stl_path_style*
|
||||
Powerline_symbols Powerline.txt /*Powerline_symbols*
|
||||
Powerline_symbols_override Powerline.txt /*Powerline_symbols_override*
|
||||
Powerline_theme Powerline.txt /*Powerline_theme*
|
319
sources_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd
Executable file
319
sources_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd
Executable file
@ -0,0 +1,319 @@
|
||||
SplineFontDB: 3.0
|
||||
FontName: PowerlineSymbols
|
||||
FullName: PowerlineSymbols
|
||||
FamilyName: PowerlineSymbols
|
||||
Weight: Medium
|
||||
Copyright:
|
||||
UComments: "2011-11-21: Created."
|
||||
Version: 001.000
|
||||
ItalicAngle: 0
|
||||
UnderlinePosition: -98.6328
|
||||
UnderlineWidth: 48.8281
|
||||
Ascent: 800
|
||||
Descent: 200
|
||||
LayerCount: 2
|
||||
Layer: 0 0 "Back" 1
|
||||
Layer: 1 0 "Fore" 0
|
||||
XUID: [1021 211 26716215 11021609]
|
||||
FSType: 0
|
||||
OS2Version: 0
|
||||
OS2_WeightWidthSlopeOnly: 0
|
||||
OS2_UseTypoMetrics: 1
|
||||
CreationTime: 1321867751
|
||||
ModificationTime: 1326665029
|
||||
OS2TypoAscent: 0
|
||||
OS2TypoAOffset: 1
|
||||
OS2TypoDescent: 0
|
||||
OS2TypoDOffset: 1
|
||||
OS2TypoLinegap: 90
|
||||
OS2WinAscent: 0
|
||||
OS2WinAOffset: 1
|
||||
OS2WinDescent: 0
|
||||
OS2WinDOffset: 1
|
||||
HheadAscent: 0
|
||||
HheadAOffset: 1
|
||||
HheadDescent: 0
|
||||
HheadDOffset: 1
|
||||
OS2Vendor: 'PfEd'
|
||||
MarkAttachClasses: 1
|
||||
DEI: 91125
|
||||
Encoding: UnicodeFull
|
||||
Compacted: 1
|
||||
UnicodeInterp: none
|
||||
NameList: Adobe Glyph List
|
||||
DisplaySize: -24
|
||||
AntiAlias: 1
|
||||
FitToEm: 1
|
||||
WinInfo: 0 31 18
|
||||
BeginPrivate: 0
|
||||
EndPrivate
|
||||
BeginChars: 1114112 9
|
||||
|
||||
StartChar: uni2B80
|
||||
Encoding: 11136 11136 0
|
||||
Width: 621
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
0 1000 m 1
|
||||
621 379 l 1
|
||||
0 -243 l 1
|
||||
0 1000 l 1
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B81
|
||||
Encoding: 11137 11137 1
|
||||
Width: 621
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
10 991 m 0
|
||||
16 997 23 1000 32 1000 c 0
|
||||
41 1000 48 996 54 990 c 2
|
||||
613 400 l 2
|
||||
619 394 621 386 621 378 c 0
|
||||
621 370 618 362 613 357 c 2
|
||||
54 -233 l 2
|
||||
48 -239 41 -242 32 -242 c 0
|
||||
23 -242 16 -240 10 -234 c 0
|
||||
4 -228 0 -221 0 -212 c 0
|
||||
0 -203 3 -196 8 -190 c 2
|
||||
547 379 l 1
|
||||
8 948 l 2
|
||||
3 954 0 961 0 970 c 0
|
||||
0 979 4 985 10 991 c 0
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B82
|
||||
Encoding: 11138 11138 2
|
||||
Width: 621
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
621 1000 m 5
|
||||
621 -243 l 5
|
||||
0 379 l 5
|
||||
621 1000 l 5
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B83
|
||||
Encoding: 11139 11139 3
|
||||
Width: 621
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
612 991 m 0
|
||||
618 985 621 979 621 970 c 0
|
||||
621 961 619 954 613 948 c 2
|
||||
74 379 l 1
|
||||
613 -190 l 2
|
||||
619 -196 621 -203 621 -212 c 0
|
||||
621 -221 618 -228 612 -234 c 0
|
||||
606 -240 598 -242 589 -242 c 0
|
||||
580 -242 574 -239 568 -233 c 2
|
||||
8 357 l 2
|
||||
3 362 0 370 0 378 c 0
|
||||
0 386 3 394 8 400 c 2
|
||||
568 990 l 2
|
||||
574 996 580 1000 589 1000 c 0
|
||||
598 1000 606 997 612 991 c 0
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B61
|
||||
Encoding: 11105 11105 4
|
||||
Width: 555
|
||||
VWidth: 0
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
0 800 m 5
|
||||
92 800 l 5
|
||||
92 513 l 5
|
||||
253 513 l 5
|
||||
253 444 l 5
|
||||
0 444 l 5
|
||||
0 800 l 5
|
||||
236 312 m 5
|
||||
339 312 l 5
|
||||
468 67 l 5
|
||||
468 312 l 5
|
||||
555 312 l 5
|
||||
555 -44 l 5
|
||||
453 -44 l 5
|
||||
323 200 l 5
|
||||
323 -44 l 5
|
||||
236 -44 l 5
|
||||
236 312 l 5
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B60
|
||||
Encoding: 11104 11104 5
|
||||
Width: 676
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
0 197 m 1
|
||||
94 207 419 279 419 384 c 2
|
||||
419 537 l 1
|
||||
278 501 l 1
|
||||
478 794 l 1
|
||||
677 501 l 1
|
||||
536 537 l 1
|
||||
536 384 l 2
|
||||
536 196 208 126 208 21 c 2
|
||||
208 -244 l 1
|
||||
0 -244 l 1
|
||||
0 197 l 1
|
||||
0 288 m 1
|
||||
0 405 0 944 0 944 c 1
|
||||
208 944 l 1
|
||||
208 944 208 451 208 334 c 1
|
||||
185 311 12 288 0 288 c 1
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B62
|
||||
Encoding: 11106 11106 6
|
||||
Width: 428
|
||||
VWidth: 0
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
88 677 m 2
|
||||
429 677 l 1
|
||||
429 589 l 1
|
||||
88 589 l 1
|
||||
88 162 l 1
|
||||
198 162 l 1
|
||||
198 343 l 1
|
||||
374 343 l 1
|
||||
374 427 l 1
|
||||
198 427 l 1
|
||||
198 506 l 1
|
||||
429 506 l 1
|
||||
429 274 l 1
|
||||
416 263 391 255 374 255 c 2
|
||||
286 255 l 1
|
||||
286 162 l 2
|
||||
286 114 246 74 198 74 c 2
|
||||
88 74 l 2
|
||||
40 74 0 114 0 162 c 2
|
||||
0 589 l 2
|
||||
0 637 40 677 88 677 c 2
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B63
|
||||
Encoding: 11107 11107 7
|
||||
Width: 428
|
||||
VWidth: 0
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
0 677 m 5
|
||||
341 677 l 6
|
||||
389 677 429 637 429 589 c 6
|
||||
429 506 l 6
|
||||
429 458 389 418 341 418 c 6
|
||||
287 418 l 5
|
||||
287 162 l 6
|
||||
287 114 247 74 199 74 c 6
|
||||
89 74 l 6
|
||||
41 74 1 114 1 162 c 6
|
||||
1 274 l 6
|
||||
0 274 l 6
|
||||
0 506 l 5
|
||||
89 506 l 5
|
||||
89 162 l 5
|
||||
199 162 l 5
|
||||
199 506 l 5
|
||||
341 506 l 5
|
||||
341 589 l 5
|
||||
0 589 l 5
|
||||
0 677 l 5
|
||||
EndSplineSet
|
||||
EndChar
|
||||
|
||||
StartChar: uni2B64
|
||||
Encoding: 11108 11108 8
|
||||
Width: 546
|
||||
VWidth: 0
|
||||
Flags: HMW
|
||||
LayerCount: 2
|
||||
Fore
|
||||
SplineSet
|
||||
273 733 m 4
|
||||
429 733 430 538 430 538 c 5
|
||||
430 420 l 5
|
||||
547 420 l 5
|
||||
547 303 l 5
|
||||
547 303 546 -9 273 -9 c 4
|
||||
0 -9 0 303 0 303 c 5
|
||||
0 420 l 5
|
||||
117 420 l 5
|
||||
117 538 l 5
|
||||
117 538 117 733 273 733 c 4
|
||||
273 655 m 4
|
||||
195 655 195 576 195 420 c 5
|
||||
352 420 l 5
|
||||
352 576 351 655 273 655 c 4
|
||||
273 342 m 4
|
||||
195 342 195 147 273 147 c 4
|
||||
351 147 351 342 273 342 c 4
|
||||
EndSplineSet
|
||||
EndChar
|
||||
EndChars
|
||||
BitmapFont: 10 10 8 2 1
|
||||
BDFChar: 0 11136 6 0 4 -2 7
|
||||
JAC+4q"X@:^jlCb
|
||||
BDFChar: 1 11137 6 0 4 -2 7
|
||||
J3Y4g#RCta5_&h7
|
||||
BDFChar: 2 11138 6 1 5 -2 7
|
||||
#T,OGq"T(n(^L*A
|
||||
BDFChar: 3 11139 6 1 5 -2 7
|
||||
#S8+DJ:Km-&-r79
|
||||
BDFChar: 4 11105 6 1 4 -1 7
|
||||
J:N1>!0GR3O8o7\
|
||||
BDFChar: 5 11104 7 0 5 -2 7
|
||||
^rY<PaN2`d^q]pM
|
||||
BDFChar: 6 11106 4 1 5 -1 6
|
||||
G^u0KJ=)F+
|
||||
BDFChar: 7 11107 4 0 5 -1 6
|
||||
p]QtGOH>Q3
|
||||
BDFChar: 8 11108 5 0 5 0 6
|
||||
0M"b4bku\c
|
||||
EndBitmapFont
|
||||
BitmapFont: 12 10 10 2 1
|
||||
BDFChar: 0 11136 7 0 6 -2 11
|
||||
!!%Pbi:-O>r:od>^jlCb
|
||||
BDFChar: 1 11137 7 0 6 -3 11
|
||||
!!%O7+:ne]":,P]5_&h7
|
||||
BDFChar: 2 11138 7 0 6 -2 11
|
||||
!!!-1*'AWHr-UUH$j6P1
|
||||
BDFChar: 3 11139 7 0 6 -2 11
|
||||
!!!--&0O5gJ3Y4g#Qt,-
|
||||
BDFChar: 4 11105 7 0 5 0 8
|
||||
J:N1>!$jBP,QIfE
|
||||
BDFChar: 5 11104 8 0 8 -3 11
|
||||
z^];.Ma8juqa8j9]a8jQehuLOm^];.Mz
|
||||
BDFChar: 6 11106 5 1 6 0 8
|
||||
!-j$]R"1Qc?iU0,
|
||||
BDFChar: 7 11107 5 0 5 0 7
|
||||
p]QtGOH>Q3
|
||||
BDFChar: 8 11108 7 0 5 0 8
|
||||
0M"`*r63C_GQ7^D
|
||||
EndBitmapFont
|
||||
EndSplineFont
|
164
sources_forked/vim-powerline/fontpatcher/README.rst
Executable file
164
sources_forked/vim-powerline/fontpatcher/README.rst
Executable file
@ -0,0 +1,164 @@
|
||||
======================
|
||||
Powerline font patcher
|
||||
======================
|
||||
|
||||
:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com)
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
This font patcher creates dividers and symbols for use with Powerline. The
|
||||
script requires Python 2 and FontForge compiled with Python bindings.
|
||||
|
||||
Patched fonts are renamed by default (" for Powerline" is added to the font
|
||||
name) so they don't conflict with existing fonts. Use the ``--no-rename``
|
||||
option to disable font renaming.
|
||||
|
||||
Glyph table
|
||||
-----------
|
||||
|
||||
All the glyphs are stored in the ``U+2B60``-``U+2BFF`` range ("Misc symbols
|
||||
and arrows").
|
||||
|
||||
+------------+-------------------+
|
||||
| Code point | Description |
|
||||
+============+===================+
|
||||
| ``U+2B60`` | Branch symbol |
|
||||
+------------+-------------------+
|
||||
| ``U+2B61`` | LN (line) symbol |
|
||||
+------------+-------------------+
|
||||
| ``U+2B62`` | FT symbol, part 1 |
|
||||
+------------+-------------------+
|
||||
| ``U+2B63`` | FT symbol, part 2 |
|
||||
+------------+-------------------+
|
||||
| ``U+2B64`` | Padlock (closed) |
|
||||
+------------+-------------------+
|
||||
| ``U+2B80`` | Hard right arrow |
|
||||
+------------+-------------------+
|
||||
| ``U+2B81`` | Soft right arrow |
|
||||
+------------+-------------------+
|
||||
| ``U+2B82`` | Hard left arrow |
|
||||
+------------+-------------------+
|
||||
| ``U+2B83`` | Soft left arrow |
|
||||
+------------+-------------------+
|
||||
|
||||
===================
|
||||
Font patching guide
|
||||
===================
|
||||
|
||||
There's a `GitHub wiki page`_ dedicated to community-contributed patched
|
||||
fonts. You may download one of the fonts on that page if you don't want to
|
||||
patch the fonts yourself.
|
||||
|
||||
If you do patch a font that's not included in the wiki (and you have
|
||||
permission to distribute it), please include it on the wiki page.
|
||||
|
||||
**Note:** The fonts in the wiki may be outdated, and may have different
|
||||
glyphs than the ones provided in the latest version of Powerline. It's
|
||||
recommended that you always patch your fonts yourself if you have the
|
||||
required software.
|
||||
|
||||
.. _`GitHub wiki page`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts
|
||||
|
||||
Linux
|
||||
-----
|
||||
|
||||
1. Install fontforge with Python bindings. For Ubuntu users the required
|
||||
package is ``python-fontforge``, for Arch Linux users the required
|
||||
package is ``fontforge``. It should be something similar for other
|
||||
distros.
|
||||
|
||||
2. Run the font patcher::
|
||||
|
||||
$ /path/to/fontpatcher MyFontFile.ttf
|
||||
|
||||
3. Copy the font file into ``~/.fonts`` (or another X font directory)::
|
||||
|
||||
$ cp MyFontFile-Powerline.otf ~/.fonts
|
||||
|
||||
**Note:** If the font is a pure bitmap font (e.g. a PCF font) it will be
|
||||
stored in the BDF format. This is usually not a problem, and you may
|
||||
convert the font back to the PCF format using ``bdftopcf`` if you want
|
||||
to. All other fonts will be stored in the OTF format regardless of the
|
||||
original format.
|
||||
|
||||
4. Update your font cache::
|
||||
|
||||
$ sudo fc-cache -vf
|
||||
|
||||
**Note:** If you use vim in rxvt-unicode in the client/daemon mode, you
|
||||
may need to close all running terminals as well for the font to be
|
||||
updated.
|
||||
|
||||
5. **For gvim users:** Update the GUI font in your ``vimrc`` file::
|
||||
|
||||
set guifont=MyFont\ for\ Powerline
|
||||
|
||||
**For terminal users:** Update your terminal configuration to use the
|
||||
patched font.
|
||||
|
||||
6. Update your ``vimrc`` configuration to use the new symbols::
|
||||
|
||||
let g:Powerline_symbols = 'fancy'
|
||||
|
||||
7. Make sure that the cache file is deleted::
|
||||
|
||||
$ rm /tmp/Powerline.cache
|
||||
|
||||
8. Start vim and enjoy your new statusline!
|
||||
|
||||
OS X
|
||||
----
|
||||
|
||||
1. Check if you have a FontForge version with Python support by running
|
||||
``fontforge -version``. You should see something like this::
|
||||
|
||||
$ fontforge -version
|
||||
Copyright (c) 2000-2011 by George Williams.
|
||||
Executable based on sources from 13:48 GMT 22-Feb-2011-D.
|
||||
Library based on sources from 13:48 GMT 22-Feb-2011.
|
||||
fontforge 20110222
|
||||
libfontforge 20110222
|
||||
|
||||
Make sure that the executable version number doesn't have ``NoPython`` in
|
||||
it. If everything looks OK, skip ahead to step 4.
|
||||
|
||||
2. If you have FontForge but with ``NoPython`` in the version number, please
|
||||
try to update to a later version::
|
||||
|
||||
$ brew uninstall fontforge
|
||||
$ brew update
|
||||
$ brew install --use-gcc fontforge
|
||||
|
||||
**Note:** You may have to use ``--use-clang`` instead of ``--use-gcc``
|
||||
when compiling FontForge.
|
||||
|
||||
3. If you don't have FontForge, install it with Homebrew::
|
||||
|
||||
$ brew update
|
||||
$ brew install --use-gcc fontforge
|
||||
|
||||
4. Patch your fonts by passing the ``fontpatcher`` script as a parameter to
|
||||
FontForge::
|
||||
|
||||
$ fontforge -script /path/to/fontpatcher MyFontFile.ttf
|
||||
|
||||
5. Install the font by double-clicking the font file in Finder and click
|
||||
"Install this font" from the preview window.
|
||||
|
||||
6. **For gvim users:** Update the GUI font in your ``vimrc`` file::
|
||||
|
||||
set guifont=MyFont\ for\ Powerline
|
||||
|
||||
**For terminal users:** Update your terminal configuration to use the
|
||||
patched font.
|
||||
|
||||
7. Update your ``vimrc`` configuration to use the new symbols::
|
||||
|
||||
let g:Powerline_symbols = 'fancy'
|
||||
|
||||
8. Make sure that the cache file is deleted::
|
||||
|
||||
$ rm /tmp/Powerline.cache
|
||||
|
||||
9. Start vim and enjoy your new statusline!
|
240
sources_forked/vim-powerline/fontpatcher/fontpatcher
Executable file
240
sources_forked/vim-powerline/fontpatcher/fontpatcher
Executable file
@ -0,0 +1,240 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""Font patcher for Powerline.
|
||||
|
||||
Creates dividers and symbols for use with Powerline. Requires FontForge with Python bindings.
|
||||
|
||||
Stores glyphs in the 2b60-2bff Unicode range ("Misc symbols and arrows").
|
||||
|
||||
[2b60] Branch symbol
|
||||
[2b61] LN (line) symbol
|
||||
[2b62] FT symbol 1
|
||||
[2b63] FT symbol 2
|
||||
[2b64] Padlock (closed) symbol
|
||||
[2b80] Hard right arrow
|
||||
[2b81] Soft right arrow
|
||||
[2b82] Hard left arrow
|
||||
[2b83] Soft left arrow
|
||||
"""
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
try:
|
||||
import fontforge
|
||||
import psMat
|
||||
except ImportError:
|
||||
sys.stderr.write('The required FontForge modules could not be loaded.\n\n')
|
||||
|
||||
if sys.version_info.major > 2:
|
||||
sys.stderr.write('FontForge only supports Python 2. Please run this script with the Python 2 executable - e.g. "python2 {0}"\n'.format(sys.argv[0]))
|
||||
else:
|
||||
sys.stderr.write('You need FontForge with Python bindings for this script to work.\n')
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
# Handle command-line arguments
|
||||
parser = argparse.ArgumentParser(description='Font patcher for Powerline. Creates dividers and symbols in FontForge-compatible font files. Requires FontForge with Python bindings. Stores glyphs in the U+2B80-U+2BFF range ("Miscellaneous symbols and arrows"). Stores the patched font as a new, renamed font file by default.')
|
||||
|
||||
parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+')
|
||||
parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename')
|
||||
parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0]))
|
||||
parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono')
|
||||
parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
SYM_ATTR = {
|
||||
# Right/left-aligned glyphs will have their advance width reduced in order to overlap the next glyph slightly
|
||||
0x2b60: { 'align': 'c', 'stretch': 'y' , 'overlap': False },
|
||||
0x2b61: { 'align': 'c', 'stretch': '' , 'overlap': False },
|
||||
0x2b62: { 'align': 'r', 'stretch': '' , 'overlap': False },
|
||||
0x2b63: { 'align': 'l', 'stretch': '' , 'overlap': False },
|
||||
0x2b64: { 'align': 'c', 'stretch': '' , 'overlap': False },
|
||||
0x2b80: { 'align': 'l', 'stretch': 'xy', 'overlap': True },
|
||||
0x2b81: { 'align': 'l', 'stretch': 'xy', 'overlap': True },
|
||||
0x2b82: { 'align': 'r', 'stretch': 'xy', 'overlap': True },
|
||||
0x2b83: { 'align': 'r', 'stretch': 'xy', 'overlap': True },
|
||||
}
|
||||
|
||||
# Open symbol font
|
||||
try:
|
||||
symbols = fontforge.open(args.symbol_font)
|
||||
except EnvironmentError:
|
||||
sys.exit(1)
|
||||
|
||||
# Patch provided fonts
|
||||
for font_path in args.fonts:
|
||||
try:
|
||||
font = fontforge.open(font_path)
|
||||
except EnvironmentError:
|
||||
sys.exit(1)
|
||||
|
||||
# Rename font
|
||||
if args.rename:
|
||||
font.familyname += ' for Powerline'
|
||||
font.fullname += ' for Powerline'
|
||||
font.fontname += 'ForPowerline'
|
||||
font.appendSFNTName('English (US)', 'Preferred Family', font.familyname)
|
||||
font.appendSFNTName('English (US)', 'Compatible Full', font.fullname)
|
||||
if args.fixwin:
|
||||
font.fontname = re.sub(r'\W', '', font.familyname)
|
||||
|
||||
# Force the em size to be equal
|
||||
symbols.em = font.em
|
||||
|
||||
# Initial font dimensions
|
||||
font_dim = {
|
||||
'xmin' : 0,
|
||||
'ymin' : -font.descent,
|
||||
'xmax' : 0,
|
||||
'ymax' : font.ascent,
|
||||
|
||||
'width' : 0,
|
||||
'height': 0,
|
||||
}
|
||||
|
||||
# Find the biggest char width and height
|
||||
#
|
||||
# 0x00-0x17f is the Latin Extended-A range
|
||||
# 0x2500-0x2600 is the box drawing range
|
||||
for glyph in range(0x00, 0x17f) + range(0x2500, 0x2600):
|
||||
try:
|
||||
(xmin, ymin, xmax, ymax) = font[glyph].boundingBox()
|
||||
except TypeError:
|
||||
continue
|
||||
|
||||
if font_dim['width'] == 0:
|
||||
font_dim['width'] = font[glyph].width
|
||||
|
||||
if ymin < font_dim['ymin']: font_dim['ymin'] = ymin
|
||||
if ymax > font_dim['ymax']: font_dim['ymax'] = ymax
|
||||
if xmax > font_dim['xmax']: font_dim['xmax'] = xmax
|
||||
|
||||
# Calculate font height
|
||||
font_dim['height'] = abs(font_dim['ymin']) + font_dim['ymax']
|
||||
|
||||
# Update the font encoding to ensure that the Unicode glyphs are available
|
||||
font.encoding = 'ISO10646'
|
||||
|
||||
# Fetch this property before adding outlines
|
||||
onlybitmaps = font.onlybitmaps
|
||||
|
||||
def get_dim(glyph):
|
||||
bbox = glyph.boundingBox()
|
||||
|
||||
return {
|
||||
'xmin' : bbox[0],
|
||||
'ymin' : bbox[1],
|
||||
'xmax' : bbox[2],
|
||||
'ymax' : bbox[3],
|
||||
|
||||
'width' : bbox[2] + (-bbox[0]),
|
||||
'height': bbox[3] + (-bbox[1]),
|
||||
}
|
||||
|
||||
# Create glyphs from symbol font
|
||||
for sym_glyph in symbols.glyphs():
|
||||
sym_attr = SYM_ATTR[sym_glyph.unicode]
|
||||
|
||||
# Prepare symbol glyph dimensions
|
||||
sym_dim = get_dim(sym_glyph)
|
||||
|
||||
# Select and copy symbol from its encoding point
|
||||
symbols.selection.select(sym_glyph.encoding)
|
||||
symbols.copy()
|
||||
|
||||
# Select and paste symbol to its unicode code point
|
||||
font.selection.select(sym_glyph.unicode)
|
||||
font.paste()
|
||||
|
||||
# Now that we have copy/pasted the glyph, it's time to scale and move it
|
||||
|
||||
# Handle glyph stretching
|
||||
if 'x' in sym_attr['stretch']:
|
||||
# Stretch the glyph horizontally
|
||||
scale_ratio = font_dim['width'] / sym_dim['width']
|
||||
|
||||
font.transform(psMat.scale(scale_ratio, 1))
|
||||
if 'y' in sym_attr['stretch']:
|
||||
# Stretch the glyph vertically
|
||||
scale_ratio = font_dim['height'] / sym_dim['height']
|
||||
|
||||
font.transform(psMat.scale(1, scale_ratio))
|
||||
|
||||
# Use the dimensions from the pasted and stretched glyph
|
||||
sym_dim = get_dim(font[sym_glyph.unicode])
|
||||
|
||||
# Center-align the glyph vertically
|
||||
font_ycenter = font_dim['height'] / 2
|
||||
sym_ycenter = sym_dim['height'] / 2
|
||||
|
||||
# First move it to the ymax (top)
|
||||
font.transform(psMat.translate(0, font_dim['ymax'] - sym_dim['ymax']))
|
||||
|
||||
# Then move it the y center difference
|
||||
font.transform(psMat.translate(0, sym_ycenter - font_ycenter))
|
||||
|
||||
# Ensure that the glyph doesn't extend outside the font's bounding box
|
||||
if sym_dim['width'] > font_dim['width']:
|
||||
# The glyph is too wide, scale it down to fit
|
||||
scale_matrix = psMat.scale(font_dim['width'] / sym_dim['width'], 1)
|
||||
|
||||
font.transform(scale_matrix)
|
||||
|
||||
# Use the dimensions from the stretched glyph
|
||||
sym_dim = get_dim(font[sym_glyph.unicode])
|
||||
|
||||
# Handle glyph alignment
|
||||
if sym_attr['align'] == 'c':
|
||||
# Center align
|
||||
align_matrix = psMat.translate(font_dim['width'] / 2 - sym_dim['width'] / 2 , 0)
|
||||
elif sym_attr['align'] == 'r':
|
||||
# Right align
|
||||
align_matrix = psMat.translate(font_dim['width'] - sym_dim['width'], 0)
|
||||
else:
|
||||
# No alignment (left alignment)
|
||||
align_matrix = psMat.translate(0, 0)
|
||||
|
||||
font.transform(align_matrix)
|
||||
|
||||
if sym_attr['overlap'] is True:
|
||||
overlap_width = font.em / 48
|
||||
|
||||
# Stretch the glyph slightly horizontally if it should overlap
|
||||
font.transform(psMat.scale((sym_dim['width'] + overlap_width) / sym_dim['width'], 1))
|
||||
|
||||
if sym_attr['align'] == 'l':
|
||||
# The glyph should be left-aligned, so it must be moved overlap_width to the left
|
||||
# This only applies to left-aligned glyphs because the glyph is scaled to the right
|
||||
font.transform(psMat.translate(-overlap_width, 0))
|
||||
|
||||
# Ensure the font is considered monospaced on Windows
|
||||
font[sym_glyph.unicode].width = font_dim['width']
|
||||
|
||||
if font.bitmapSizes and not onlybitmaps:
|
||||
# If this is an outline font with bitmaps, regenerate bitmaps for the changed glyphs
|
||||
font.selection.changed()
|
||||
|
||||
for size in font.bitmapSizes:
|
||||
font.regenBitmaps((size, ))
|
||||
|
||||
output_name, extension = os.path.split(font_path)[1].rsplit('.', 1)
|
||||
if extension.lower() not in ['ttf', 'otf']:
|
||||
# Default to OpenType if input is not TrueType/OpenType
|
||||
extension = 'otf'
|
||||
if args.fixmono:
|
||||
for glyph in font.glyphs():
|
||||
if glyph.width == 0: glyph.width = font_dim['width']
|
||||
|
||||
if onlybitmaps:
|
||||
# Generate BDF font
|
||||
font.generate('{0}-Powerline.bdf'.format(output_name, bitmap_type='bdf'))
|
||||
else:
|
||||
# Generate OTF/TTF font
|
||||
font.generate('{0}-Powerline.{1}'.format(output_name, extension))
|
||||
|
69
sources_forked/vim-powerline/plugin/Powerline.vim
Executable file
69
sources_forked/vim-powerline/plugin/Powerline.vim
Executable file
@ -0,0 +1,69 @@
|
||||
" Powerline - The ultimate statusline utility
|
||||
"
|
||||
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
||||
" Source repository: https://github.com/Lokaltog/vim-powerline
|
||||
|
||||
" Script initialization {{{
|
||||
if exists('g:Powerline_loaded') || &compatible || version < 702
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:Powerline_loaded = 1
|
||||
" }}}
|
||||
" Commands {{{
|
||||
command! PowerlineClearCache call Pl#ClearCache()
|
||||
command! PowerlineReloadColorscheme call Pl#ReloadColorscheme()
|
||||
" }}}
|
||||
" Set default options {{{
|
||||
for [s:key, s:value] in items({
|
||||
\ 'theme' : 'default'
|
||||
\ , 'colorscheme' : 'default'
|
||||
\ , 'symbols' : 'compatible'
|
||||
\ , 'symbols_override' : {}
|
||||
\ , 'dividers_override': []
|
||||
\ , 'stl_path_style' : 'relative'
|
||||
\ , 'cache_enabled' : 1
|
||||
\ })
|
||||
|
||||
if ! exists('g:Powerline_' . s:key)
|
||||
exec printf('let g:Powerline_%s = %s', s:key, string(s:value))
|
||||
endif
|
||||
|
||||
unlet! s:key s:value
|
||||
endfor
|
||||
|
||||
if ! exists('g:Powerline_cache_file')
|
||||
exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache'
|
||||
\ , simplify(expand('<sfile>:p:h') .'/..')
|
||||
\ , g:Powerline_theme
|
||||
\ , g:Powerline_colorscheme
|
||||
\ , g:Powerline_symbols
|
||||
\ ))
|
||||
endif
|
||||
" }}}
|
||||
" Autocommands {{{
|
||||
function! s:CreateAutocmds()
|
||||
augroup PowerlineMain
|
||||
autocmd!
|
||||
|
||||
" Reload statuslines when changing color scheme
|
||||
autocmd ColorScheme *
|
||||
\ call Pl#Load()
|
||||
|
||||
autocmd BufEnter,WinEnter,FileType,BufUnload *
|
||||
\ call Pl#UpdateStatusline(1)
|
||||
|
||||
autocmd BufLeave,WinLeave *
|
||||
\ call Pl#UpdateStatusline(0)
|
||||
|
||||
autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim
|
||||
\ :PowerlineReloadColorscheme
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
augroup PowerlineStartup
|
||||
autocmd!
|
||||
|
||||
autocmd VimEnter * call s:CreateAutocmds() | call Pl#UpdateStatusline(1)
|
||||
augroup END
|
||||
" }}}
|
1
sources_forked/zencoding/.gitignore
vendored
Executable file
1
sources_forked/zencoding/.gitignore
vendored
Executable file
@ -0,0 +1 @@
|
||||
/doc/tags
|
4
sources_forked/zencoding/.gitmodules
vendored
Executable file
4
sources_forked/zencoding/.gitmodules
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
[submodule "docs"]
|
||||
path = docs
|
||||
url = git@github.com:mattn/zencoding-vim.git
|
||||
branch = gh-pages
|
11
sources_forked/zencoding/Makefile
Executable file
11
sources_forked/zencoding/Makefile
Executable file
@ -0,0 +1,11 @@
|
||||
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
|
103
sources_forked/zencoding/README.mkd
Executable file
103
sources_forked/zencoding/README.mkd
Executable file
@ -0,0 +1,103 @@
|
||||
# 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>
|
||||
|
0
sources_forked/zencoding/TODO
Executable file
0
sources_forked/zencoding/TODO
Executable file
212
sources_forked/zencoding/TUTORIAL
Executable file
212
sources_forked/zencoding/TUTORIAL
Executable file
@ -0,0 +1,212 @@
|
||||
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',
|
||||
\ },
|
||||
\}
|
||||
---------------------
|
1486
sources_forked/zencoding/autoload/zencoding.vim
Executable file
1486
sources_forked/zencoding/autoload/zencoding.vim
Executable file
File diff suppressed because it is too large
Load Diff
11
sources_forked/zencoding/autoload/zencoding/lang.vim
Executable file
11
sources_forked/zencoding/autoload/zencoding/lang.vim
Executable file
@ -0,0 +1,11 @@
|
||||
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
|
||||
|
228
sources_forked/zencoding/autoload/zencoding/lang/css.vim
Executable file
228
sources_forked/zencoding/autoload/zencoding/lang/css.vim
Executable file
@ -0,0 +1,228 @@
|
||||
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
|
310
sources_forked/zencoding/autoload/zencoding/lang/haml.vim
Executable file
310
sources_forked/zencoding/autoload/zencoding/lang/haml.vim
Executable file
@ -0,0 +1,310 @@
|
||||
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
|
692
sources_forked/zencoding/autoload/zencoding/lang/html.vim
Executable file
692
sources_forked/zencoding/autoload/zencoding/lang/html.vim
Executable file
@ -0,0 +1,692 @@
|
||||
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
|
158
sources_forked/zencoding/autoload/zencoding/lang/sass.vim
Executable file
158
sources_forked/zencoding/autoload/zencoding/lang/sass.vim
Executable file
@ -0,0 +1,158 @@
|
||||
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
|
121
sources_forked/zencoding/autoload/zencoding/lang/scss.vim
Executable file
121
sources_forked/zencoding/autoload/zencoding/lang/scss.vim
Executable file
@ -0,0 +1,121 @@
|
||||
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
|
276
sources_forked/zencoding/autoload/zencoding/lang/slim.vim
Executable file
276
sources_forked/zencoding/autoload/zencoding/lang/slim.vim
Executable file
@ -0,0 +1,276 @@
|
||||
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
|
249
sources_forked/zencoding/autoload/zencoding/util.vim
Executable file
249
sources_forked/zencoding/autoload/zencoding/util.vim
Executable file
@ -0,0 +1,249 @@
|
||||
"==============================================================================
|
||||
" 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, '>', '>', 'g')
|
||||
let str = substitute(str, '<', '<', 'g')
|
||||
let str = substitute(str, '"', '"', 'g')
|
||||
let str = substitute(str, ''', "'", 'g')
|
||||
let str = substitute(str, ' ', ' ', 'g')
|
||||
let str = substitute(str, '¥', '\¥', 'g')
|
||||
let str = substitute(str, '&', '\&', '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
|
438
sources_forked/zencoding/doc/zencoding.txt
Executable file
438
sources_forked/zencoding/doc/zencoding.txt
Executable file
@ -0,0 +1,438 @@
|
||||
*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> main() {<br />
|
||||
puts(<span class="Constant">"hello world"</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:
|
215
sources_forked/zencoding/plugin/zencoding.vim
Executable file
215
sources_forked/zencoding/plugin/zencoding.vim
Executable file
@ -0,0 +1,215 @@
|
||||
"=============================================================================
|
||||
" 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:
|
794
sources_forked/zencoding/unittest.vim
Executable file
794
sources_forked/zencoding/unittest.vim
Executable file
@ -0,0 +1,794 @@
|
||||
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': "<div id=\"box1\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n<div id=\"box2\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n<div id=\"box3\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\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:
|
265
sources_forked/zencoding/zencoding.vim.vimup
Executable file
265
sources_forked/zencoding/zencoding.vim.vimup
Executable file
@ -0,0 +1,265 @@
|
||||
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
|
Reference in New Issue
Block a user