Merge pull request #1 from amix/master
Updated plugins and added vim-jade
This commit is contained in:
commit
f616c1f3f0
35 changed files with 1036 additions and 131 deletions
|
@ -156,6 +156,37 @@ function! syntastic#preprocess#iconv(errors) abort " {{{2
|
|||
\ a:errors
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#jscs(errors) abort " {{{2
|
||||
let errs = join(a:errors, '')
|
||||
if errs ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
let json = s:_decode_JSON(errs)
|
||||
|
||||
let out = []
|
||||
if type(json) == type({})
|
||||
for fname in keys(json)
|
||||
if type(json[fname]) == type([])
|
||||
for e in json[fname]
|
||||
try
|
||||
let e['message'] = substitute(e['message'], "\n", ' ', 'g')
|
||||
cal add(out, fname . ':' . e['line'] . ':' . e['column'] . ':' . e['message'])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
|
||||
return filter(copy(a:errors), 'v:val !=# ""')
|
||||
endfunction " }}}2
|
||||
|
@ -269,15 +300,16 @@ function! syntastic#preprocess#stylelint(errors) abort " {{{2
|
|||
|
||||
for e in errs[0]['warnings']
|
||||
try
|
||||
let severity = type(e['severity']) == type(0) ? ['W', 'E'][e['severity']-1] : e['severity'][0]
|
||||
let msg =
|
||||
\ ['W', 'E'][e['severity']-1] . ':' .
|
||||
\ severity . ':' .
|
||||
\ errs[0]['source'] . ':' .
|
||||
\ e['line'] . ':' .
|
||||
\ e['column'] . ':' .
|
||||
\ e['text']
|
||||
call add(out, msg)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker css/stylelint: unrecognized error format')
|
||||
call syntastic#log#warn('checker css/stylelint: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
|
|
|
@ -439,7 +439,8 @@ Default: 2
|
|||
Use this option to tell syntastic to automatically open and/or close the
|
||||
|location-list| (see |syntastic-error-window|).
|
||||
|
||||
When set to 0 the error window will not be opened or closed automatically. >
|
||||
When set to 0 the error window will be neither opened nor closed
|
||||
automatically. >
|
||||
let g:syntastic_auto_loc_list = 0
|
||||
<
|
||||
When set to 1 the error window will be automatically opened when errors are
|
||||
|
@ -449,6 +450,10 @@ detected, and closed when none are detected. >
|
|||
When set to 2 the error window will be automatically closed when no errors are
|
||||
detected, but not opened automatically. >
|
||||
let g:syntastic_auto_loc_list = 2
|
||||
<
|
||||
When set to 3 the error window will be automatically opened when errors are
|
||||
detected, but not closed automatically. >
|
||||
let g:syntastic_auto_loc_list = 3
|
||||
<
|
||||
*'syntastic_loc_list_height'*
|
||||
Default: 10
|
||||
|
@ -956,14 +961,12 @@ mode only work with "vim-auto-save" version 0.1.7 or later.
|
|||
------------------------------------------------------------------------------
|
||||
7.10. vim-go *syntastic-vim-go*
|
||||
|
||||
The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
|
||||
lists, and thus doesn't conflict with syntastic (which uses |location-list|
|
||||
lists). However, both "vim-go" and syntastic run syntax checks by default
|
||||
when you save buffers to disk, and this can have confusing results. To
|
||||
avoid both plugins opening error windows, you can either set passive
|
||||
mode for go in syntastic (see |syntastic_mode_map|), or prevent "vim-go"
|
||||
from showing a quickfix window when |g:go_fmt_command| fails, by setting
|
||||
|g:go_fmt_fail_silently| to 1. E.g.: >
|
||||
Syntastic can be used along with the "vim-go" Vim plugin (see
|
||||
https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run
|
||||
syntax checks by default when you save buffers to disk. To avoid conflicts,
|
||||
you have to either set passive mode in syntastic for the go filetype (see
|
||||
|syntastic_mode_map|), or prevent "vim-go" from showing a quickfix window when
|
||||
|g:go_fmt_command| fails, by setting |g:go_fmt_fail_silently| to 1. E.g.: >
|
||||
let g:go_fmt_fail_silently = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-62'
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-69'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -510,6 +510,7 @@ function! SyntasticMake(options) abort " {{{2
|
|||
|
||||
if has_key(a:options, 'errorformat')
|
||||
let &errorformat = a:options['errorformat']
|
||||
set errorformat<
|
||||
endif
|
||||
|
||||
if has_key(a:options, 'cwd')
|
||||
|
@ -662,7 +663,8 @@ function! s:_skip_file() abort " {{{2
|
|||
let fname = expand('%', 1)
|
||||
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
|
||||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
|
||||
\ s:_ignore_file(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
\ getwinvar(0, '&previewwindow') || s:_ignore_file(fname) ||
|
||||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '_skip_file: skipping checks')
|
||||
endif
|
||||
|
@ -690,6 +692,9 @@ function! s:_explain_skip(filetypes) abort " {{{2
|
|||
if getwinvar(0, '&diff')
|
||||
call add(why, 'diff mode')
|
||||
endif
|
||||
if getwinvar(0, '&previewwindow')
|
||||
call add(why, 'preview window')
|
||||
endif
|
||||
if s:_ignore_file(fname)
|
||||
call add(why, 'filename matching g:syntastic_ignore_files')
|
||||
endif
|
||||
|
|
|
@ -19,13 +19,13 @@ endfunction " }}}2
|
|||
|
||||
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
|
||||
let auto_loc_list = syntastic#util#var('auto_loc_list')
|
||||
if !a:loclist.isEmpty()
|
||||
if syntastic#util#var('auto_loc_list') == 1
|
||||
if auto_loc_list == 1 || auto_loc_list == 3
|
||||
call a:loclist.show()
|
||||
endif
|
||||
else
|
||||
if syntastic#util#var('auto_loc_list') > 0
|
||||
|
||||
if auto_loc_list == 1 || auto_loc_list == 2
|
||||
"TODO: this will close the loc list window if one was opened by
|
||||
"something other than syntastic
|
||||
lclose
|
||||
|
|
|
@ -21,16 +21,24 @@ endif
|
|||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter checkstyle' })
|
||||
function! SyntaxCheckers_javascript_jscs_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 1])
|
||||
endfunction
|
||||
|
||||
let errorformat = '%f:%t:%l:%c:%m'
|
||||
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter json' })
|
||||
|
||||
let errorformat = '%f:%l:%c:%m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'preprocess': 'checkstyle',
|
||||
\ 'preprocess': 'jscs',
|
||||
\ 'defaults': {'type': 'E'},
|
||||
\ 'returns': [0, 2] })
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
|||
[7]: https://github.com/bling/minivimrc
|
||||
[8]: http://en.wikipedia.org/wiki/Open/closed_principle
|
||||
[9]: https://github.com/Shougo/unite.vim
|
||||
[10]: https://github.com/kien/ctrlp.vim
|
||||
[10]: https://github.com/ctrlpvim/ctrlp.vim
|
||||
[11]: https://github.com/tpope/vim-pathogen
|
||||
[12]: https://github.com/Shougo/neobundle.vim
|
||||
[13]: https://github.com/gmarik/vundle
|
||||
|
|
|
@ -14,6 +14,10 @@ if s:head_format == 1
|
|||
function! s:format_name(name)
|
||||
return fnamemodify(a:name, ':t')
|
||||
endfunction
|
||||
elseif s:head_format == 2
|
||||
function! s:format_name(name)
|
||||
return pathshorten(a:name)
|
||||
endfunction
|
||||
elseif type(s:head_format) == type('')
|
||||
function! s:format_name(name)
|
||||
return call(s:head_format, [a:name])
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:filetypes = get(g:, 'airline#extensions#wordcount#filetypes', '\vhelp|markdown|rst|org')
|
||||
let s:format = get(g:, 'airline#extensions#wordcount#format', '%d words')
|
||||
|
||||
" adapted from http://stackoverflow.com/questions/114431/fast-word-count-function-in-vim
|
||||
function! s:update()
|
||||
if &ft !~ s:filetypes
|
||||
unlet! b:airline_wordcount
|
||||
return
|
||||
elseif mode() =~? 's'
|
||||
" Bail on select mode
|
||||
return
|
||||
endif
|
||||
|
||||
let old_status = v:statusmsg
|
||||
|
@ -21,7 +25,7 @@ function! s:update()
|
|||
if len(parts) > 11
|
||||
let cnt = str2nr(split(stat)[11])
|
||||
let spc = g:airline_symbols.space
|
||||
let b:airline_wordcount = cnt . spc . 'words' . spc . g:airline_right_alt_sep . spc
|
||||
let b:airline_wordcount = printf(s:format, cnt) . spc . g:airline_right_alt_sep . spc
|
||||
else
|
||||
unlet! b:airline_wordcount
|
||||
endif
|
||||
|
|
|
@ -79,6 +79,7 @@ function! airline#init#bootstrap()
|
|||
\ 'accent': 'red',
|
||||
\ })
|
||||
call airline#parts#define_raw('file', '%f%m')
|
||||
call airline#parts#define_raw('path', '%F%m')
|
||||
call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#')
|
||||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace','windowswap'])
|
||||
|
@ -96,8 +97,12 @@ function! airline#init#sections()
|
|||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
endif
|
||||
if !exists('g:airline_section_c')
|
||||
if &autochdir == 1
|
||||
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly'])
|
||||
else
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_gutter')
|
||||
let g:airline_section_gutter = airline#section#create(['%='])
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
" vim-airline companion theme of distinguished
|
||||
" (https://github.com/Lokaltog/vim-distinguished)
|
||||
" I have nothing to do with the original
|
||||
" distinguished theme other than being a big fan.
|
||||
" this theme was shamelessly created by modifying
|
||||
" the Ubaryd airline theme.
|
||||
|
||||
let s:gray = [245, '#8a8a8a']
|
||||
let s:golden = [143, '#afaf5f']
|
||||
let s:pink = [131, '#af5f5f']
|
||||
let s:blue = [ 67, '#5f87af']
|
||||
let s:orange = [166, '#d75f00']
|
||||
let s:outerfg = [ 16, '#000000']
|
||||
let s:innerbg = [234, '#1c1c1c']
|
||||
let s:middle = ['#bcbcbc', '#444444', 250, 238]
|
||||
|
||||
" Normal mode
|
||||
let s:N1 = [s:outerfg[1], s:gray[1], s:outerfg[0], s:gray[0]]
|
||||
let s:N3 = [s:gray[1], s:innerbg[1], s:gray[0], s:innerbg[0]]
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [s:outerfg[1], s:golden[1], s:outerfg[0], s:golden[0]]
|
||||
let s:I3 = [s:golden[1], s:innerbg[1], s:golden[0], s:innerbg[0]]
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [s:outerfg[1], s:pink[1], s:outerfg[0], s:pink[0]]
|
||||
let s:V3 = [s:pink[1], s:innerbg[1], s:pink[0], s:innerbg[0]]
|
||||
|
||||
" Replace mode
|
||||
let s:R1 = [s:outerfg[1], s:blue[1], s:outerfg[0], s:blue[0]]
|
||||
let s:R3 = [s:blue[1], s:innerbg[1], s:blue[0], s:innerbg[0]]
|
||||
|
||||
" Inactive pane
|
||||
let s:IA = [s:middle[1], s:innerbg[1], s:middle[3], s:innerbg[0]]
|
||||
|
||||
let g:airline#themes#distinguished#palette = {}
|
||||
let g:airline#themes#distinguished#palette.accents = {
|
||||
\ 'red': ['#d70000', '', 160, '', '']}
|
||||
|
||||
let g:airline#themes#distinguished#palette.inactive = {
|
||||
\ 'airline_a': s:IA,
|
||||
\ 'airline_b': s:IA,
|
||||
\ 'airline_c': s:IA}
|
||||
|
||||
let g:airline#themes#distinguished#palette.normal = airline#themes#generate_color_map(s:N1, s:middle, s:N3)
|
||||
let g:airline#themes#distinguished#palette.normal_modified = {
|
||||
\ 'airline_a': ['', s:orange[1], '', s:orange[0], ''],
|
||||
\ 'airline_c': [s:orange[1], '', s:orange[0], '', ''],
|
||||
\ 'airline_x': [s:orange[1], '', s:orange[0], '', ''],
|
||||
\ 'airline_z': ['', s:orange[1], '', s:orange[0], '']}
|
||||
|
||||
let g:airline#themes#distinguished#palette.insert = airline#themes#generate_color_map(s:I1, s:middle, s:I3)
|
||||
let g:airline#themes#distinguished#palette.insert_modified = {}
|
||||
|
||||
let g:airline#themes#distinguished#palette.replace = airline#themes#generate_color_map(s:R1, s:middle, s:R3)
|
||||
let g:airline#themes#distinguished#palette.replace_modified = {}
|
||||
|
||||
let g:airline#themes#distinguished#palette.visual = airline#themes#generate_color_map(s:V1, s:middle, s:V3)
|
||||
let g:airline#themes#distinguished#palette.visual_modified = {}
|
|
@ -320,9 +320,13 @@ vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
|
|||
" default value leaves the name unmodifed
|
||||
let g:airline#extensions#branch#format = 0
|
||||
|
||||
" to only show the tail, e.g. a branch 'feature/foo' show 'foo'
|
||||
" to only show the tail, e.g. a branch 'feature/foo' becomes 'foo', use
|
||||
let g:airline#extensions#branch#format = 1
|
||||
|
||||
" to truncate all path sections but the last one, e.g. a branch
|
||||
" 'foo/bar/baz' becomes 'f/b/baz', use
|
||||
let g:airline#extensions#branch#format = 2
|
||||
|
||||
" if a string is provided, it should be the name of a function that
|
||||
" takes a string and returns the desired value
|
||||
let g:airline#extensions#branch#format = 'CustomBranchName'
|
||||
|
|
|
@ -221,10 +221,9 @@ that are part of Git repositories).
|
|||
|
||||
*fugitive-:Gbrowse*
|
||||
:Gbrowse Open the current file, blob, tree, commit, or tag
|
||||
in your browser at the upstream hosting provider
|
||||
indicated by the "origin" remote. If a range is
|
||||
given, it is appropriately appended to the URL as an
|
||||
anchor.
|
||||
in your browser at the upstream hosting provider.
|
||||
If a range is given, it is appropriately appended to
|
||||
the URL as an anchor.
|
||||
|
||||
Upstream providers can be added by installing an
|
||||
appropriate Vim plugin. For example, GitHub can be
|
||||
|
@ -233,8 +232,11 @@ that are part of Git repositories).
|
|||
support for GitHub is currently included, but that is
|
||||
slated to be removed.)
|
||||
|
||||
If no upstream support is available, a local instance
|
||||
of git-instaweb will be started and used instead.
|
||||
The hosting provider is determined by looking at the
|
||||
remote for the current or specified branch and falls
|
||||
back to "origin". In the special case of a "."
|
||||
remote, a local instance of git-instaweb will be
|
||||
started and used.
|
||||
|
||||
:Gbrowse {revision} Like :Gbrowse, but for a given |fugitive-revision|. A
|
||||
useful value here is -, which ties the URL to the
|
||||
|
|
|
@ -1408,7 +1408,9 @@ function! s:Edit(cmd,bang,...) abort
|
|||
catch /^fugitive:/
|
||||
return 'echoerr v:errmsg'
|
||||
endtry
|
||||
if file !~# '^fugitive:'
|
||||
let file = s:sub(file, '/$', '')
|
||||
endif
|
||||
if a:cmd ==# 'read'
|
||||
return 'silent %delete_|read '.s:fnameescape(file).'|silent 1delete_|diffupdate|'.line('.')
|
||||
else
|
||||
|
@ -2174,11 +2176,18 @@ endfunction
|
|||
|
||||
" Section: Gbrowse
|
||||
|
||||
call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(<bang>0,<line1>,<count>,<f-args>)")
|
||||
call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(<bang>0,<line1>,<count>,<f-args>)")
|
||||
|
||||
function! s:Browse(bang,line1,count,...) abort
|
||||
try
|
||||
let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]\w\+\%(://.\{-\}\)\=$','','') : ''
|
||||
let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)'
|
||||
if a:0
|
||||
let remote = matchstr(join(a:000, ' '),'@\zs\%('.validremote.'\)$')
|
||||
let rev = substitute(join(a:000, ' '),'@\%('.validremote.'\)$','','')
|
||||
else
|
||||
let remote = ''
|
||||
let rev = ''
|
||||
endif
|
||||
if rev ==# ''
|
||||
let expanded = s:buffer().rev()
|
||||
elseif rev ==# ':'
|
||||
|
@ -2189,10 +2198,11 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
let full = s:repo().translate(expanded)
|
||||
let commit = ''
|
||||
if full =~# '^fugitive://'
|
||||
let commit = matchstr(full,'://.*//\zs\w\+')
|
||||
let commit = matchstr(full,'://.*//\zs\w\w\+')
|
||||
let path = matchstr(full,'://.*//\w\+\zs/.*')
|
||||
if commit =~ '..'
|
||||
let type = s:repo().git_chomp('cat-file','-t',commit.s:sub(path,'^/',':'))
|
||||
let branch = matchstr(expanded, '^[^:]*')
|
||||
else
|
||||
let type = 'blob'
|
||||
endif
|
||||
|
@ -2210,6 +2220,9 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
let type = 'blob'
|
||||
endif
|
||||
endif
|
||||
if type ==# 'tree' && !empty(path)
|
||||
let path = s:sub(path, '/\=$', '/')
|
||||
endif
|
||||
if path =~# '^\.git/.*HEAD' && filereadable(s:repo().dir(path[5:-1]))
|
||||
let body = readfile(s:repo().dir(path[5:-1]))[0]
|
||||
if body =~# '^\x\{40\}$'
|
||||
|
@ -2221,35 +2234,54 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
endif
|
||||
endif
|
||||
|
||||
if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]\+\%(://.\{-\}\)\=$'
|
||||
let remote = matchstr(join(a:000, ' '),'@\zs[[:alnum:]_-]\+\%(://.\{-\}\)\=$')
|
||||
elseif path =~# '^\.git/refs/remotes/.'
|
||||
let remote = matchstr(path,'^\.git/refs/remotes/\zs[^/]\+')
|
||||
else
|
||||
let remote = 'origin'
|
||||
let branch = matchstr(rev,'^[[:alnum:]/._-]\+\ze[:^~@]')
|
||||
if branch ==# '' && path =~# '^\.git/refs/\w\+/'
|
||||
let branch = s:sub(path,'^\.git/refs/\w+/','')
|
||||
let merge = ''
|
||||
if path =~# '^\.git/refs/remotes/.'
|
||||
if empty(remote)
|
||||
let remote = matchstr(path, '^\.git/refs/remotes/\zs[^/]\+')
|
||||
endif
|
||||
if filereadable(s:repo().dir('refs/remotes/'.branch))
|
||||
let remote = matchstr(branch,'[^/]\+')
|
||||
let rev = rev[strlen(remote)+1:-1]
|
||||
else
|
||||
if branch ==# ''
|
||||
let branch = matchstr(s:repo().head_ref(),'\<refs/heads/\zs.*')
|
||||
let merge = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
|
||||
let branch = ''
|
||||
let path = '.git/refs/heads/'.merge
|
||||
elseif path =~# '^\.git/refs/heads/.'
|
||||
let branch = path[16:-1]
|
||||
elseif !exists('branch')
|
||||
let branch = s:repo().head()
|
||||
endif
|
||||
if branch != ''
|
||||
let remote = s:repo().git_chomp('config','branch.'.branch.'.remote')
|
||||
if remote =~# '^\.\=$'
|
||||
let remote = 'origin'
|
||||
elseif rev[0:strlen(branch)-1] ==# branch && rev[strlen(branch)] =~# '[:^~@]'
|
||||
let rev = s:repo().git_chomp('config','branch.'.branch.'.merge')[11:-1] . rev[strlen(branch):-1]
|
||||
if !empty(branch)
|
||||
let r = s:repo().git_chomp('config','branch.'.branch.'.remote')
|
||||
let m = s:repo().git_chomp('config','branch.'.branch.'.merge')[11:-1]
|
||||
if r ==# '.' && !empty(m)
|
||||
let r2 = s:repo().git_chomp('config','branch.'.m.'.remote')
|
||||
if r2 !~# '^\.\=$'
|
||||
let r = r2
|
||||
let m = s:repo().git_chomp('config','branch.'.m.'.merge')[11:-1]
|
||||
endif
|
||||
endif
|
||||
if empty(remote)
|
||||
let remote = r
|
||||
endif
|
||||
if r ==# '.' || r ==# remote
|
||||
let merge = m
|
||||
if path =~# '^\.git/refs/heads/.'
|
||||
let path = '.git/refs/heads/'.merge
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(commit) && path !~# '^\.git/'
|
||||
if a:line1 && !a:count && !empty(merge)
|
||||
let commit = merge
|
||||
else
|
||||
let commit = s:repo().rev_parse('HEAD')
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(remote)
|
||||
let remote = '.'
|
||||
let raw = s:repo().git_chomp('config','remote.origin.url')
|
||||
else
|
||||
let raw = s:repo().git_chomp('config','remote.'.remote.'.url')
|
||||
endif
|
||||
if raw ==# ''
|
||||
let raw = remote
|
||||
endif
|
||||
|
@ -2258,7 +2290,7 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
let url = call(Handler, [{
|
||||
\ 'repo': s:repo(),
|
||||
\ 'remote': raw,
|
||||
\ 'revision': rev,
|
||||
\ 'revision': 'No longer provided',
|
||||
\ 'commit': commit,
|
||||
\ 'path': path,
|
||||
\ 'type': type,
|
||||
|
@ -2269,10 +2301,13 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
endif
|
||||
endfor
|
||||
|
||||
if empty(url)
|
||||
call s:throw("Instaweb failed to start and '".remote."' is not a supported remote")
|
||||
if empty(url) && raw ==# '.'
|
||||
call s:throw("Instaweb failed to start")
|
||||
elseif empty(url)
|
||||
call s:throw('"'.remote."' is not a supported remote")
|
||||
endif
|
||||
|
||||
let url = s:gsub(url, '[ <>]', '\="%".printf("%02X",char2nr(submatch(0)))')
|
||||
if a:bang
|
||||
if has('clipboard')
|
||||
let @* = url
|
||||
|
@ -2308,7 +2343,7 @@ function! s:github_url(opts, ...) abort
|
|||
if repo ==# ''
|
||||
return ''
|
||||
endif
|
||||
let path = a:opts.path
|
||||
let path = substitute(a:opts.path, '^/', '', '')
|
||||
if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0
|
||||
let root = 'http://' . s:sub(repo,':','/')
|
||||
else
|
||||
|
@ -2337,7 +2372,7 @@ function! s:github_url(opts, ...) abort
|
|||
endif
|
||||
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
|
||||
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
|
||||
elseif a:opts.type == 'blob'
|
||||
elseif get(a:opts, 'type', '') ==# 'blob' || a:opts.path =~# '[^/]$'
|
||||
let url = root . '/blob/' . commit . '/' . path
|
||||
if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2
|
||||
let url .= '#L' . a:opts.line1
|
||||
|
@ -2351,6 +2386,9 @@ function! s:github_url(opts, ...) abort
|
|||
endfunction
|
||||
|
||||
function! s:instaweb_url(opts) abort
|
||||
if a:opts.remote !=# '.'
|
||||
return ''
|
||||
endif
|
||||
let output = a:opts.repo.git_chomp('instaweb','-b','unknown')
|
||||
if output =~# 'http://'
|
||||
let root = matchstr(output,'http://.*').'/?p='.fnamemodify(a:opts.repo.dir(),':t')
|
||||
|
|
|
@ -27,7 +27,7 @@ function! go#cmd#Build(bang, ...)
|
|||
|
||||
" if we have nvim, call it asynchronously and return early ;)
|
||||
if has('nvim')
|
||||
call go#jobcontrol#Spawn("build", args)
|
||||
call go#jobcontrol#Spawn(a:bang, "build", args)
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -36,6 +36,12 @@ function! go#cmd#Build(bang, ...)
|
|||
let default_makeprg = &makeprg
|
||||
let &makeprg = "go " . join(args, ' ')
|
||||
|
||||
" execute make inside the source folder so we can parse the errors
|
||||
" correctly
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
try
|
||||
execute cd . fnameescape(expand("%:p:h"))
|
||||
if g:go_dispatch_enabled && exists(':Make') == 2
|
||||
call go#util#EchoProgress("building dispatched ...")
|
||||
silent! exe 'Make'
|
||||
|
@ -43,7 +49,9 @@ function! go#cmd#Build(bang, ...)
|
|||
silent! exe 'lmake!'
|
||||
endif
|
||||
redraw!
|
||||
|
||||
finally
|
||||
execute cd . fnameescape(dir)
|
||||
endtry
|
||||
|
||||
let errors = go#list#Get()
|
||||
call go#list#Window(len(errors))
|
||||
|
@ -62,9 +70,9 @@ endfunction
|
|||
|
||||
|
||||
" Run runs the current file (and their dependencies if any) in a new terminal.
|
||||
function! go#cmd#RunTerm(mode)
|
||||
function! go#cmd#RunTerm(bang, mode)
|
||||
let cmd = "go run ". go#util#Shelljoin(go#tool#Files())
|
||||
call go#term#newmode(cmd, a:mode)
|
||||
call go#term#newmode(a:bang, cmd, a:mode)
|
||||
endfunction
|
||||
|
||||
" Run runs the current file (and their dependencies if any) and outputs it.
|
||||
|
@ -73,7 +81,7 @@ endfunction
|
|||
" calling long running apps will block the whole UI.
|
||||
function! go#cmd#Run(bang, ...)
|
||||
if has('nvim')
|
||||
call go#cmd#RunTerm('')
|
||||
call go#cmd#RunTerm(a:bang, '')
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -168,9 +176,9 @@ function! go#cmd#Test(bang, compile, ...)
|
|||
|
||||
if has('nvim')
|
||||
if get(g:, 'go_term_enabled', 0)
|
||||
call go#term#new(["go"] + args)
|
||||
call go#term#new(a:bang, ["go"] + args)
|
||||
else
|
||||
call go#jobcontrol#Spawn("test", args)
|
||||
call go#jobcontrol#Spawn(a:bang, "test", args)
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
@ -195,6 +203,9 @@ function! go#cmd#Test(bang, compile, ...)
|
|||
call go#list#Window(len(errors))
|
||||
if !empty(errors) && !a:bang
|
||||
call go#list#JumpToFirst()
|
||||
elseif empty(errors)
|
||||
" failed to parse errors, output the original content
|
||||
call go#util#EchoError(out)
|
||||
endif
|
||||
echon "vim-go: " | echohl ErrorMsg | echon "[test] FAIL" | echohl None
|
||||
else
|
||||
|
|
|
@ -5,11 +5,11 @@ let s:jobs = {}
|
|||
" Spawn is a wrapper around s:spawn. It can be executed by other files and
|
||||
" scripts if needed. Desc defines the description for printing the status
|
||||
" during the job execution (useful for statusline integration).
|
||||
function! go#jobcontrol#Spawn(desc, args)
|
||||
function! go#jobcontrol#Spawn(bang, desc, args)
|
||||
" autowrite is not enabled for jobs
|
||||
call go#cmd#autowrite()
|
||||
|
||||
let job = s:spawn(a:desc, a:args)
|
||||
let job = s:spawn(a:bang, a:desc, a:args)
|
||||
return job.id
|
||||
endfunction
|
||||
|
||||
|
@ -40,9 +40,10 @@ endfunction
|
|||
" a job is started a reference will be stored inside s:jobs. spawn changes the
|
||||
" GOPATH when g:go_autodetect_gopath is enabled. The job is started inside the
|
||||
" current files folder.
|
||||
function! s:spawn(desc, args)
|
||||
function! s:spawn(bang, desc, args)
|
||||
let job = {
|
||||
\ 'desc': a:desc,
|
||||
\ 'bang': a:bang,
|
||||
\ 'winnr': winnr(),
|
||||
\ 'importpath': go#package#ImportPath(expand('%:p:h')),
|
||||
\ 'state': "RUNNING",
|
||||
|
@ -68,8 +69,8 @@ function! s:spawn(desc, args)
|
|||
endfor
|
||||
|
||||
let dir = getcwd()
|
||||
|
||||
execute cd . fnameescape(expand("%:p:h"))
|
||||
let jobdir = fnameescape(expand("%:p:h"))
|
||||
execute cd . jobdir
|
||||
|
||||
" append the subcommand, such as 'build'
|
||||
let argv = ['go'] + a:args
|
||||
|
@ -77,6 +78,7 @@ function! s:spawn(desc, args)
|
|||
" run, forrest, run!
|
||||
let id = jobstart(argv, job)
|
||||
let job.id = id
|
||||
let job.dir = jobdir
|
||||
let s:jobs[id] = job
|
||||
|
||||
execute cd . fnameescape(dir)
|
||||
|
@ -91,21 +93,9 @@ endfunction
|
|||
" references and also displaying errors in the quickfix window collected by
|
||||
" on_stderr handler. If there are no errors and a quickfix window is open,
|
||||
" it'll be closed.
|
||||
function! s:on_exit(job_id, data)
|
||||
function! s:on_exit(job_id, exit_status)
|
||||
let std_combined = self.stderr + self.stdout
|
||||
if empty(std_combined)
|
||||
call go#list#Clean()
|
||||
call go#list#Window()
|
||||
|
||||
let self.state = "SUCCESS"
|
||||
return
|
||||
endif
|
||||
|
||||
let errors = go#tool#ParseErrors(std_combined)
|
||||
let errors = go#tool#FilterValids(errors)
|
||||
|
||||
if !len(errors)
|
||||
" no errors could be past, just return
|
||||
if a:exit_status == 0
|
||||
call go#list#Clean()
|
||||
call go#list#Window()
|
||||
|
||||
|
@ -115,12 +105,30 @@ function! s:on_exit(job_id, data)
|
|||
|
||||
let self.state = "FAILED"
|
||||
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
try
|
||||
execute cd self.dir
|
||||
let errors = go#tool#ParseErrors(std_combined)
|
||||
let errors = go#tool#FilterValids(errors)
|
||||
finally
|
||||
execute cd . fnameescape(dir)
|
||||
endtry
|
||||
|
||||
if !len(errors)
|
||||
" failed to parse errors, output the original content
|
||||
call go#util#EchoError(std_combined[0])
|
||||
return
|
||||
endif
|
||||
|
||||
" if we are still in the same windows show the list
|
||||
if self.winnr == winnr()
|
||||
call go#list#Populate(errors)
|
||||
call go#list#Window(len(errors))
|
||||
if !empty(errors) && !self.bang
|
||||
call go#list#JumpToFirst()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" on_stdout is the stdout handler for jobstart(). It collects the output of
|
||||
|
|
|
@ -35,6 +35,9 @@ function! go#rename#Rename(bang, ...)
|
|||
call go#list#Window(len(errors))
|
||||
if !empty(errors) && !a:bang
|
||||
call go#list#JumpToFirst()
|
||||
elseif empty(errors)
|
||||
" failed to parse errors, output the original content
|
||||
call go#util#EchoError(out)
|
||||
endif
|
||||
return
|
||||
else
|
||||
|
|
|
@ -7,12 +7,12 @@ let s:jobs = {}
|
|||
|
||||
" new creates a new terminal with the given command. Mode is set based on the
|
||||
" global variable g:go_term_mode, which is by default set to :vsplit
|
||||
function! go#term#new(cmd)
|
||||
call go#term#newmode(a:cmd, g:go_term_mode)
|
||||
function! go#term#new(bang, cmd)
|
||||
call go#term#newmode(a:bang, a:cmd, g:go_term_mode)
|
||||
endfunction
|
||||
|
||||
" new creates a new terminal with the given command and window mode.
|
||||
function! go#term#newmode(cmd, mode)
|
||||
function! go#term#newmode(bang, cmd, mode)
|
||||
let mode = a:mode
|
||||
if empty(mode)
|
||||
let mode = g:go_term_mode
|
||||
|
@ -39,6 +39,7 @@ function! go#term#newmode(cmd, mode)
|
|||
let job = {
|
||||
\ 'stderr' : [],
|
||||
\ 'stdout' : [],
|
||||
\ 'bang' : a:bang,
|
||||
\ 'on_stdout': function('s:on_stdout'),
|
||||
\ 'on_stderr': function('s:on_stderr'),
|
||||
\ 'on_exit' : function('s:on_exit'),
|
||||
|
@ -110,7 +111,9 @@ function! s:on_exit(job_id, data)
|
|||
|
||||
call go#list#Populate(errors)
|
||||
call go#list#Window(len(errors))
|
||||
if !self.bang
|
||||
call go#list#JumpToFirst()
|
||||
endif
|
||||
else
|
||||
call go#list#Clean()
|
||||
call go#list#Window()
|
||||
|
|
|
@ -208,9 +208,17 @@ endif
|
|||
" Spacing errors around the 'chan' keyword
|
||||
if g:go_highlight_chan_whitespace_error != 0
|
||||
" receive-only annotation on chan type
|
||||
syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
|
||||
"
|
||||
" \(\<chan\>\)\@<!<- (only pick arrow when it doesn't come after a chan)
|
||||
" this prevents picking up 'chan<- chan<-' but not '<- chan'
|
||||
syn match goSpaceError display "\(\(\<chan\>\)\@<!<-\)\@<=\s\+\(\<chan\>\)\@="
|
||||
|
||||
" send-only annotation on chan type
|
||||
syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
|
||||
"
|
||||
" \(<-\)\@<!\<chan\> (only pick chan when it doesn't come after an arrow)
|
||||
" this prevents picking up '<-chan <-chan' but not 'chan <-'
|
||||
syn match goSpaceError display "\(\(<-\)\@<!\<chan\>\)\@<=\s\+\(<-\)\@="
|
||||
|
||||
" value-ignoring receives in a few contexts
|
||||
syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
|
||||
endif
|
||||
|
|
19
sources_non_forked/vim-jade/README.markdown
Normal file
19
sources_non_forked/vim-jade/README.markdown
Normal file
|
@ -0,0 +1,19 @@
|
|||
# vim-jade #
|
||||
|
||||
Vim syntax highlighting for Jade templates.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
I prefer to install plugins using Tim Pope's
|
||||
[pathogen.vim](https://github.com/tpope/vim-pathogen). Installation using
|
||||
pathogen is quite simple.
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone git://github.com/digitaltoad/vim-jade.git
|
||||
|
||||
If you do not want to use pathogen. You can always install vim-jade in the
|
||||
normal manner by copying each directory to your ~/.vim directory. Make sure
|
||||
not to overwrite any existing directory of the same name and instead copy only
|
||||
the contents of the source directory to the directory of the same name in your
|
||||
~/.vim directory.
|
2
sources_non_forked/vim-jade/ftdetect/jade.vim
Normal file
2
sources_non_forked/vim-jade/ftdetect/jade.vim
Normal file
|
@ -0,0 +1,2 @@
|
|||
" Jade
|
||||
autocmd BufNewFile,BufReadPost *.jade set filetype=jade
|
57
sources_non_forked/vim-jade/ftplugin/jade.vim
Normal file
57
sources_non_forked/vim-jade/ftplugin/jade.vim
Normal file
|
@ -0,0 +1,57 @@
|
|||
" Vim filetype plugin
|
||||
" Language: Jade
|
||||
" Maintainer: Joshua Borton
|
||||
" Credits: Tim Pope
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo-=C
|
||||
|
||||
setlocal iskeyword+=-
|
||||
|
||||
" Define some defaults in case the included ftplugins don't set them.
|
||||
let s:undo_ftplugin = ""
|
||||
let s:browsefilter = "All Files (*.*)\t*.*\n"
|
||||
let s:match_words = ""
|
||||
|
||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||
unlet! b:did_ftplugin
|
||||
|
||||
" Override our defaults if these were set by an included ftplugin.
|
||||
if exists("b:undo_ftplugin")
|
||||
let s:undo_ftplugin = b:undo_ftplugin
|
||||
unlet b:undo_ftplugin
|
||||
endif
|
||||
if exists("b:browsefilter")
|
||||
let s:browsefilter = b:browsefilter
|
||||
unlet b:browsefilter
|
||||
endif
|
||||
if exists("b:match_words")
|
||||
let s:match_words = b:match_words
|
||||
unlet b:match_words
|
||||
endif
|
||||
|
||||
" Change the browse dialog on Win32 to show mainly Haml-related files
|
||||
if has("gui_win32")
|
||||
let b:browsefilter="Jade Files (*.jade)\t*.jade\n" . s:browsefilter
|
||||
endif
|
||||
|
||||
" Load the combined list of match_words for matchit.vim
|
||||
if exists("loaded_matchit")
|
||||
let b:match_words = s:match_words
|
||||
endif
|
||||
|
||||
setlocal comments=://-,:// commentstring=//\ %s
|
||||
|
||||
setlocal suffixesadd+=.jade
|
||||
|
||||
let b:undo_ftplugin = "setl cms< com< "
|
||||
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
||||
" vim:set sw=2:
|
70
sources_non_forked/vim-jade/indent/jade.vim
Normal file
70
sources_non_forked/vim-jade/indent/jade.vim
Normal file
|
@ -0,0 +1,70 @@
|
|||
" Vim indent file
|
||||
" Language: Jade
|
||||
" Maintainer: Joshua Borton
|
||||
" Credits: Tim Pope (vim-jade)
|
||||
" Last Change: 2010 Sep 22
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
unlet! b:did_indent
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetJadeIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,},],0),!^F
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetJadeIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:attributes = '\%((.\{-\})\)'
|
||||
let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
|
||||
|
||||
if !exists('g:jade_self_closing_tags')
|
||||
let g:jade_self_closing_tags = 'meta|link|img|hr|br|input'
|
||||
endif
|
||||
|
||||
setlocal formatoptions+=r
|
||||
setlocal comments+=n:\|
|
||||
|
||||
function! GetJadeIndent()
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
let line = substitute(getline(lnum),'\s\+$','','')
|
||||
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
|
||||
let lastcol = strlen(line)
|
||||
let line = substitute(line,'^\s\+','','')
|
||||
let indent = indent(lnum)
|
||||
let cindent = indent(v:lnum)
|
||||
let increase = indent + &sw
|
||||
if indent == indent(lnum)
|
||||
let indent = cindent <= indent ? -1 : increase
|
||||
endif
|
||||
|
||||
let group = synIDattr(synID(lnum,lastcol,1),'name')
|
||||
|
||||
if line =~ '^!!!'
|
||||
return indent
|
||||
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
|
||||
return increase
|
||||
elseif line =~ '^\%(if\|else\|unless\|for\|each\|block\|mixin\|append\|case\|when\)'
|
||||
return increase
|
||||
elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
|
||||
return increase
|
||||
elseif line == '-#'
|
||||
return increase
|
||||
elseif line =~? '^\v%('.g:jade_self_closing_tags.')>'
|
||||
return indent
|
||||
elseif group =~? '\v^%(jadeAttributesDelimiter|jadeClass|jadeId|htmlTagName|htmlSpecialTagName|jadeFilter|jadeTagBlockChar)$'
|
||||
return increase
|
||||
else
|
||||
return indent
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set sw=2:
|
104
sources_non_forked/vim-jade/syntax/jade.vim
Normal file
104
sources_non_forked/vim-jade/syntax/jade.vim
Normal file
|
@ -0,0 +1,104 @@
|
|||
" Vim syntax file
|
||||
" Language: Jade
|
||||
" Maintainer: Joshua Borton
|
||||
" Credits: Tim Pope
|
||||
" Filenames: *.jade
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'jade'
|
||||
endif
|
||||
|
||||
silent! syntax include @htmlCoffeescript syntax/coffee.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syntax include @htmlStylus syntax/stylus.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syntax include @htmlCss syntax/css.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syntax include @htmlMarkdown syntax/markdown.vim
|
||||
unlet! b:current_syntax
|
||||
|
||||
syn case match
|
||||
|
||||
syn region javascriptParenthesisBlock start="(" end=")" contains=@htmlJavascript contained keepend
|
||||
syn cluster htmlJavascript add=javascriptParenthesisBlock
|
||||
|
||||
syn region jadeJavascript matchgroup=jadeJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
|
||||
syn region jadeJavascript matchgroup=jadeJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
|
||||
syn cluster jadeTop contains=jadeBegin,jadeComment,jadeHtmlComment,jadeJavascript
|
||||
syn match jadeBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassChar,jadeIdChar,jadePlainChar,jadeJavascript,jadeScriptConditional,jadeScriptStatement,jadePipedText
|
||||
syn match jadeTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@jadeComponent
|
||||
syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeBlockExpansionChar,jadeClassChar,jadePlainChar,jadeJavascript,jadeTagBlockChar,jadeTagInlineText
|
||||
syn match jadeComment '\s*\/\/.*$'
|
||||
syn region jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend
|
||||
syn region jadeHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
|
||||
syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent
|
||||
syn match jadeClassChar "\." contained nextgroup=jadeClass
|
||||
syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar
|
||||
syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId
|
||||
syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
|
||||
syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
|
||||
syn region jadeDocType start="^\s*\(!!!\|doctype\)" end="$"
|
||||
" Unless I'm mistaken, syntax/html.vim requires
|
||||
" that the = sign be present for these matches.
|
||||
" This adds the matches back for jade.
|
||||
syn keyword jadeHtmlArg contained href title
|
||||
|
||||
syn match jadePlainChar "\\" contained
|
||||
syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
|
||||
syn match jadeInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
||||
syn match jadeTagInlineText "\s.*$" contained contains=jadeInterpolation,jadeTextInlineJade
|
||||
syn region jadePipedText matchgroup=jadePipeChar start="|" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadePipedText skipnl
|
||||
syn match jadeTagBlockChar "\.$" contained nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl
|
||||
syn region jadeTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl
|
||||
syn region jadeTagBlockEnd start="\s*\S" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeBegin skipnl
|
||||
syn region jadeTextInlineJade matchgroup=jadeInlineDelimiter start="#\[" end="]" contains=jadeTag keepend
|
||||
|
||||
syn region jadeJavascriptFilter matchgroup=jadeFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript
|
||||
syn region jadeMarkdownFilter matchgroup=jadeFilter start=/^\z(\s*\):\%(markdown\|marked\)\s*$/ end=/^\%(\z1\s\|\s*$\)\@!/ contains=@htmlMarkdown
|
||||
syn region jadeStylusFilter matchgroup=jadeFilter start="^\z(\s*\):stylus\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlStylus
|
||||
syn region jadePlainFilter matchgroup=jadeFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"
|
||||
|
||||
syn match jadeScriptConditional "^\s*\<\%(if\|else\|else if\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
|
||||
syn match jadeScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"
|
||||
syn region jadeScriptLoopRegion start="^\s*\(for \)" end="$" contains=jadeScriptLoopKeywords
|
||||
syn keyword jadeScriptLoopKeywords for in contained
|
||||
|
||||
syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend
|
||||
|
||||
syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
|
||||
syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag
|
||||
syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend
|
||||
|
||||
syn match jadeError "\$" contained
|
||||
|
||||
hi def link jadePlainChar Special
|
||||
hi def link jadeScriptConditional PreProc
|
||||
hi def link jadeScriptLoopKeywords PreProc
|
||||
hi def link jadeScriptStatement PreProc
|
||||
hi def link jadeHtmlArg htmlArg
|
||||
hi def link jadeAttributeString String
|
||||
hi def link jadeAttributesDelimiter Identifier
|
||||
hi def link jadeIdChar Special
|
||||
hi def link jadeClassChar Special
|
||||
hi def link jadeBlockExpansionChar Special
|
||||
hi def link jadePipeChar Special
|
||||
hi def link jadeTagBlockChar Special
|
||||
hi def link jadeId Identifier
|
||||
hi def link jadeClass Type
|
||||
hi def link jadeInterpolationDelimiter Delimiter
|
||||
hi def link jadeInlineDelimiter Delimiter
|
||||
hi def link jadeFilter PreProc
|
||||
hi def link jadeDocType PreProc
|
||||
hi def link jadeComment Comment
|
||||
hi def link jadeCommentBlock Comment
|
||||
hi def link jadeHtmlConditionalComment jadeComment
|
||||
|
||||
let b:current_syntax = "jade"
|
||||
|
||||
if main_syntax == "jade"
|
||||
unlet main_syntax
|
||||
endif
|
|
@ -85,14 +85,14 @@ exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start=
|
|||
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```*.*$" end="^\s*```*\ze\s*$" keepend
|
||||
|
||||
syn match markdownFootnote "\[^[^\]]\+\]"
|
||||
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
|
||||
|
||||
if main_syntax ==# 'markdown'
|
||||
for s:type in g:markdown_fenced_languages
|
||||
exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
|
||||
exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```*\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
|
||||
endfor
|
||||
unlet! s:type
|
||||
endif
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
sudo: false
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.9.3
|
||||
before_install: sudo apt-get install vim-gtk
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- vim-gtk
|
||||
|
||||
before_script:
|
||||
- "export DISPLAY=:99.0"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
diff-lcs (1.2.4)
|
||||
rake (10.0.4)
|
||||
rspec (2.13.0)
|
||||
rspec-core (~> 2.13.0)
|
||||
rspec-expectations (~> 2.13.0)
|
||||
rspec-mocks (~> 2.13.0)
|
||||
rspec-core (2.13.1)
|
||||
rspec-expectations (2.13.0)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.13.1)
|
||||
vimrunner (0.3.0)
|
||||
diff-lcs (1.2.5)
|
||||
rake (10.4.2)
|
||||
rspec (3.4.0)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
rspec-mocks (~> 3.4.0)
|
||||
rspec-core (3.4.1)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-expectations (3.4.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-mocks (3.4.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-support (3.4.1)
|
||||
vimrunner (0.3.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -20,3 +25,6 @@ DEPENDENCIES
|
|||
rake
|
||||
rspec
|
||||
vimrunner
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
|
|
@ -138,6 +138,15 @@ normal mode will "fail to replay" when multiple cursors are active. For example,
|
|||
changing it from `{}` to `{'d':1}` makes normal-mode mappings beginning with `d`
|
||||
(such as `dw` to delete a word) work in multi-cursor mode.
|
||||
|
||||
### ```g:multi_cursor_visual_maps``` (Default: see below)
|
||||
Default value: `{'i':1, 'a':1, 'f':1, 'F':1, 't':1, 'T':1}`
|
||||
|
||||
Any key in this map (values are ignored) will cause multi-cursor _Visual_ mode
|
||||
to pause for map completion just like normal vim. Otherwise keys mapped in
|
||||
visual mode will "fail to replay" when multiple cursors are active. For example,
|
||||
changing it from `{}` to `{'i':1}` makes visual-mode mappings beginning with `i`
|
||||
(such as `it` to select an "inner tag block") work in multi-cursor mode.
|
||||
|
||||
The default list contents should work for anybody, unless they have remapped a
|
||||
key from an operator-pending command to a non-operator-pending command or
|
||||
vice versa.
|
||||
|
@ -193,11 +202,6 @@ highlight link multiple_cursors_visual Visual
|
|||
|
||||
## Known Issues
|
||||
- Select mode is not implemented
|
||||
- `I` and `A` do not work in Visual mode yet (See [#55](../../issues/55))
|
||||
|
||||
Single key command to switch to Insert mode such as `c` or `s` from Visual mode or `i`, `a`, `I`, `A` in Normal mode should work without any issues.
|
||||
|
||||
**NOTE**: Vim's Visual Block mode also supports `I` and `A` commands, however they do not work in this plugin's Visual mode at the moment. For now, to use `I` and `A`, switch to Normal mode by pressing `v` first.
|
||||
|
||||
## Changelog
|
||||
See [CHANGELOG.md](CHANGELOG.md)
|
||||
|
@ -219,6 +223,4 @@ Obviously inspired by Sublime Text's [multiple selection][sublime-multiple-selec
|
|||
[emacs-multiple-cursors]:https://github.com/magnars/multiple-cursors.el
|
||||
|
||||
|
||||
|
||||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/terryma/vim-multiple-cursors/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ function! s:Cursor.new(position)
|
|||
let obj = copy(self)
|
||||
let obj.position = copy(a:position)
|
||||
let obj.visual = []
|
||||
let obj.saved_visual = []
|
||||
" Stores text that was yanked after any commands in Normal or Visual mode
|
||||
let obj.paste_buffer_text = getreg('"')
|
||||
let obj.paste_buffer_type = getregtype('"')
|
||||
|
@ -332,6 +333,7 @@ endfunction
|
|||
|
||||
" Remove the visual selection and its highlight
|
||||
function! s:Cursor.remove_visual_selection() dict
|
||||
let self.saved_visual = deepcopy(self.visual)
|
||||
let self.visual = []
|
||||
" TODO(terryma): Move functionality into separate class
|
||||
call s:cm.remove_highlight(self.visual_hi_id)
|
||||
|
@ -409,6 +411,7 @@ function! s:CursorManager.reset(restore_view, restore_setting, ...) dict
|
|||
let self.saved_winview = []
|
||||
let self.start_from_find = 0
|
||||
let s:char = ''
|
||||
let s:saved_char = ''
|
||||
if a:restore_setting
|
||||
call self.restore_user_settings()
|
||||
endif
|
||||
|
@ -626,6 +629,13 @@ function! s:CursorManager.restore_user_settings() dict
|
|||
call setreg('"', s:paste_buffer_temporary_text, s:paste_buffer_temporary_type)
|
||||
endfunction
|
||||
|
||||
" Reposition all cursors to the start or end of their region
|
||||
function! s:CursorManager.reposition_all_within_region(start) dict
|
||||
for c in self.cursors
|
||||
call c.update_position(c.saved_visual[a:start ? 0 : 1])
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Reselect the current cursor's region in visual mode
|
||||
function! s:CursorManager.reapply_visual_selection() dict
|
||||
call s:select_in_visual_mode(self.get_current().visual)
|
||||
|
@ -670,6 +680,9 @@ endfunction
|
|||
|
||||
" This is the last user input that we're going to replicate, in its string form
|
||||
let s:char = ''
|
||||
" This is either `I` or `A`, as input in Visual mode, that we're going to use
|
||||
" to make the appropriate transition into Insert mode
|
||||
let s:saved_char = ''
|
||||
" This is the mode the user is in before s:char
|
||||
let s:from_mode = ''
|
||||
" This is the mode the user is in after s:char
|
||||
|
@ -898,12 +911,34 @@ endfunction
|
|||
" to be called to continue the fanout process
|
||||
function! s:detect_bad_input()
|
||||
if !s:valid_input
|
||||
" To invoke the appropriate `<Plug>(multiple-cursors-apply)` mapping, we
|
||||
" need to revert back to the mode the user was in when the input was entered
|
||||
call s:revert_mode(s:to_mode, s:from_mode)
|
||||
" We ignore the bad input and force invoke s:apply_user_input_next
|
||||
call feedkeys("\<Plug>(multiple-cursors-apply)")
|
||||
let s:bad_input += 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Complete transition into Insert mode when `I` or `A` is input in Visual mode
|
||||
function! s:handle_visual_IA_to_insert()
|
||||
if !empty(s:saved_char) && s:char =~# 'v\|V' && s:to_mode ==# 'n'
|
||||
if s:saved_char ==# 'I'
|
||||
call s:cm.reposition_all_within_region(1)
|
||||
endif
|
||||
call feedkeys(tolower(s:saved_char))
|
||||
let s:saved_char = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Begin transition into Insert mode when `I` or `A` is input in Visual mode
|
||||
function! s:handle_visual_IA_to_normal()
|
||||
if s:char =~# 'I\|A' && s:from_mode =~# 'v\|V'
|
||||
let s:saved_char = s:char
|
||||
let s:char = s:from_mode " spoof a 'v' or 'V' input to transiton from Visual into Normal mode
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Apply the user input at the next cursor location
|
||||
function! s:apply_user_input_next(mode)
|
||||
let s:valid_input = 1
|
||||
|
@ -931,6 +966,7 @@ function! s:apply_user_input_next(mode)
|
|||
call s:update_visual_markers(s:cm.get_current().visual)
|
||||
endif
|
||||
call feedkeys("\<Plug>(multiple-cursors-wait)")
|
||||
call s:handle_visual_IA_to_insert()
|
||||
else
|
||||
" Continue to next
|
||||
call feedkeys("\<Plug>(multiple-cursors-input)")
|
||||
|
@ -1050,8 +1086,8 @@ endfunction
|
|||
let s:retry_keys = ""
|
||||
function! s:display_error()
|
||||
if s:bad_input == s:cm.size()
|
||||
\ && s:from_mode ==# 'n'
|
||||
\ && has_key(g:multi_cursor_normal_maps, s:char[0])
|
||||
\ && ((s:from_mode ==# 'n' && has_key(g:multi_cursor_normal_maps, s:char[0]))
|
||||
\ || (s:from_mode =~# 'v\|V' && has_key(g:multi_cursor_visual_maps, s:char[0])))
|
||||
" we couldn't replay it anywhere but we're told it's the beginning of a
|
||||
" multi-character map like the `d` in `dw`
|
||||
let s:retry_keys = s:char
|
||||
|
@ -1124,6 +1160,7 @@ function! s:wait_for_user_input(mode)
|
|||
let s:char = s:retry_keys . s:saved_keys
|
||||
if len(s:saved_keys) == 0
|
||||
let s:char .= s:get_char()
|
||||
call s:handle_visual_IA_to_normal()
|
||||
else
|
||||
let s:saved_keys = ""
|
||||
endif
|
||||
|
|
|
@ -177,6 +177,16 @@ normal mode will "fail to replay" when multiple cursors are active. For example,
|
|||
changing it from `{}` to `{'d':1}` makes normal-mode mappings beginning with `d`
|
||||
(such as `dw` to delete a word) work in multi-cursor mode.
|
||||
|
||||
*g:multi_cursor_visual_maps* (Default: )
|
||||
|
||||
Default value: `{'i':1, 'a':1, 'f':1, 'F':1, 't':1, 'T':1}`
|
||||
|
||||
Any key in this map (values are ignored) will cause multi-cursor _Visual_ mode
|
||||
to pause for map completion just like normal vim. Otherwise keys mapped in
|
||||
visual mode will "fail to replay" when multiple cursors are active. For example,
|
||||
changing it from `{}` to `{'i':1}` makes visual-mode mappings beginning with `i`
|
||||
(such as `it` to select an "inner tag block") work in multi-cursor mode.
|
||||
|
||||
The default list contents should work for anybody, unless they have remapped a
|
||||
key from an operator-pending command to a non-operator-pending command or
|
||||
vice versa.
|
||||
|
|
|
@ -42,11 +42,14 @@ let s:settings_if_default = {
|
|||
|
||||
let s:default_insert_maps = {}
|
||||
let s:default_normal_maps = {'!':1, '@':1, '=':1, 'q':1, 'r':1, 't':1, 'T':1, 'y':1, '[':1, ']':1, '\':1, 'd':1, 'f':1, 'F':1, 'g':1, '"':1, 'z':1, 'c':1, 'm':1, '<':1, '>':1}
|
||||
let s:default_visual_maps = {'i':1, 'a':1, 'f':1, 'F':1, 't':1, 'T':1}
|
||||
|
||||
let g:multi_cursor_insert_maps =
|
||||
\ get(g:, 'multi_cursor_insert_maps', s:default_insert_maps)
|
||||
let g:multi_cursor_normal_maps =
|
||||
\ get(g:, 'multi_cursor_normal_maps', s:default_normal_maps)
|
||||
let g:multi_cursor_visual_maps =
|
||||
\ get(g:, 'multi_cursor_visual_maps', s:default_visual_maps)
|
||||
|
||||
call s:init_settings(s:settings)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ def before(string)
|
|||
end
|
||||
|
||||
def after(string)
|
||||
get_file_content().should eq normalize_string_indent(string)
|
||||
expect(get_file_content()).to eq normalize_string_indent(string)
|
||||
end
|
||||
|
||||
def type(string)
|
||||
|
@ -163,6 +163,32 @@ describe "Multiple Cursors when normal_maps is empty" do
|
|||
|
||||
end
|
||||
|
||||
describe "Multiple Cursors when visual_maps is empty" do
|
||||
let(:filename) { 'test.txt' }
|
||||
let(:options) { ['let g:multi_cursor_visual_maps = {}'] }
|
||||
|
||||
# Operator-pending commands are handled correctly thanks to their inclusion
|
||||
# in `g:multi_cursor_visual_maps`.
|
||||
#
|
||||
# When an operator-pending command like 'f' is missing from that setting's
|
||||
# value, then it should result in a no-op, but we should still remain in
|
||||
# multicursor mode.
|
||||
specify "#visual mode 'i'" do
|
||||
before <<-EOF
|
||||
hello world x
|
||||
hello world x
|
||||
EOF
|
||||
|
||||
type 'fw<C-n><C-n>fx<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello x
|
||||
hello x
|
||||
EOF
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "Multiple Cursors" do
|
||||
let(:filename) { 'test.txt' }
|
||||
let(:options) { [] }
|
||||
|
@ -417,6 +443,216 @@ describe "Multiple Cursors" do
|
|||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'i'" do
|
||||
before <<-EOF
|
||||
hi (hello world jan) bye
|
||||
hi (hello world feb) bye
|
||||
hi (hello world mar) bye
|
||||
EOF
|
||||
|
||||
type 'fw<C-n><C-n><C-n>ibcone<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hi (one) bye
|
||||
hi (one) bye
|
||||
hi (one) bye
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'a'" do
|
||||
before <<-EOF
|
||||
hi (hello world jan) bye
|
||||
hi (hello world feb) bye
|
||||
hi (hello world mar) bye
|
||||
EOF
|
||||
|
||||
type 'fw<C-n><C-n><C-n>abcone<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hi one bye
|
||||
hi one bye
|
||||
hi one bye
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'f'" do
|
||||
before <<-EOF
|
||||
hi (hello world jan) bye
|
||||
hi (hello world feb) bye
|
||||
hi (hello world mar) bye
|
||||
EOF
|
||||
|
||||
type 'fw<C-n><C-n><C-n>f)cone<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hi (hello one bye
|
||||
hi (hello one bye
|
||||
hi (hello one bye
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'F'" do
|
||||
before <<-EOF
|
||||
hi (hello world jan) bye
|
||||
hi (hello world feb) bye
|
||||
hi (hello world mar) bye
|
||||
EOF
|
||||
|
||||
type 'fw<C-n><C-n><C-n>F(cbefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hi beforeorld jan) bye
|
||||
hi beforeorld feb) bye
|
||||
hi beforeorld mar) bye
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 't'" do
|
||||
before <<-EOF
|
||||
hello.jan
|
||||
hello hi.feb
|
||||
hello hi bye.mar
|
||||
EOF
|
||||
|
||||
type '<C-n><C-n><C-n>t.cone<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
one.jan
|
||||
one.feb
|
||||
one.mar
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'T'" do
|
||||
before <<-EOF
|
||||
jan.world
|
||||
feb.hi world
|
||||
mar.bye hi world
|
||||
EOF
|
||||
|
||||
type 'fw<C-n><C-n><C-n>T.cbefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
jan.beforeorld
|
||||
feb.beforeorld
|
||||
mar.beforeorld
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual line mode 'f'" do
|
||||
before <<-EOF
|
||||
hello jan world
|
||||
hello feb world
|
||||
hello mar world
|
||||
EOF
|
||||
|
||||
type '<C-n><C-n><C-n>VfwvAafter<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello jan wafterorld
|
||||
hello feb wafterorld
|
||||
hello mar wafterorld
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'I'" do
|
||||
before <<-EOF
|
||||
hello world jan
|
||||
hello world feb
|
||||
hello world mar
|
||||
EOF
|
||||
|
||||
type 'w<C-n><C-n><C-n>Ibefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello beforeworld jan
|
||||
hello beforeworld feb
|
||||
hello beforeworld mar
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#visual mode 'A'" do
|
||||
before <<-EOF
|
||||
hello world jan
|
||||
hello world feb
|
||||
hello world mar
|
||||
EOF
|
||||
|
||||
type 'w<C-n><C-n><C-n>Aafter<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello worldafter jan
|
||||
hello worldafter feb
|
||||
hello worldafter mar
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#resize regions visual mode 'I'" do
|
||||
before <<-EOF
|
||||
hello world jan
|
||||
hello world feb
|
||||
hello world mar
|
||||
EOF
|
||||
|
||||
type 'w<C-n><C-n><C-n>hhhIbefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello beforeworld jan
|
||||
hello beforeworld feb
|
||||
hello beforeworld mar
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#resize regions visual mode 'A'" do
|
||||
before <<-EOF
|
||||
hello world jan
|
||||
hello world feb
|
||||
hello world mar
|
||||
EOF
|
||||
|
||||
type 'w<C-n><C-n><C-n>hhhAbefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello wobeforerld jan
|
||||
hello wobeforerld feb
|
||||
hello wobeforerld mar
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#no word boundries visual mode 'I'" do
|
||||
before <<-EOF
|
||||
hello hibye world
|
||||
hello hibye world
|
||||
hello hibye world
|
||||
EOF
|
||||
|
||||
vim.normal ':MultipleCursorsFind bye<CR>'
|
||||
type 'Ibefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello hibeforebye world
|
||||
hello hibeforebye world
|
||||
hello hibeforebye world
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#variable-length regions visual mode 'I'" do
|
||||
before <<-EOF
|
||||
hello hii world
|
||||
hello hiiii world
|
||||
hello hiiiiii world
|
||||
EOF
|
||||
|
||||
vim.normal ':MultipleCursorsFind \<hi*\><CR>'
|
||||
type 'Ibefore<Esc>'
|
||||
|
||||
after <<-EOF
|
||||
hello beforehii world
|
||||
hello beforehiiii world
|
||||
hello beforehiiiiii world
|
||||
EOF
|
||||
end
|
||||
|
||||
specify "#normal mode 'I'" do
|
||||
before <<-EOF
|
||||
hello
|
||||
|
|
|
@ -169,6 +169,7 @@ so that all users can benefit from them. People can list their snippet reposito
|
|||
* https://github.com/sudar/vim-arduino-snippets (snippets for Arduino files)
|
||||
* https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML)
|
||||
* https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml)
|
||||
* https://github.com/sniphpets (advanced snippets for PHP, Symfony 2/3, Doctrine and etc.)
|
||||
|
||||
Installation using VAM: https://github.com/MarcWeber/vim-addon-manager
|
||||
|
||||
|
|
142
sources_non_forked/vim-snippets/snippets/jinja.snippets
Normal file
142
sources_non_forked/vim-snippets/snippets/jinja.snippets
Normal file
|
@ -0,0 +1,142 @@
|
|||
# Generic tags
|
||||
|
||||
extends html
|
||||
|
||||
snippet %
|
||||
{% ${1} %}
|
||||
snippet %%
|
||||
{% ${1:tag_name} %}
|
||||
${0}
|
||||
{% end$1 %}
|
||||
snippet {
|
||||
{{ ${1} }}
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape
|
||||
{% autoescape ${1:off} %}
|
||||
${0}
|
||||
{% endautoescape %}
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${0}
|
||||
{% endblock %}
|
||||
snippet #
|
||||
{# ${0:comment} #}
|
||||
snippet comment
|
||||
{% comment %}
|
||||
${0}
|
||||
{% endcomment %}
|
||||
snippet cycle
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
snippet debug
|
||||
{% debug %}
|
||||
snippet extends
|
||||
{% extends "${0:base.html}" %}
|
||||
snippet filter
|
||||
{% filter ${1} %}
|
||||
${0}
|
||||
{% endfilter %}
|
||||
snippet firstof
|
||||
{% firstof ${1} %}
|
||||
snippet for
|
||||
{% for ${1} in ${2} %}
|
||||
${0}
|
||||
{% endfor %}
|
||||
snippet empty
|
||||
{% empty %}
|
||||
${0}
|
||||
snippet if
|
||||
{% if ${1} %}
|
||||
${0}
|
||||
{% endif %}
|
||||
snippet el
|
||||
{% else %}
|
||||
${1}
|
||||
snippet eif
|
||||
{% elif ${1} %}
|
||||
${0}
|
||||
snippet ifchanged
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
snippet ifequal
|
||||
{% ifequal ${1} ${2} %}
|
||||
${0}
|
||||
{% endifequal %}
|
||||
snippet ifnotequal
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${0}
|
||||
{% endifnotequal %}
|
||||
snippet include
|
||||
{% include "${0}" %}
|
||||
snippet load
|
||||
{% load ${0} %}
|
||||
snippet now
|
||||
{% now "${0:jS F Y H:i}" %}
|
||||
snippet regroup
|
||||
{% regroup ${1} by ${2} as ${0} %}
|
||||
snippet spaceless
|
||||
{% spaceless %}${0}{% endspaceless %}
|
||||
snippet ssi
|
||||
{% ssi ${0} %}
|
||||
snippet trans
|
||||
{% trans "${0:string}" %}
|
||||
snippet url
|
||||
{% url ${1} as ${0} %}
|
||||
snippet widthratio
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${0:100} %}
|
||||
snippet with
|
||||
{% with ${1} as ${2} %}
|
||||
${0}
|
||||
{% endwith %}
|
||||
|
||||
# Template Filters
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
|
||||
snippet add
|
||||
add:"${0}"
|
||||
snippet center
|
||||
center:"${0}"
|
||||
snippet cut
|
||||
cut:"${0}"
|
||||
snippet date
|
||||
date:"${0}"
|
||||
snippet default
|
||||
default:"${0}"
|
||||
snippet defaultifnone
|
||||
default_if_none:"${0}"
|
||||
snippet dictsort
|
||||
dictsort:"${0}"
|
||||
snippet dictsortrev
|
||||
dictsortreversed:"${0}"
|
||||
snippet divisibleby
|
||||
divisibleby:"${0}"
|
||||
snippet floatformat
|
||||
floatformat:"${0}"
|
||||
snippet getdigit
|
||||
get_digit:"${0}"
|
||||
snippet join
|
||||
join:"${0}"
|
||||
snippet lengthis
|
||||
length_is:"${0}"
|
||||
snippet pluralize
|
||||
pluralize:"${0}"
|
||||
snippet removetags
|
||||
removetags:"${0}"
|
||||
snippet slice
|
||||
slice:"${0}"
|
||||
snippet stringformat
|
||||
stringformat:"${0}"
|
||||
snippet time
|
||||
time:"${0}"
|
||||
snippet truncatewords
|
||||
truncatewords:${0}
|
||||
snippet truncatewordshtml
|
||||
truncatewords_html:${0}
|
||||
snippet urlizetrunc
|
||||
urlizetrunc:${0}
|
||||
snippet wordwrap
|
||||
wordwrap:${0}
|
12
sources_non_forked/vim-snippets/snippets/xml.snippets
Normal file
12
sources_non_forked/vim-snippets/snippets/xml.snippets
Normal file
|
@ -0,0 +1,12 @@
|
|||
# xml declaration
|
||||
snippet xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
# tag
|
||||
snippet t
|
||||
<${1:}>
|
||||
${2}
|
||||
</$1>
|
||||
# inline tag
|
||||
snippet ti
|
||||
<${1:}>${2}</$1>
|
||||
|
|
@ -42,6 +42,7 @@ vim-go https://github.com/fatih/vim-go
|
|||
vim-gitgutter https://github.com/airblade/vim-gitgutter
|
||||
gruvbox https://github.com/morhetz/gruvbox
|
||||
vim-flake8 https://github.com/nvie/vim-flake8
|
||||
vim-jade https://github.com/digitaltoad/vim-jade
|
||||
""".strip()
|
||||
|
||||
GITHUB_ZIP = '%s/archive/master.zip'
|
||||
|
|
Loading…
Reference in a new issue