Re: Esperanto dictionary

2007-04-20 Thread Cyril Slobin

On 4/20/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


Please take the existing $VIMRUNTIME/spell/eo/main.aap and modify it a
bit to build the .spl file.  This can't be very difficult, you would  mostly use
the command you type manually.


OK, I'll try this. Probably tomorrow.


What is strange is that myspell uses eo_l3 and you have eo_EO and eo_UX.
Why two regions?


Esperanto language uses some letters from Latin3 character set. Of
course, they are in Unicode too. But during half-century in
ASCII-based world there was established some conventions for
transcribing these letters in pure ASCII. There are still some
disagreements which one is most popular, or most standard, or most
suitable, but I believe that Cxirkaux-convention is most widely used
(no, I can't prove this with statistics). The convention is named
Cxirkaux after transcription of the word Ĉirkaŭ (I hope you have
an appropriate font installed to read this). It is handy to be able to
check Esperanto text in both modes (or choose any one of two).
Probably to make two files -- eo.ascii.spl and eo.utf-8.spl -- will be
theoretically more pure, but my solution allows to switch between two
modes fast.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: Esperanto dictionary

2007-04-20 Thread Cyril Slobin

On 4/21/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


OK.  So when the user does :set spl=eo_eo he still gets the pure
version?  It's important that the user has a choice of what words he
wants to accept.


Yes. Setting eo_eo accepts unicode Ĉirkaŭ only, setting eo_ux accepts
ascii Cxirkaux only, setting eo accepts both.

And again -- I have not tested latin3 version of spl file, I never use latin3.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: CLTR-N and enter

2007-04-17 Thread Cyril Slobin

On 4/17/07, Eric Leenman [EMAIL PROTECTED] wrote:


Is it possible to select the right word with another key then the enter-key,
and thus staying on the same line before CTRL-N was pressed at all?


Any key expect selection movement keys works. In particular, space key
is my favorite. ;-)

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: Making vim more friendly under windows with non ascii codepage

2007-04-15 Thread Cyril Slobin

Hi!

On 4/15/07, Pavel Shevaev [EMAIL PROTECTED] wrote:


I often type in vim using cp1251 charset under windows and currently I
have to switch to english charset every time I need to execute any
action in command mode which is quite inconvenient.



For example I have ш Russian symbol along with i on the same
button on my keyboard. It would be very nice if while in command mode
ш would actually map to i. The same story with other keys. Thus I
won't have to switch to ascii in command mode.


If you internal encoding is 8-bit one (eg cp1251), then

 set langmap=very_long_list_of_letter_pairs

works fine. Unfortunately this doesn't fork if internal encoding is
utf-8. In later case,

 set keymap=russian-jcukenwin

works fine. The later has a minor disadvantage -- you need
vim-specific keyboard switch instead of standard WIndows one, but
after a shot time you will get used of this, and it is really handy.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: Moving cursor on wrapped lines

2007-04-14 Thread Cyril Slobin

On 4/15/07, Tim Chase [EMAIL PROTECTED] wrote:


While I don't believe there's an option per-se, it's very easy to use

:nnoremap up gk
:nnoremap down gj
:vnoremap up gk
:vnoremap down gj
:inoremap up c-ogk
:inoremap down c-ogj

to map the desired effect.  I've seen several folks on the list
who have such mappings.


This solution has one minor trap: arrows became broken when popup menu
is visible (eg in autocompletion mode). My (better I hope) version of
this idea is:

 Arrows should go into wrapped lines, but not while popup menu is visible
map Down gj
imap expr Down pumvisible() ? Down : C-Ogj

map Up gk
imap expr Up pumvisible() ? Up : C-Ogk

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Esperanto dictionary

2007-04-03 Thread Cyril Slobin

On 4/3/07, Hugh Sasse [EMAIL PROTECTED] wrote:


I've not encountered titlecase before this thread, so I don't
understand its semantics yet.


From http://www.unicode.org/glossary/#T

«Titlecase. Uppercased initial letter followed by lowercase letters in
words. A casing convention often used in titles, headers, and entries,
as exemplified in this glossary.»


My problem is that I mainly work through Windows systems (often ssh into
Solaris, but still) and I don't have a clue what to do with fonts for all
this, E.g. in PuTTY.  I'm not entirely clear how to do this in gvim for that
matter.  I've read some of the help on UTF8 but I'm still rather confused
being very much at the Beginner stage for this in terms of the Dreyfus
model of skills aquistion


Well, I'm now in Windows 98 SE Russian Edition. I've just logged into
Linux site, run Vim and typed Щ á Ĉ (Cyrillic capital letter shcha
followed by a with acute accent followed by C with circumflex accent).
All you need is: in putty go to Window - Translation menu and choose
UTF-8 from list; then go to Window - Appearance menu and choose some
ttf font instead of fyxedsys (Courier New is fine). Then log into Unix
site, run Vim and set both encoding and termencoding to utf-8.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: Esperanto dictionary

2007-04-03 Thread Cyril Slobin

On 4/2/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:


Well, I suppose both uppercase and titlecase should be supported then. Cxu ne?
CXU VERE NE? (Kompreneble, ĉiukaze mi preferas verajn ĉapelitajn literojn.)


CXU, Cxu and cxu are all passed cheking, CXu doesn't. And I believe
this is a Right Thing.


I suppose texts written in «Fundamenta» h-stilo could emphasise the radical
break when needed, as in flug-haveno, chas-hundo, danc-halo, ktp. (er, etc.).


Just checked -- translation table used by my plugin knows about
flughaveno and chashundo, but not about danchalo. I don't write this
table myself, but borrow it from UniRed (another opensource editor).
Anyway you can easy add danchalo and any other such word in the table
by yourself -- it is in simple text format.

BTW x-style is not free from such problems. Pure Esperanto text is OK,
but consider you use the word Linux in it!

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: Esperanto dictionary

2007-04-02 Thread Cyril Slobin

On 4/2/07, Hugh Sasse [EMAIL PROTECTED] wrote:


It might be useful to also support C^irkau^ as well.  I'm not sure
how often the h form is used given the exception(s?) (flughaveno...)


For h form you can use my plugin:

   http://www.vim.org/scripts/script.php?script_id=1761

It converts misc ascii representations to unicode and vice versa.
Among others are supported Cxirkaux-style, Zamenhof style with h (and
it knows about flughaveno and chashundo!), html/xml entities,
tex/latex notation and many more... If you want to spell check text
written with h's, you just convert it to unicode, check, and convert
back. Plugin is table-driven, and I haven't write tables myself -- I
borrowed them from two other open-source projects (UniRed and catdoc).
UniRed also has tables for ^Cirka^u, C^irkau^ and C`irkau`, and plugin
can use them, but I haven't bundled with plugin.


Also isn't your example often written CXirkaux because the CX is
(effectively) one character, capitalized?


I've newer seen this form, and I believe it is ugly. And in unicode
terms, this one character is not capitalized, but title-cased.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Esperanto dictionary

2007-03-30 Thread Cyril Slobin

Hi all!

Who maintains Esperanto spell files for Vim? File eo.utf-8.spl is
completely broken! In fact it was broken long ago when I've download
Vim 7.0. Now I've upgrade to 7.0.219 and have checked if something
became better. No hope -- it is the same broken file. I use Win32
version of Vim.

I have complied my own eo.utf-8.spl from ispell sources by Sergio
Pokrovskij found in Debian 3.1 distribution. It understands both real
Unicode and surrogate Cxirkaux-style (if you don't speak Esperanto,
you don't need to understand this). Archive contains .spl file itself,
two .dic files, two .aff files and short readme file (it is in
Esperanto, not English, and named legumin, not readme). You can
download it from:

   http://www.45.free.net/~slobin/vim/eo.utf-8.zip

Maybe it is a good idea to replace broken file with my one on Vim ftp site.

I've newer use aap and don't know vim maintaining technology, I've
just manually converted ispell files to myspell ones and than compiled
them to Vim format.

I have not checked eo.iso-8859-3.spl file, I newer use iso-8859-3.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Netrw under Windows 98 doesn't go to upper directory

2007-03-30 Thread Cyril Slobin

Hi!

I've just upgraded to Vim 7.0.219 and netrw version 107, and under
WIndows 98 it doesn't go to upper directory (neither by pressing -
nor by pressing cr on ../ line). I've guessed that reason is in
this lines:

  elseif !g:netrw_cygwin  (has(win32) || has(win95) ||
has(win64) || has(win16))
windows
   if a:islocal
let dirname= substitute(dirname,'^\(\a:\\\)\=\(.*\)\\\([^\]\+$\)','\2','')
   else
let dirname=
substitute(dirname,'^\(\a:\\\)\=\(.*\\\)\([^\]\+\\$\)','\2','')
   endif

First, this code supposes that directory separator is \ while a few
lines before it was replaced with /. Second, this code cuts off
drive letter and backslash after them making directory relative
instead of absolute. My workaround follows:

  elseif !g:netrw_cygwin  (has(win32) || has(win95) ||
has(win64) || has(win16))
windows
   if a:islocal
let dirname=
substitute(dirname,'^\(\a:[\\/]\)\=\(.*\)[\\/]\([^\\/]\+$\)','\1\2','')
   else
let dirname=
substitute(dirname,'^\(\a:[\\/]\)\=\(.*[\\/]\)\([^\\/]\+[\\/]$\)','\1\2','')
   endif

This works for me.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


VIM Spelling has broken me.

2007-03-26 Thread Cyril Slobin

Hi!

On 3/26/07, Keith Hellman [EMAIL PROTECTED] wrote:


Has anyone else setup such a configuration?  Got any tips or hints on
how to debug this?  Or perhaps (probably :^( ) I've really misunderstood
Vim spelling support.


Try to end rare words with /? in *.add file.

their/?
they're/?
lose/?
loose/?

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: Masking in context for spell check -- was:Re: Spell check not working when editing HTML

2007-03-25 Thread Cyril Slobin

On 3/22/07, Claus Atzenbeck [EMAIL PROTECTED] wrote:


 However, I notice that the spell checker doesn't understand entities:
 ougrave; is highlighted as a misspelling even though où is a valid word
 in modern French.

In fact, I have the same problem with LaTeX documents: For instance, \a
(or even a with German package on) would be ä, but this is not
recognized by the spell checker. So, 'ändern' (German) is recognized as
being correct, but '\andern' or 'andern' is not.

I don't know if there are solutions provided for mapping such masking in
their context (HTML, LaTeX, etc.) Anyone who has a workaround or
solution?


And again I am proud to point at my surrogat plugin, see

   http://www.vim.org/scripts/script.php?script_id=1761

You convert buffer from HTML/LaTeX notation to utf-8, spell check it
and convert back. Conversion tables for HTML, LaTeX, Esperanto
Cxirkaux-notation and some other are
available out of the box, or you can add your own.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: highlighting weird characters...

2007-03-19 Thread Cyril Slobin

On 3/19/07, Mitch Wiedemann [EMAIL PROTECTED] wrote:


Is there a way I can have my Vim highlight these characters so I can see
them and replace them with their HTML counterparts?


No idea about highlighting, but exactly to replace strange characters
with HTML or LaTeX or anything else or to do it in backward direction
I've write this plugin:

http://www.vim.org/scripts/script.php?script_id=1761

Documentation inside. I hope this helps.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Add open in tab to file browser

2007-03-17 Thread Cyril Slobin

Hi!

The following trivial patch to netrw.vim adds command t -- open
file in a new tab
to the vim file and network browser. May be useful to somebody.

*** netrw.vim   Sun Mar 18 01:50:14 2007
--- netrw.vim.orig  Sun May  7 18:13:42 2006
***
*** 1319,1325 
   nnoremap buffer silent r :let g:netrw_sort_direction=
(g:netrw_sort_direction =~ 'n')? 'r' : 'n'barexe norm! 0barcall
SIDNetBrowse(SIDNetBrowseChgDir(expand(%),'./'))cr
   nnoremap buffer silent s :call SIDNetSaveWordPosn()barlet
g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by
=~ 't')? 'size' : 'name'barexe norm! 0barcall
SIDNetBrowse(SIDNetBrowseChgDir(expand(%),'./'))barcall
SIDNetRestoreWordPosn()cr
   nnoremap buffer silent S :call SIDNetSortSequence(0)cr
-   nnoremap buffer silent t:call SIDNetSplit(4)cr
   nnoremap buffer silent u :c-ucall
SIDNetBookmarkDir(4,expand(%))cr
   nnoremap buffer silent U :c-ucall
SIDNetBookmarkDir(5,expand(%))cr
   nnoremap buffer silent v :call SIDNetSplit(1)cr
--- 1319,1324 
***
*** 1797,1804 
=1 : net   and v
=2 : local and o
=3 : local and v
-=4 : net   and t
-=5 : local and t
 fun! s:NetSplit(mode)
   call Dfunc(NetSplit(mode=.a:mode.) alto=.g:netrw_alto.
altv=.g:netrw_altv)

--- 1796,1801 
***
*** 1818,1838 
call s:CopyWinVars()
exe norm! 0
call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
!   elseif a:mode ==3
exe (g:netrw_altv? rightb  : lefta ).g:netrw_winsize.wincmd v
call s:CopyWinVars()
exe norm! 0
call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
-   elseif a:mode ==4
-tab split
-call s:CopyWinVars()
-exe norm! 0
-call s:NetBrowse(s:NetBrowseChgDir(expand(%),s:NetGetWord()))
-   elseif a:mode ==5
-tab split
-call s:CopyWinVars()
-exe norm! 0
-call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
   endif

   call Dret(NetSplit)
--- 1815,1825 
call s:CopyWinVars()
exe norm! 0
call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
!   else
exe (g:netrw_altv? rightb  : lefta ).g:netrw_winsize.wincmd v
call s:CopyWinVars()
exe norm! 0
call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
   endif

   call Dret(NetSplit)
***
*** 2962,2968 
   nnoremap buffer silent r :let g:netrw_sort_direction=
(g:netrw_sort_direction =~ 'n')? 'r' : 'n'barexe norm! 0barcall
SIDNetRefresh(SIDLocalBrowseChgDir(b:netrw_curdir,'./'),1)cr
   nnoremap buffer silent s :call SIDNetSaveWordPosn()barlet
g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by
=~ 't')? 'size' : 'name'barexe norm! 0barcall
SIDLocalBrowse(SIDLocalBrowseChgDir(b:netrw_curdir,'./'))barcall
SIDNetRestoreWordPosn()cr
   nnoremap buffer silent S :call SIDNetSortSequence(1)cr
-   nnoremap buffer silent t:call SIDNetSplit(5)cr
   nnoremap buffer silent u :c-ucall
SIDNetBookmarkDir(4,expand(%))cr
   nnoremap buffer silent U :c-ucall
SIDNetBookmarkDir(5,expand(%))cr
   nnoremap buffer silent v :call SIDNetSplit(3)cr
--- 2949,2954 

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: replace upper-case with lower-case

2007-03-08 Thread Cyril Slobin

On 3/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


This does not seem to be a good way, consider if we want to change:
START - STOP
Start - Stop
start - stop
STart - STop
sTART - sTOP


Not clear what you want to get if words have different lengths.

SHORT - VERYLONG or SHORT-VERYLong ?

ShOrT - ???

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: print hex value of cp936 Chinese char?

2007-03-07 Thread Cyril Slobin

On 3/7/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:


As long as 'encoding' is set to UTF-8, there is no easy way to get the cp936
value of a given character in the buffer.


I don't know if there is something specific with cp936, but for
encodings I use daily
(cp866, cp1251, koi8-r) the following works:

set statusline= skip %{HexDec()} skip

skip

function! HexDec()
 let char = matchstr(getline(.), ., col(.) - 1)
 if g:EXTERNAL
   let char = iconv(char, encoding, fileencoding)
   let format = 0x%02X %d
 else
   let format = 0x%02X (%d)
 endif
 let char = char2nr(char)
 return printf(format, char, char)
endfunction

skip

nmap silent F4 :let EXTERNAL = !EXTERNALCR
imap F6 C-OF4

Code of a character under cursor is always displayed in statusline (in
both hex and dec),
and I can switch between `encoding` and `fileencoding`.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: print hex value of cp936 Chinese char?

2007-03-07 Thread Cyril Slobin

On 3/7/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:


IIUC, the above is for 'encoding' and 'fileencoding' being both 8-bit
encodings. cp936 is the Microsoft encoding for mainland China: some characters
(such as ASCII) are 8 bits, others are 16 bits; and UTF-8 (the 'encoding'
Zhaojun uses) can use anywhere between 1 and 4 bytes to represent the
assigned codepoints. For instance, the highest Unicode codepoint currently
regarded as valid by the Unicode Consortium, U+10FFFD, is represented in
UTF-8 as F4 8F BF BD.


No! The very goal of this code is that `encodig` is utf-8 while
`fileencoding` is different. But you are right noting that I have not
tested this `fileencoding` other than 8-bit one -- except the marginal
case when it is utf-8 too. But again -- `encoding` *is* multibyte and
it works. Why not just to test? I haven't Chinese fonts installed...

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


Re: print hex value of cp936 Chinese char?

2007-03-07 Thread Cyril Slobin

On 3/7/07, Joseph WU [EMAIL PROTECTED] wrote:


Tony's right. I just tested Cyril's solution. Unfortunately,  when
encoding=utf8 and fileencoding=cp936, line: let char =
matchstr(getline(.), ., col(.) - 1) can only get the *FIRST*
8-bit out of a 2-byte cp936-encoded Chinese character. (To my
surprise, the hex value of the first 8-bit converted by iconv is
correct in cp936 encode standard. I just realized that iconv can just
convert a part of one Chinese Character.:)

I am trying to see if I can read the whole 2-byte Chinese char out or not.


Try this:

let char_int = matchstr(getline(.), ., col(.) - 1)
let char_ext = iconv(char_int, encoding, fileencoding)
if len(char_ext) == 1
 let code_ext = char2nr(char_ext[0])
 echo printf(0x%02X, code_ext)
else
 let code_ext = char2nr(char_ext[0]) * 256 + char2nr(char_ext[1])
 echo printf(0x%04X, code_ext)
endif

This should work if `encoding` is utf-8 and `fileencoding` is NOT
utf-8 (but any 1-byte or 2-byte encoding should work). This should
however NOT work if `encoding` is other than utf-8 or if
`fileencodibg` is utf-8 itself. And check for byte order -- I'm not
sure whether  big-endian or little-endian is correct here.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


dos32 colors

2007-03-06 Thread Cyril Slobin

Hi all!

In color xterm color 1 for is #0c (red), but in dos32 it is #0c
(blue). (Strictly speaking, VGA standard palette is different, but xterm
colors are good enough approximation in practice). This makes very hard
to write portable scripts dealing with colors. Does a better way to
write a such a script exist other than:

if has(dos32)
 let color1 = #0c
else
 let color1 = #0c
endif

? By the way, 2html.vim does not perform this test and colors of HTML
generated in dos32 are wrong.

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'


BufWritePre and :wqa

2007-03-05 Thread Cyril Slobin

Hello vim people!

Does anybody noted that the BufWritePre triggers on :w and :wq
commands, but doesn't on :wqa command? At least with Vim 7.0 Win32
version. And if nobody reported this yet, where and how should I
report? Is this message enough?

P.S. In fact I've made use of this error, so when it will be fixed,
I'll find a way to emulate it! ;-)

--
Cyril Slobin [EMAIL PROTECTED] `When I use a word,' Humpty Dumpty said,
http://45.free.net/~slobin `it means just what I choose it to mean'