Mikolaj Machowski | 1 Jan 2007 12:45
Picon
Favicon

Re: automatic code completion in vim

On pon sty 1 2007, Mikolaj Machowski wrote:
> >    Note: much faster, noticeable on big files, would be reading of
> > tags file into buffer and just g//d proper lines and add tags at the
> > end
>
> how to read tags into the buffer and what does "g//d proper lines" mean?

:new somename
:g/\t{filename}\t/d

> >    - but I hate buffer management in scripts, YMMV.
> >
> > Sounds complicated but Vim should be able to perform all actions with
> > reasonable speed. The most expensive is f) .
> >
> > You should carefully consider when this function should be performed.
> > I would vote for ; and BufLeave and BufWritePre autocommands.
> >
> > m.
>
> I write the function like this, but there are some problems.
> This is my first time to write vim script, so please give me a hand.
>
> inoremap <expr> ; UpdateTags()
> func UpdateTags()
>     "get the file name of the current buffer
>     let currentfilename=bufname("%")

Safer::

(Continue reading)

Mikolaj Machowski | 1 Jan 2007 13:06
Picon
Favicon

Re: automatic code completion in vim

Dnia pon sty 1 2007, napisałeś:
> remove() doesn't accept regexps only indexes. To remove offending lines
> use filter()::
>
> 	call filter(alltags, "v:val !~ fname")

I've made some tests and on big tags files it can be slow. The fastest
method is::

	let alltags = system('grep -v '.fname)
	let alltags = split(alltags, '\n') " you have to end with List

m.

A.J.Mechelynck | 1 Jan 2007 15:37
Picon

Re: automatic code completion in vim

Mikolaj Machowski wrote:
> Dnia pon sty 1 2007, napisałeś:
>> remove() doesn't accept regexps only indexes. To remove offending lines
>> use filter()::
>>
>> 	call filter(alltags, "v:val !~ fname")
> 
> I've made some tests and on big tags files it can be slow. The fastest
> method is::
> 
> 	let alltags = system('grep -v '.fname)
> 	let alltags = split(alltags, '\n') " you have to end with List
> 
> m.
> 
> 

This won't work: you need a different variable name, see ":help E706".

Best regards,
Tony.

Alan G Isaac | 1 Jan 2007 16:48
Picon
Favicon

Re: Enclosing current line in HTML tags

On Sun, 31 Dec 2006, Robert MannI apparently wrote: 
> What's the quickest way to enclose the current line the 
> cursor is on in, say, <li></li> tags? 

Here's one approach:
http://www.american.edu/econ/notes/html_xhb.vim

hth,
Alan Isaac

Mikolaj Machowski | 1 Jan 2007 17:08
Picon
Favicon

Re: automatic code completion in vim

On pon sty 1 2007, Mikolaj Machowski wrote:
> This won't work: you need a different variable name, see ":help E706".

Yeah, I forgot (not only about that).

This is complete solution::

    function! UpdateTags()
	    call writefile(getline(1, '$'), '.tmp.cc', 'b')
	    let tags = system('ctags --c++-kinds=+p --fields=+iaS --extra=+q -f 
- .tmp.cc')
	    " Note: whitespaces around expand are tab chars.
	    let alltags = system('grep -v "	'.expand('%').'	" tags')
	    let tagstable = split(alltags, '\n')
	    call add(tagstable, tags)
	    call writefile(tagstable, 'tags', 'b')
	    redraw!
	    return ';'
    endfunction
    inoremap <expr> ; UpdateTags()

Note: this is untested in real life, it doesn't return any errors.

In good conditions execution of whole function takes 0.46s on big tags
file (KMail source, tags size over 4MB, 10000 lines). Delay noticeable
on my computer Sempron 2200, 512M RAM, old HD 5400rpm. In worse conditions
it was taking up to 0.75s::

    FUNCTION  UpdateTags()
    Called 1 time
(Continue reading)

spx2 | 2 Jan 2007 00:10
Picon

cvim


hello.
i just installed cvim but \lcs and \ucs work perfectly but
\ce or \cn or any other \xx stuff or \xxx stuff don't work at all.
what do i do ?
--

-- 
View this message in context: http://www.nabble.com/cvim-tf2905788.html#a8117987
Sent from the Vim - General mailing list archive at Nabble.com.

A.J.Mechelynck | 2 Jan 2007 08:03
Picon

Re: cvim

spx2 wrote:
> hello.
> i just installed cvim but \lcs and \ucs work perfectly but
> \ce or \cn or any other \xx stuff or \xxx stuff don't work at all.
> what do i do ?

What is cvim?

Best regards,
Tony.

Fritz Mehner | 2 Jan 2007 08:36
Picon
Favicon

Re: cvim

spx2 schrieb:

>hello.
>i just installed cvim but \lcs and \ucs work perfectly but
>\ce or \cn or any other \xx stuff or \xxx stuff don't work at all.
>what do i do ?
>  
>
Please check if plugins can be loaded:

 :filetype

You should see
 filetype detection:ON  plugin:ON  indent:ON

If not add a line to file .vimrc :
 filetype plugin on

Fritz

Suresh Govindachar | 2 Jan 2007 10:51
Picon
Favicon

RE: Bug in 7.0.178? autocmd BufReadCmd * DoSomething expand("<afile>") fails if the filename contains %


   Thomas sent to vim-dev <at> vim.org

  > I have the following line in my source:
  > 
  > exec 'autocmd BufReadCmd  '. pattern .' call '. rcmd .'(1,
  > expand("<afile>"), "", "%")'
  > 
  > This fails if the filename contains % which is replaced with
  > expand('%'). I can't seem to escape the % at any point, can I?
  > Wrapping the exand("<afile>") in a escape(<>, "%") doesn't help.

  Shouldn't <afile> be wrapped in escape before the expand, 
  so that -- omitting other arguments -- the sequence would be:

           expand( escape( <afile> ) )

  --Suresh

AOYAMA Shotaro | 2 Jan 2007 11:19
Picon

surrparen

Hi,

Now I'm writing a plugin that hilights a pair of
parens/braces which surround the cursor position.
Unlike matchparen.vim, it works even when the cursor
is not just on a paren/brace.  
The attached file is the source.

But I have noticed a bothering problem with it.

When cursor is on '0' in the following text,
                |
                v
do_all = (flags[0] == 'g');

do_all = (flags[1] == 'g');

you press jj, then the cursor normally should down
two lines and on '1'.
But when using this plugin, it goes the first column.

I'm wondering how I can avoid this problem.
Any ideas?
and any other suggestion is welcome.

Regards,

--

-- 
AOYAMA Shotaro
mailto:jod <at> r9.dion.ne.jp
(Continue reading)


Gmane