mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-19 00:43:41 -05:00
Run scripts/build with changes
This commit is contained in:
@@ -4,7 +4,7 @@ endif
|
||||
|
||||
"TODO print messages when on visual mode. I only see VISUAL, not the messages.
|
||||
|
||||
" Function interface phylosophy:
|
||||
" Function interface philosophy:
|
||||
"
|
||||
" - functions take arbitrary line numbers as parameters.
|
||||
" Current cursor line is only a suitable default parameter.
|
||||
@@ -60,7 +60,7 @@ let s:levelRegexpDict = {
|
||||
\ 6: '\v^######[^#]@='
|
||||
\ }
|
||||
|
||||
" Maches any header level of any type.
|
||||
" Matches any header level of any type.
|
||||
"
|
||||
" This could be deduced from `s:levelRegexpDict`, but it is more
|
||||
" efficient to have a single regexp for this.
|
||||
@@ -498,7 +498,9 @@ endfunction
|
||||
function! s:SetexToAtx(line1, line2)
|
||||
let l:originalNumLines = line('$')
|
||||
execute 'silent! ' . a:line1 . ',' . a:line2 . 'substitute/\v(.*\S.*)\n\=+$/# \1/'
|
||||
execute 'silent! ' . a:line1 . ',' . a:line2 . 'substitute/\v(.*\S.*)\n-+$/## \1/'
|
||||
|
||||
let l:changed = l:originalNumLines - line('$')
|
||||
execute 'silent! ' . a:line1 . ',' . (a:line2 - l:changed) . 'substitute/\v(.*\S.*)\n-+$/## \1'
|
||||
return l:originalNumLines - line('$')
|
||||
endfunction
|
||||
|
||||
@@ -540,6 +542,19 @@ endfunction
|
||||
"
|
||||
function! s:TableFormat()
|
||||
let l:pos = getpos('.')
|
||||
|
||||
if get(g:, 'vim_markdown_borderless_table', 0)
|
||||
" add `|` to the beginning of the line if it isn't present
|
||||
normal! {
|
||||
call search('|')
|
||||
execute 'silent .,''}s/\v^(\s{0,})\|?([^\|])/\1|\2/e'
|
||||
|
||||
" add `|` to the end of the line if it isn't present
|
||||
normal! {
|
||||
call search('|')
|
||||
execute 'silent .,''}s/\v([^\|])\|?(\s{0,})$/\1|\2/e'
|
||||
endif
|
||||
|
||||
normal! {
|
||||
" Search instead of `normal! j` because of the table at beginning of file edge case.
|
||||
call search('|')
|
||||
@@ -550,7 +565,7 @@ function! s:TableFormat()
|
||||
let l:flags = (&gdefault ? '' : 'g')
|
||||
execute 's/\(:\@<!-:\@!\|[^|:-]\)//e' . l:flags
|
||||
execute 's/--/-/e' . l:flags
|
||||
Tabularize /|
|
||||
Tabularize /\(\\\)\@<!|
|
||||
" Move colons for alignment to left or right side of the cell.
|
||||
execute 's/:\( \+\)|/\1:|/e' . l:flags
|
||||
execute 's/|\( \+\):/|:\1/e' . l:flags
|
||||
@@ -658,7 +673,12 @@ endfunction
|
||||
function! s:OpenUrlUnderCursor()
|
||||
let l:url = s:Markdown_GetUrlForPosition(line('.'), col('.'))
|
||||
if l:url !=# ''
|
||||
call s:VersionAwareNetrwBrowseX(l:url)
|
||||
if l:url =~? 'http[s]\?:\/\/[[:alnum:]%\/_#.-]*'
|
||||
"Do nothing
|
||||
else
|
||||
let l:url = expand(expand('%:h').'/'.l:url)
|
||||
endif
|
||||
call s:VersionAwareNetrwBrowseX(l:url)
|
||||
else
|
||||
echomsg 'The cursor is not on a link.'
|
||||
endif
|
||||
@@ -716,7 +736,7 @@ if !exists('*s:EditUrlUnderCursor')
|
||||
execute l:editmethod l:url
|
||||
endif
|
||||
if l:anchor !=# ''
|
||||
silent! execute '/'.l:anchor
|
||||
call search(l:anchor, 's')
|
||||
endif
|
||||
else
|
||||
execute l:editmethod . ' <cfile>'
|
||||
@@ -762,7 +782,7 @@ endif
|
||||
command! -buffer -range=% HeaderDecrease call s:HeaderDecrease(<line1>, <line2>)
|
||||
command! -buffer -range=% HeaderIncrease call s:HeaderDecrease(<line1>, <line2>, 1)
|
||||
command! -buffer -range=% SetexToAtx call s:SetexToAtx(<line1>, <line2>)
|
||||
command! -buffer TableFormat call s:TableFormat()
|
||||
command! -buffer -range TableFormat call s:TableFormat()
|
||||
command! -buffer Toc call s:Toc()
|
||||
command! -buffer Toch call s:Toc('horizontal')
|
||||
command! -buffer Tocv call s:Toc('vertical')
|
||||
@@ -858,19 +878,23 @@ function! s:SyntaxInclude(filetype)
|
||||
return grouplistname
|
||||
endfunction
|
||||
|
||||
function! s:IsHighlightSourcesEnabledForBuffer()
|
||||
" Enable for markdown buffers, and for liquid buffers with markdown format
|
||||
return &filetype =~# 'markdown' || get(b:, 'liquid_subtype', '') =~# 'markdown'
|
||||
endfunction
|
||||
|
||||
function! s:MarkdownRefreshSyntax(force)
|
||||
" Use != to compare &syntax's value to use the same logic run on
|
||||
" $VIMRUNTIME/syntax/synload.vim.
|
||||
"
|
||||
" vint: next-line -ProhibitEqualTildeOperator
|
||||
if &filetype =~# 'markdown' && line('$') > 1 && &syntax != 'OFF'
|
||||
if s:IsHighlightSourcesEnabledForBuffer() && line('$') > 1 && &syntax != 'OFF'
|
||||
call s:MarkdownHighlightSources(a:force)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:MarkdownClearSyntaxVariables()
|
||||
if &filetype =~# 'markdown'
|
||||
if s:IsHighlightSourcesEnabledForBuffer()
|
||||
unlet! b:mkd_included_filetypes
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user