mirror of
https://github.com/kastdeur/dotfiles.git
synced 2024-11-18 09:23:31 +01:00
166 lines
5.3 KiB
Text
166 lines
5.3 KiB
Text
|
" Author: Mikolaj Machowski <mikmach@wp.pl>
|
|||
|
" (c) Copyright by Mikolaj Machowski 2002-2003
|
|||
|
" License: Vim Charityware
|
|||
|
" Version: 1.6
|
|||
|
"
|
|||
|
" Plik jest w kodowaniu iso-8859-2. Je<4A>li chcesz go uzywac w MS-Windows musisz
|
|||
|
" go przekonwertowac na cp-1250.
|
|||
|
"
|
|||
|
" Plik ten jest cz<63><7A>ci<63> vim-latexSuite, ale:
|
|||
|
" Nie u<>ywaj<61>cy vim-latexSuite (http://vim-latex.sourceforge.net) mog<6F> wyci<63><69>
|
|||
|
" oznaczon<6F> cz<63><7A><EFBFBD>. Reszta mo<6D>e by<62> kopiowana jako osobny plik pod warunkiem
|
|||
|
" niezmieniania tej notki i informacji o prawach autorskich.
|
|||
|
"
|
|||
|
" This file is in iso-8859-2 encoding. If you want to use it in MS-Windows you
|
|||
|
" have to convert it to cp-1250.
|
|||
|
"
|
|||
|
" This file is part of vim-latexSuite but:
|
|||
|
" Those who do not use vim-latexSuite (http://vim-latex.sourceforge.net) can
|
|||
|
" cut off marked part. Rest of the file can be copied as separate file under
|
|||
|
" condition of leaving this notice and information about copyrights unchanged.
|
|||
|
|
|||
|
if exists("acromake_package_file")
|
|||
|
finish
|
|||
|
endif
|
|||
|
let acromake_package_file = 1
|
|||
|
|
|||
|
" --------8<-------------
|
|||
|
" Czesc odpowiedzialna za menu
|
|||
|
let g:TeX_package_option_polski =
|
|||
|
\'OT1,OT4,T1,QX,plmath,nomathsymbols,MeX,prefixingverb,noprefixingverb'
|
|||
|
let g:TeX_package_polski =
|
|||
|
\'sbr:Dywiz&Ska,'.
|
|||
|
\'nor:dywiz,'.
|
|||
|
\'nor:ppauza,'.
|
|||
|
\'nor:pauza,'.
|
|||
|
\'nor:prefixing,'.
|
|||
|
\'nor:nonprefixing,'.
|
|||
|
\'nor:PLdateending,'.
|
|||
|
\'sbr:Matematyka,'.
|
|||
|
\'nor:arccos,'.
|
|||
|
\'nor:arcctan,'.
|
|||
|
\'nor:arcsin,'.
|
|||
|
\'nor:arctan,'.
|
|||
|
\'nor:cot,'.
|
|||
|
\'nor:ctanh,'.
|
|||
|
\'nor:tan,'.
|
|||
|
\'nor:tanh,'.
|
|||
|
\'bra:arc,'.
|
|||
|
\'nor:ctg,'.
|
|||
|
\'nor:ctgh,'.
|
|||
|
\'nor:tg,'.
|
|||
|
\'nor:tgh,'.
|
|||
|
\'nor:nwd'
|
|||
|
|
|||
|
" To wymaga calego pakietu vim-latexSuite - zakomentuj lub wytnij je<6A>li nie
|
|||
|
" u<>ywasz (albo go <20>ci<63>gnij z http://vim-latex.sf.net)
|
|||
|
function! TPackagePolskiTylda()
|
|||
|
call IMAP (" ---", "~---", "tex")
|
|||
|
endfunction
|
|||
|
call TPackagePolskiTylda()
|
|||
|
" --------8<-------------
|
|||
|
|
|||
|
" Polskie znaki cudzyslowow
|
|||
|
TexLet g:Tex_SmartQuoteOpen = ",,"
|
|||
|
TexLet g:Tex_SmartQuoteClose = "''"
|
|||
|
|
|||
|
" Zmodyfikowana i rozwinieta funkcja Andrzeja Ostruszki
|
|||
|
" Z dodatkiem od Benjiego Fishera (sprawdzanie sk<73>adni)
|
|||
|
"
|
|||
|
" Spacja
|
|||
|
inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR>
|
|||
|
inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR>
|
|||
|
|
|||
|
" Wymuszenie tyldy
|
|||
|
inoremap <buffer> <silent> <S-Space> ~
|
|||
|
|
|||
|
" Wymuszenie zwyklej spacji
|
|||
|
inoremap <buffer> <silent> <C-Space> <Space>
|
|||
|
|
|||
|
" Latwe przelaczanie sie miedzy magiczna spacja a zwykla
|
|||
|
inoremap <buffer> <silent> <F8> <C-R>=<SID>TogglePolishSpace()<CR>
|
|||
|
|
|||
|
function! s:TogglePolishSpace()
|
|||
|
if !exists("b:polishspace")
|
|||
|
iunmap <buffer> <Space>
|
|||
|
iunmap <buffer> <CR>
|
|||
|
let b:polishspace = 1
|
|||
|
return ''
|
|||
|
else
|
|||
|
inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR>
|
|||
|
inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR>
|
|||
|
unlet b:polishspace
|
|||
|
return ''
|
|||
|
endif
|
|||
|
endfunction
|
|||
|
|
|||
|
|
|||
|
function! s:Tex_polish_space()
|
|||
|
"Nic magicznego w matematyce
|
|||
|
if synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath\|^texZone\^texRefZone'
|
|||
|
return ' '
|
|||
|
else
|
|||
|
let s:col = col('.')
|
|||
|
let s:linelength = strlen(getline('.')) + 1
|
|||
|
" Wstaw tylde po spojnikach
|
|||
|
if strpart(getline('.'), col('.') - 3, 2) =~? '^[[:space:]~(\[{]\?[aiouwz]$'
|
|||
|
return '~'
|
|||
|
" Wstaw tylde po inicjalach - konkretnie po pojedynczych wielkich
|
|||
|
" literach i kropce. Obs<62>uguje poprawnie wiekszosc sytuacji.
|
|||
|
elseif strpart(getline('.'), col('.') - 4, 3) =~? '^[[:space:]~(\[{]\?\u\.$'
|
|||
|
return '~'
|
|||
|
" Wstaw tylde po tytulach, skrotach bibliograficznych, podpisach
|
|||
|
elseif strpart(getline('.'), col('.') - 9, 8) =~? '\(\s\|^\|\~\)\(str\.\|ryc\.\|rys\.\|tab\.\|art\.\|vol\.\|nr\|tabl\.\|rozdz\.\|ss\.\|s\.\|t\.\|z\.\|sir\|prof\.\|hab\.\|red\.\|min\.\|gen\.\|kpt\.\|przew\.\|p<>k\|mjr\|mgr\|bp\|ks\.\|o\+\.\|<7C>w\.\|dr\)$'
|
|||
|
return '~'
|
|||
|
" Wstaw tylde miedzy rokiem, wiekiem, a odpowiednim skrotem
|
|||
|
elseif strpart(getline('.'), col('.') - 8, 7) =~? '[0-9IVXLCM]\s\+\(r\|w\)\.[^a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}$'
|
|||
|
s/[0-9IVXLCM]\zs\s\+\ze\(w\|r\)\.[^a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}\%#/\~/ei
|
|||
|
exe 'normal '.s:col.'|'
|
|||
|
if s:col == s:linelength
|
|||
|
startinsert!
|
|||
|
else
|
|||
|
startinsert
|
|||
|
endif
|
|||
|
return ' '
|
|||
|
" Wstaw tylde miedzy liczba a miara, itd.
|
|||
|
elseif strpart(getline('.'), col('.') - 10, 9) =~? '\(\d\|mln\|mld\|tys\.\)\s\+\(z<>\|gr\|ha\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}$'
|
|||
|
s/\(\d\|mln\|mld\|tys\.\)\zs\s\+\ze\(z<>\|gr\|ha\|m\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}\%#/\~/ei
|
|||
|
exe 'normal '.s:col.'|'
|
|||
|
if s:col == s:linelength
|
|||
|
startinsert!
|
|||
|
else
|
|||
|
startinsert
|
|||
|
endif
|
|||
|
return ' '
|
|||
|
" Rozwin myslnik w zbitkach w '\dywiz ':
|
|||
|
" bialo-czerwony -> bialo\dywiz czerwony
|
|||
|
elseif strpart(getline('.'), col('.') - 20, 19) =~? '[a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]-[a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}[^a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}$'
|
|||
|
s/[a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\zs-\ze[a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}[^a-z<><7A><EFBFBD><EFBFBD><EFBFBD>]\{-}\%#/\\dywiz /ei
|
|||
|
let colb = s:col + 6
|
|||
|
exe 'normal '.colb.'|'
|
|||
|
if s:col == s:linelength
|
|||
|
startinsert!
|
|||
|
else
|
|||
|
startinsert
|
|||
|
endif
|
|||
|
return ' '
|
|||
|
" Rozwin '--' miedzy liczbami w '\ppauza ':
|
|||
|
" 39--45 -> 39\ppauza 45
|
|||
|
elseif strpart(getline('.'), col('.') - 10, 9) =~? '[0-9IVXLCM]--[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}$'
|
|||
|
s/[0-9IVXLCM]\zs--\ze[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}\%#/\\ppauza /ei
|
|||
|
let colb = s:col + 6
|
|||
|
exe 'normal '.colb.'|'
|
|||
|
if s:col == s:linelength
|
|||
|
startinsert!
|
|||
|
else
|
|||
|
startinsert
|
|||
|
endif
|
|||
|
return ' '
|
|||
|
endif
|
|||
|
" Tu koncz komentowanie ostatniej sekcji
|
|||
|
endif
|
|||
|
return " "
|
|||
|
endfunction
|
|||
|
|
|||
|
" vim:ft=vim:ff=unix:
|