mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Asciidoc support
This commit is contained in:
48
vimrc
48
vimrc
@@ -206,6 +206,12 @@ map <F3> :call <SID>CycleDiffAlgorithm()<cr>
|
|||||||
map <F4> :call <SID>ToggleHex()<cr>
|
map <F4> :call <SID>ToggleHex()<cr>
|
||||||
" }}}
|
" }}}
|
||||||
"FileTypes: specific vim behaviour {{{
|
"FileTypes: specific vim behaviour {{{
|
||||||
|
function s:SetAsciiDoc() "{{{2
|
||||||
|
" AsciiDoc specific options
|
||||||
|
setlocal makeprg=asciidoc\ -b\ html5\ \"%\"
|
||||||
|
map <S-F5> :ShowInBrowser<CR>
|
||||||
|
endfunction
|
||||||
|
"}}}
|
||||||
function s:SetPythonSettings() "{{{2
|
function s:SetPythonSettings() "{{{2
|
||||||
" Python specific options
|
" Python specific options
|
||||||
setlocal cinkeys-=0#
|
setlocal cinkeys-=0#
|
||||||
@@ -252,18 +258,7 @@ function s:SetMarkdownSettings() "{{{2
|
|||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal formatoptions=tcq "set VIms default
|
setlocal formatoptions=tcq "set VIms default
|
||||||
|
|
||||||
function! <SID>ShowInBrowser()
|
map <S-F5> :ShowInBrowser<CR>
|
||||||
let l:uri = expand("%:p:r") . ".html"
|
|
||||||
call system(g:browser . " " . l:uri)
|
|
||||||
echohl Statement
|
|
||||||
echo "Opened '" . l:uri ."' in " . g:browser
|
|
||||||
echohl None
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if !exists(":ShowInBrowser")
|
|
||||||
command ShowInBrowser call s:ShowInBrowser()
|
|
||||||
map <S-F5> :ShowInBrowser<CR>
|
|
||||||
endif
|
|
||||||
|
|
||||||
" autocmd BufWritePost *.md :silent make
|
" autocmd BufWritePost *.md :silent make
|
||||||
endfunction
|
endfunction
|
||||||
@@ -312,20 +307,7 @@ function s:SetRestSettings() "{{{2
|
|||||||
setlocal formatoptions=tcq "set VIms default
|
setlocal formatoptions=tcq "set VIms default
|
||||||
syn spell toplevel
|
syn spell toplevel
|
||||||
|
|
||||||
function! <SID>ShowInBrowser()
|
map <S-F5> :ShowInBrowser<CR>
|
||||||
let l:uri = expand("%:p:r") . ".html"
|
|
||||||
silent make
|
|
||||||
call system(g:browser . " " . l:uri)
|
|
||||||
|
|
||||||
echohl Statement
|
|
||||||
echo "Opened '" . l:uri ."' in " . g:browser
|
|
||||||
echohl None
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if !exists(":ShowInBrowser")
|
|
||||||
command ShowInBrowser call s:ShowInBrowser()
|
|
||||||
map <S-F5> :ShowInBrowser<CR>
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! WordFrequency() range
|
function! WordFrequency() range
|
||||||
let all = split(join(getline(a:firstline, a:lastline)), '\k\+')
|
let all = split(join(getline(a:firstline, a:lastline)), '\k\+')
|
||||||
@@ -380,6 +362,7 @@ autocmd BufRead *.ass, *asm set filetype=kickass
|
|||||||
autocmd WinEnter * setlocal cursorline
|
autocmd WinEnter * setlocal cursorline
|
||||||
autocmd WinLeave * setlocal nocursorline
|
autocmd WinLeave * setlocal nocursorline
|
||||||
|
|
||||||
|
autocmd FileType asciidoc call <SID>SetAsciiDoc()
|
||||||
autocmd FileType python call <SID>SetPythonSettings()
|
autocmd FileType python call <SID>SetPythonSettings()
|
||||||
autocmd FileType json call <SID>SetJavaScriptSettings()
|
autocmd FileType json call <SID>SetJavaScriptSettings()
|
||||||
autocmd FileType javascript call <SID>SetJavaScriptSettings()
|
autocmd FileType javascript call <SID>SetJavaScriptSettings()
|
||||||
@@ -577,6 +560,19 @@ endfunction
|
|||||||
"}}}
|
"}}}
|
||||||
" FUNCTIONS: usefull functions for all of the files {{{
|
" FUNCTIONS: usefull functions for all of the files {{{
|
||||||
|
|
||||||
|
" open file in a browser. Usefull for documentation filetypes like reST, md or
|
||||||
|
" asciidoc
|
||||||
|
function! <SID>ShowInBrowser()
|
||||||
|
let l:uri = expand("%:p:r") . ".html"
|
||||||
|
silent make
|
||||||
|
call system(g:browser . " " . l:uri)
|
||||||
|
|
||||||
|
echohl Statement
|
||||||
|
echo "Opened '" . l:uri ."' in " . g:browser
|
||||||
|
echohl None
|
||||||
|
endfunction
|
||||||
|
command ShowInBrowser call s:ShowInBrowser()
|
||||||
|
|
||||||
" Simple wrapper for :make command
|
" Simple wrapper for :make command
|
||||||
function <SID>Make()
|
function <SID>Make()
|
||||||
echohl Statement
|
echohl Statement
|
||||||
|
|||||||
Reference in New Issue
Block a user