Re: VimWiki - released finally

2007-06-06 Thread Robert Cussons

On 6/5/07, Sebastian Menge [EMAIL PROTECTED] wrote:

[cross-posted to vim, vim-dev, vim-announce, wikia-l]

Hi all

Finally I have imported all the vim tips from http://vim.org/tips to

http://vim.wikia.com

and set up a minimal infrastructure to keep things going. Not everything
is perfect, but I think it is usable now.

Thanks to all the support from [EMAIL PROTECTED] and especially to the very
kind wikia community (#wikia on freenode and the mailing list,
Greetings!).

Some words on contribution: A good wiki depends on two main factors:
Excellent content and a lively community. We have a lot of good content
now, but to make it excellent we need You!

If you ever posted a tip or a comment to the old tips database, please
have a look at it on the wiki, and review the page. Every little bit
helps!

See you on the wiki, Sebastian.






Very good work Sebastian, it looks great to me.

I have already come across a new tip on vim wikia that I hadn't known 
anything about which I thought I might draw programmer's attention to 
(sorry if you already know about it). Tip #1267, which is a tip to 
enable a programmer to see (by a simple key combination of his/her 
choice), in which function they are. Very useful if you have just landed 
in the middle of a long function during a search for example, you know 
longer have to move around inside the buffer to find which function you 
are in, just type your chosen key combination: see 
http://vim.wikia.com/wiki/Show_current_function_name_(for_C_programmers)

if you are interested.

Thanks very much to the original author of the tip and to everyone who 
has contributed to setting up the vim wikia.

Rob.


Re: why does :save not work with -stdin-

2007-06-06 Thread Bram Moolenaar

Edward L. Fox wrote:

 On 6/6/07, Mohsin [EMAIL PROTECTED] wrote:
  I usually do search like this:
 
  $ grep  Word *.* | vim -u myvimrc -
 
  $ cat myvimrc
 
 :autocmd StdinReadPost * :sav! /tmp/x
 
  but when I quit :q, vim always asks me to save the file again,
  why is the file marked as modified?
 
  I tried all combinations of flags, but can't get vim to
  mark the file as saved,
 
 It's a bug. Here is the patch. Please test it carefully, thanks very
 much for reporting this to me. I'll ask Bram to add it to the official
 release soon.
 
 Index: buffer.c
 ===
 --- buffer.c(revision 296)
 +++ buffer.c(working copy)
 @@ -171,14 +171,6 @@
 /* Put the cursor on the first line. */
 curwin-w_cursor.lnum = 1;
 curwin-w_cursor.col = 0;
 -#ifdef FEAT_AUTOCMD
 -# ifdef FEAT_EVAL
 -   apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
 -   curbuf, retval);
 -# else
 -   apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
 -# endif
 -#endif
 }
  }
 
 @@ -207,6 +199,18 @@
 unchanged(curbuf, FALSE);
  save_file_ff(curbuf);  /* keep this fileformat */
 
 +#ifdef FEAT_AUTOCMD
 +if (read_stdin)
 +{
 +# ifdef FEAT_EVAL
 +apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
 +   curbuf, retval);
 +# else
 +apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
 +# endif
 +}
 +#endif
 +
  /* require ! to overwrite the file, because it wasn't read completely 
 */
  #ifdef FEAT_EVAL
  if (aborting())

Instead of moving the autocommands, it might be better to move the call
to changed() to before the autocommands (with the if that checks for
read_stdin).  The readfile() call also invokes the ReadPost
autocommands, this keeps it consistent.

-- 
hundred-and-one symptoms of being an internet addict:
162. You go outside and look for a brightness knob to turn down the sun.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: VimWiki - released finally

2007-06-06 Thread Sebastian Menge
Some more remarks. When replying it would be clever to change the
subject of the mail ...

Categories:
Tom, the category appears at the very bottom of a page.

see: http://meta.wikimedia.org/wiki/Help:Category

(meta.wikimedia.org is the best source for technical documentation about
mediawiki.)

Discussion:
Im not sure, whether the vim mailinglist is the right place to discuss
technical issues of the wiki !? But on the other hand i dont know any
better place :-) There is a forum on the wiki
( http://vim.wikia.com/index.php?title=Forum:Watercooler ), but I dont
like forums ... suggestions?

Ads:
Concerning ads, I recommend a good adblocker. http://adblockplus.org/
works well for me. :-) I asked the wikia staff to remove the ugly Wikia
Spotlight but they didnt react so far. 
We are a quite large community, and the user-base is even larger. It
would be interesting to estimate how much money they earn with us.

Skin:
There is a skin called slate It looks quite fance, but more
important it has some nice features like top-rated Pages and the like.
Test it here: http://vim.wikia.com/wiki/Main_Page?useskin=slate
I dont like the layout, but the features are quite nice ... (try to drag
and drop the boxes on the left ...) We could discuss that on the
http://vim.wikia.com/wiki/Talk:Main_Page.

Scripts:
Yeah that's an issue that would need some brainwork before. I never used
the scripts_db extensively, so im the wrong guy for that ... But when I
look at it, i dont see anything that couldn't be done with the wiki. But
that doesn't mean it should be done that way :-)

Sebastian.



Re: 'fileencodings': Why use ucs-2le for cp936 file?

2007-06-06 Thread panshizhu
A.J.Mechelynck [EMAIL PROTECTED] 写于 2007-06-06 10:30:54:
  1. will vim write BOM when writing to unicode files? or is there any
  options for that?

:setlocal bomb

 When opening a Unicode file, Vim will set or clear the buffer-local
'bomb'
 option according to the presence or absence of a BOM. That option is
 irrelevant for non-Unicode files. You can also set or clear it manually.
When
 creating a new Unicode file from scratch, a BOM will be set, or
not,depending
 on the corresponding global setting, so if you want your new Unicode
files to
 be created with a BOM, you may add

:setglobal bomb

 to your vimrc.

Thanks, it seems that BOM is not written by default and can be set only
globally for all unicode encoding.

But the problem is: my gcc 4.0 will complain about BOM for utf-8 source
file, while ucs-2le must have a BOM so that vim can recognize it without
adding the ucs-2le in fencs (ucs-2le should never be added into fencs
though, since most characters in cpxxx are valid and it is likely to mess
things up).

Is there anyway to do BOM setting only for particular unicode encoding like
the following?
when write utf-8 files, do not write the BOM.
when write ucs-2 files, write the BOM. (it should happen even if the file
opend as utf-8 then :set fenc=ucs-2le and then :write)

--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: 'fileencodings': Why use ucs-2le for cp936 file?

2007-06-06 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

A.J.Mechelynck [EMAIL PROTECTED] 写于 2007-06-06 10:30:54:

1. will vim write BOM when writing to unicode files? or is there any
options for that?

   :setlocal bomb

When opening a Unicode file, Vim will set or clear the buffer-local

'bomb'

option according to the presence or absence of a BOM. That option is
irrelevant for non-Unicode files. You can also set or clear it manually.

When

creating a new Unicode file from scratch, a BOM will be set, or

not,depending

on the corresponding global setting, so if you want your new Unicode

files to

be created with a BOM, you may add

   :setglobal bomb

to your vimrc.


Thanks, it seems that BOM is not written by default and can be set only
globally for all unicode encoding.

But the problem is: my gcc 4.0 will complain about BOM for utf-8 source
file, while ucs-2le must have a BOM so that vim can recognize it without
adding the ucs-2le in fencs (ucs-2le should never be added into fencs
though, since most characters in cpxxx are valid and it is likely to mess
things up).

Is there anyway to do BOM setting only for particular unicode encoding like
the following?
when write utf-8 files, do not write the BOM.
when write ucs-2 files, write the BOM. (it should happen even if the file
opend as utf-8 then :set fenc=ucs-2le and then :write)

--
Sincerely, Pan, Shi Zhu. ext: 2606




autocmd BufWritePre * if fenc ==? 'utf-8' || fenc ==? 'utf8' |
\ setlocal nobomb |
\ elseif fenc =~? '^u' | setlocal bomb | endif

... will clear 'bomb' just before writing UTF-8 files and set it just before 
writing other Unicode files (UCS-2, UCS-4 or UTF-16, UTF-32, of any 
endianness; I'm not speaking here of the latest PRC encoding, GB18030 I think 
it is called, which is, strictly speaking, also a Unicode encoding).



Best regards,
Tony.
--
A man wrapped up in himself makes a very small package.


Re: VimWiki - released finally

2007-06-06 Thread Robert Cussons

On 6/5/07, Sebastian Menge [EMAIL PROTECTED] wrote:

[cross-posted to vim, vim-dev, vim-announce, wikia-l]

Hi all

Finally I have imported all the vim tips from http://vim.org/tips to

http://vim.wikia.com

and set up a minimal infrastructure to keep things going. Not everything
is perfect, but I think it is usable now.

Thanks to all the support from vim@vim.org and especially to the very
kind wikia community (#wikia on freenode and the mailing list,
Greetings!).

Some words on contribution: A good wiki depends on two main factors:
Excellent content and a lively community. We have a lot of good content
now, but to make it excellent we need You!

If you ever posted a tip or a comment to the old tips database, please
have a look at it on the wiki, and review the page. Every little bit
helps!

See you on the wiki, Sebastian.






Very good work Sebastian, it looks great to me.

I have already come across a new tip on vim wikia that I hadn't known 
anything about which I thought I might draw programmer's attention to 
(sorry if you already know about it). Tip #1267, which is a tip to 
enable a programmer to see (by a simple key combination of his/her 
choice), in which function they are. Very useful if you have just landed 
in the middle of a long function during a search for example, you know 
longer have to move around inside the buffer to find which function you 
are in, just type your chosen key combination: see 
http://vim.wikia.com/wiki/Show_current_function_name_(for_C_programmers)

if you are interested.

Thanks very much to the original author of the tip and to everyone who 
has contributed to setting up the vim wikia.

Rob.


Re: buffer local autocmd

2007-06-06 Thread Markus Schulz
Am Dienstag, 5. Juni 2007 21:00 schrieb A.J.Mechelynck:
 Markus Schulz wrote:
  hello,
 
  i want to setup some things only for php-source files. But i don't
  get the autocmd local to buffer. The setup was also applied to
  opened c++ files after the first php file.
 
  currently i have this inside my .vimrc (php.vim sets some tabulator
  options)
 
  autocmd   FileType  php source ~/.vim/php.vim
 
  i've tried something like:
 
  autocmd   FileType  buffer php source ~/.vim/php.vim
 
  without luck.
 
  Any hints how i can achieve this?

 Instead of ~/.vim/php.vim, name it ~/.vim/after/ftplugin/php.vim and
 you won't even need an autocommand. (Create the directories if they
 don't exist).

 Make sure the script contains only local commands such as :map
 buffer and :setlocal.

thanks. works great.

-- 
Markus Schulz 


Re: VimWiki: New Tips

2007-06-06 Thread Sebastian Menge
Am Mittwoch, den 06.06.2007, 10:12 +0100 schrieb A. S. Budden:
 The 'title' line of my tip ends with this: Karma: Imported from:
 Tip#.  Since it wasn't an imported tip and the rating is supposed to

 
 Any suggestions?


That needs to be fixed in the template. Will take some minutes.

Thanks for the pointer.

Seb.



Re: VimWiki: New Tips

2007-06-06 Thread Sebastian Menge
Am Mittwoch, den 06.06.2007, 11:22 +0200 schrieb Sebastian Menge:
 That needs to be fixed in the template. Will take some minutes.

Fixed. If id is empty, the template will produce other output. Also
fixed [[TipPreload]] to not use id and rating by default.

Seb.