Saturday, July 17, 2010

Re: Detecting first characters in a line ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/17/2010 07:51 PM, Frank Blendinger wrote:
> Hi.
>
> Aaron Lewis <aaron.lewis1989@gmail.com> (2010-07-17 19:24 +0800):
>> I'm trying to implement a custom script used for commenting and
>> uncommenting , we have two types , like c-style `//' and shell-style `#'
>> , how can i detect the first characters ?
>
> Not really answering your question, but if you aren't writing the script
> just for fun or education I would recommend the existing NERD commenter
> plugin, which does its job pretty well for all kinds of comments:

OK , i've just got some ideas from that plugin , as i'm doing a custom
plugin , what's wrong with this func , anybody give a try ?

func! CommentingOut()
if filetype == ""
s/^/#/<CR>
else
s/^/\/\//<CR>
endif
endfunc

Thanks

>
> http://www.vim.org/scripts/script.php?script_id=1218
>
>
> HTH,
> Frank
>


- --
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxBnuIACgkQvf41sEptMqDY9ACgz58fPcn96a1zWJAY//HD/REd
FOUAoItWh1RUIPhYg4z5kfsBp4tqN5Sb
=hddU
-----END PGP SIGNATURE-----

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: