Hi Agathoklis!

On Sun, 15 Feb 2009, Agathoklis D. Hatzimanikas wrote:

> 
> On Sun, Feb 15, at 10:15 Agathoklis D. Hatzimanikas wrote:
> > Just a thought, but if you use them occasionally and only a small 
> > subset,
> > then you can probably create a list (of the ones you use most) and rely to
> > vim for auto completion, like:
> > 
> > function! CompleteDigraph()
>   function! CompleteDigraph(A,L,P)
> 
> >     let list = ["Š", "š", "Ţ", "ţ", "Ť", "ť", "Ŧ", "ŧ", "Ũ"]
> >     return list
> > endfunction
> > 
> > iab dgr <C-R>= input("Digraph: ", "", "customlist,CompleteDigraph")<CR>

Not bad! I have been thinking about it, and one could even implement a 
custom completion function. You need to get 
http://www.unicode.org/Public/UNIDATA/Index.txt and set the readfile() 
expression according to the location of Index.txt Something simple 
like this script could then be used to enter the characters.

,----
| function! CompleteDigraph(findstart,base)
|   if a:findstart
|     let line = getline('.')
|     let start = col('.') - 1
|     while start > 0 && line[start - 1] =~ '\a'
|       let start -= 1
|     endwhile
|     return start
|   else
|     let list=readfile(expand("~/.vim/Index.txt")))
|     let i=1
|     let idx=match(list,a:base)
|     while ( idx >= 0)
|       let nr = str2nr(matchstr(list[idx], '\x\+$'),16)
|       call complete_add({'word':nr2char(nr), 'abbr':list[idx], 'icase':1, 
'menu':nr2char(nr)})
|       let i+=1
|       let idx=match(list,a:base,0,i)
|       if complete_check()
|         break
|       endif
|     endwhile
|     return {}
|   endif
| endfun
| 
| 
| set completefunc=CompleteDigraph
`----

This messes up the popup menu a little bit and I don't know how to fix 
it. Other than that, I find it now easy enough to enter all kind of 
characters. 

regards,
Christian
-- 
hundred-and-one symptoms of being an internet addict:
118. You are on a first-name basis with your ISP's staff.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to