~spacexplorer/+junk/myenv

« back to all changes in this revision

Viewing changes to vim/vim/ftplugin/latex-suite/packages/polski

  • Committer: Kim Allamandola
  • Date: 2011-05-02 05:39:17 UTC
  • Revision ID: spacexplorer@gmail.com-20110502053917-x0yl2lr9ri4yskr2
Init import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
" Author: Mikolaj Machowski <mikmach@wp.pl>
 
2
" (c) Copyright by Mikolaj Machowski 2002-2003
 
3
" License: Vim Charityware
 
4
" Version: 1.6 
 
5
"
 
6
" Plik jest w kodowaniu iso-8859-2. Je�li chcesz go uzywac w MS-Windows musisz
 
7
" go przekonwertowac na cp-1250. 
 
8
"
 
9
" Plik ten jest cz�ci� vim-latexSuite, ale:
 
10
" Nie u�ywaj�cy vim-latexSuite (http://vim-latex.sourceforge.net) mog� wyci��
 
11
" oznaczon� cz��. Reszta mo�e by� kopiowana jako osobny plik pod warunkiem
 
12
" niezmieniania tej notki i informacji o prawach autorskich.
 
13
"
 
14
" This file is in iso-8859-2 encoding. If you want to use it in MS-Windows you
 
15
" have to convert it to cp-1250.
 
16
"
 
17
" This file is part of vim-latexSuite but:
 
18
" Those who do not use vim-latexSuite (http://vim-latex.sourceforge.net) can
 
19
" cut off marked part. Rest of the file can be copied as separate file under
 
20
" condition of leaving this notice and information about copyrights unchanged.
 
21
 
 
22
if exists("acromake_package_file")
 
23
        finish
 
24
endif
 
25
let acromake_package_file = 1
 
26
 
 
27
" --------8<-------------
 
28
" Czesc odpowiedzialna za menu
 
29
let g:TeX_package_option_polski =
 
30
\'OT1,OT4,T1,QX,plmath,nomathsymbols,MeX,prefixingverb,noprefixingverb'
 
31
let g:TeX_package_polski = 
 
32
\'sbr:Dywiz&Ska,'.
 
33
\'nor:dywiz,'.
 
34
\'nor:ppauza,'.
 
35
\'nor:pauza,'.
 
36
\'nor:prefixing,'.
 
37
\'nor:nonprefixing,'.
 
38
\'nor:PLdateending,'.
 
39
\'sbr:Matematyka,'.
 
40
\'nor:arccos,'.
 
41
\'nor:arcctan,'.
 
42
\'nor:arcsin,'.
 
43
\'nor:arctan,'.
 
44
\'nor:cot,'.
 
45
\'nor:ctanh,'.
 
46
\'nor:tan,'.
 
47
\'nor:tanh,'.
 
48
\'bra:arc,'.
 
49
\'nor:ctg,'.
 
50
\'nor:ctgh,'.
 
51
\'nor:tg,'.
 
52
\'nor:tgh,'.
 
53
\'nor:nwd'
 
54
 
 
55
" To wymaga calego pakietu vim-latexSuite - zakomentuj lub wytnij je�li nie
 
56
" u�ywasz (albo go �ci�gnij z http://vim-latex.sf.net)
 
57
function! TPackagePolskiTylda()
 
58
        call IMAP (" ---", "~---", "tex")
 
59
endfunction
 
60
call TPackagePolskiTylda()
 
61
" --------8<-------------
 
62
 
 
63
" Polskie znaki cudzyslowow 
 
64
TexLet g:Tex_SmartQuoteOpen = ",,"
 
65
TexLet g:Tex_SmartQuoteClose = "''"
 
66
 
 
67
" Zmodyfikowana i rozwinieta funkcja Andrzeja Ostruszki
 
68
" Z dodatkiem od Benjiego Fishera (sprawdzanie sk�adni)
 
69
"
 
70
" Spacja
 
71
inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR>
 
72
inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR>
 
73
 
 
74
" Wymuszenie tyldy
 
75
inoremap <buffer> <silent> <S-Space> ~
 
76
 
 
77
" Wymuszenie zwyklej spacji
 
78
inoremap <buffer> <silent> <C-Space> <Space>
 
79
 
 
80
" Latwe przelaczanie sie miedzy magiczna spacja a zwykla
 
81
inoremap <buffer> <silent> <F8> <C-R>=<SID>TogglePolishSpace()<CR>
 
82
 
 
83
function! s:TogglePolishSpace()
 
84
    if !exists("b:polishspace")
 
85
        iunmap <buffer> <Space>
 
86
        iunmap <buffer> <CR>
 
87
        let b:polishspace = 1
 
88
                return ''
 
89
    else
 
90
        inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR>
 
91
        inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR>
 
92
        unlet b:polishspace
 
93
                return ''
 
94
    endif
 
95
endfunction
 
96
 
 
97
 
 
98
function! s:Tex_polish_space()
 
99
        "Nic magicznego w matematyce
 
100
         if synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath\|^texZone\^texRefZone'
 
101
                 return ' '
 
102
         else
 
103
                let s:col = col('.')
 
104
                let s:linelength = strlen(getline('.')) + 1
 
105
                " Wstaw tylde po spojnikach
 
106
                if strpart(getline('.'), col('.') - 3, 2) =~? '^[[:space:]~(\[{]\?[aiouwz]$'
 
107
                        return '~'
 
108
            " Wstaw tylde po inicjalach - konkretnie po pojedynczych wielkich
 
109
                " literach i kropce. Obs�uguje poprawnie wiekszosc sytuacji.
 
110
                elseif strpart(getline('.'), col('.') - 4, 3) =~? '^[[:space:]~(\[{]\?\u\.$'
 
111
                        return '~'
 
112
                " Wstaw tylde po tytulach, skrotach bibliograficznych, podpisach
 
113
                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\+\.\|�w\.\|dr\)$'
 
114
                        return '~'
 
115
                " Wstaw tylde miedzy rokiem, wiekiem, a odpowiednim skrotem
 
116
                elseif strpart(getline('.'), col('.') - 8, 7) =~? '[0-9IVXLCM]\s\+\(r\|w\)\.[^a-z����󶿼]\{-}$'
 
117
                        s/[0-9IVXLCM]\zs\s\+\ze\(w\|r\)\.[^a-z����󶿼]\{-}\%#/\~/ei
 
118
                        exe 'normal '.s:col.'|'
 
119
                        if s:col == s:linelength
 
120
                                startinsert!
 
121
                        else
 
122
                                startinsert
 
123
                        endif
 
124
                        return ' '
 
125
                " Wstaw tylde miedzy liczba a miara, itd.
 
126
                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����󶿼]\{-}$'
 
127
                        s/\(\d\|mln\|mld\|tys\.\)\zs\s\+\ze\(z�\|gr\|ha\|m\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z����󶿼]\{-}\%#/\~/ei
 
128
                        exe 'normal '.s:col.'|'
 
129
                        if s:col == s:linelength
 
130
                                startinsert!
 
131
                        else
 
132
                                startinsert
 
133
                        endif
 
134
                        return ' '
 
135
                " Rozwin myslnik w zbitkach w '\dywiz ':
 
136
                " bialo-czerwony -> bialo\dywiz czerwony
 
137
                elseif strpart(getline('.'), col('.') - 20, 19) =~? '[a-z����󶿼]-[a-z����󶿼]\{-}[^a-z����󶿼]\{-}$'
 
138
                        s/[a-z����󶿼]\zs-\ze[a-z����󶿼]\{-}[^a-z����󶿼]\{-}\%#/\\dywiz /ei
 
139
                        let colb = s:col + 6
 
140
                        exe 'normal '.colb.'|'
 
141
                        if s:col == s:linelength
 
142
                                startinsert!
 
143
                        else
 
144
                                startinsert
 
145
                        endif
 
146
                        return ' '
 
147
                " Rozwin '--' miedzy liczbami w '\ppauza ':
 
148
                " 39--45 -> 39\ppauza 45
 
149
                elseif strpart(getline('.'), col('.') - 10, 9) =~? '[0-9IVXLCM]--[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}$'
 
150
                        s/[0-9IVXLCM]\zs--\ze[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}\%#/\\ppauza /ei
 
151
                        let colb = s:col + 6
 
152
                        exe 'normal '.colb.'|'
 
153
                        if s:col == s:linelength
 
154
                                startinsert!
 
155
                        else
 
156
                                startinsert
 
157
                        endif
 
158
                        return ' '
 
159
                endif
 
160
                " Tu koncz komentowanie ostatniej sekcji
 
161
        endif
 
162
        return " "
 
163
endfunction 
 
164
 
 
165
" vim:ft=vim:ff=unix: