VimScript for Python developers

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

VimScript for Python developers

Yegappan Lakshmanan
Hi all,

I have put together the following gist to help Python developers
with VimScript:


Let me know if you have any comments/suggestions.

Thanks,
Yegappan

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7%3DRnUq6K459LxwhCvkRzynOj_T4_2ez0Xp3NsWoRDiRYQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Bram Moolenaar

Yegappan wrote:

> I have put together the following gist to help Python developers
> with VimScript:
>
> https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0

Very useful!

> Let me know if you have any comments/suggestions.

Some things are identical.  Instead of the reader staring at the text to
spot any differences, how about just saying "the same".  E.g. at the
start of "Comparison Operators".

For dictionaries it would be useful to mention the #{} form:

let d = {'red' : 10, 'blue' : 20}  or  #{red : 10, blue : 20}
let x = {}

Some day it would be nice to do the same for Vim9 script.

--
"The amigos also appear to be guilty of not citing the work of others who had
gone before them.  Even worse, they have a chapter about modeling time and
space without making a single reference to Star Trek!"
                        (Scott Ambler, reviewing the UML User Guide)

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/202006011209.051C90JK890555%40masaka.moolenaar.net.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Christian Brabandt
In reply to this post by Yegappan Lakshmanan

On So, 31 Mai 2020, Yegappan Lakshmanan wrote:

> Hi all,
>
> I have put together the following gist to help Python developers
> with VimScript:
>
> https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0
>
> Let me know if you have any comments/suggestions.

Very nice. Are you keeping this up to date there? Perhaps a link to this
reference should be included in the help

I notice this:

> Finding string length

The mentioned functions (len(), strlen()) do not handle multibyte
characters, but return the byte-length, perhaps explicitly add
strwidth()

> Getting a substring

Again, using str[index] uses byte index, same for strpart, perhaps
mention strcharpart()

> Checking whether a string starts with or ends with a substring

> if str =~# "^ing"

Please use single quotes, so that if one adds other regular expression
atoms such as \+ or \d one do not have to double the backslashes.


Best,
Christian
--
Ein Kompromiss, das ist die Kunst, einen Kuchen so zu teilen, daß
jeder meint, er habe das größte Stück bekommen.
                -- Ludwig Erhard

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200601163153.GG16708%40256bit.org.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Yegappan Lakshmanan
In reply to this post by Bram Moolenaar
Hi Bram,

On Mon, Jun 1, 2020 at 5:09 AM Bram Moolenaar <[hidden email]> wrote:

Yegappan wrote:

> I have put together the following gist to help Python developers
> with VimScript:
>
> https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0

Very useful!

> Let me know if you have any comments/suggestions.

Some things are identical.  Instead of the reader staring at the text to
spot any differences, how about just saying "the same".  E.g. at the
start of "Comparison Operators".

I have now used a table to compare the various operators.
 

For dictionaries it would be useful to mention the #{} form:

let d = {'red' : 10, 'blue' : 20}  or  #{red : 10, blue : 20}
let x = {}

I have updated the gist with this.
 

Some day it would be nice to do the same for Vim9 script.


Once the Vim9 script has all the features as Vim8, I will create
another gist.

Regards,
Yegappan

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7%3D-Ly9QkXhUxoMRZNYmPWV4-06uZJDXLLrNV95ebFjWDQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Yegappan Lakshmanan
In reply to this post by Christian Brabandt
Hi Christian,

On Mon, Jun 1, 2020 at 9:31 AM Christian Brabandt <[hidden email]> wrote:

On So, 31 Mai 2020, Yegappan Lakshmanan wrote:

> Hi all,
>
> I have put together the following gist to help Python developers
> with VimScript:
>
> https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0
>
> Let me know if you have any comments/suggestions.

Very nice. Are you keeping this up to date there? Perhaps a link to this
reference should be included in the help

Yes. I am planning to keep this up-to-date.
 

I notice this:

> Finding string length

The mentioned functions (len(), strlen()) do not handle multibyte
characters, but return the byte-length, perhaps explicitly add
strwidth()

> Getting a substring

Again, using str[index] uses byte index, same for strpart, perhaps
mention strcharpart()

> Checking whether a string starts with or ends with a substring

> if str =~# "^ing"

Please use single quotes, so that if one adds other regular expression
atoms such as \+ or \d one do not have to double the backslashes. 
 

Thanks for the review comments. I have updated the gist with these comments.

Regards,
Yegappan

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7%3D8xv8zD_wctxCJ%2BUqiyWi5bdtq73D0EVoEdmzSMNwkCw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Prabir Shrestha
There is also Vim Script for JavaScripters. https://w0rp.com/blog/post/vim-script-for-the-javascripter/

On Monday, June 1, 2020 at 10:08:04 AM UTC-7, Yegappan wrote:
Hi Christian,

On Mon, Jun 1, 2020 at 9:31 AM Christian Brabandt <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="t_JD5uDbAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cbl...@...> wrote:

On So, 31 Mai 2020, Yegappan Lakshmanan wrote:

> Hi all,
>
> I have put together the following gist to help Python developers
> with VimScript:
>
> <a href="https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fyegappan%2F16d964a37ead0979b05e655aa036cad0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFyuLMA-lIuTCsl6opU9knnNjr94w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fyegappan%2F16d964a37ead0979b05e655aa036cad0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFyuLMA-lIuTCsl6opU9knnNjr94w&#39;;return true;">https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0
>
> Let me know if you have any comments/suggestions.

Very nice. Are you keeping this up to date there? Perhaps a link to this
reference should be included in the help

Yes. I am planning to keep this up-to-date.
 

I notice this:

> Finding string length

The mentioned functions (len(), strlen()) do not handle multibyte
characters, but return the byte-length, perhaps explicitly add
strwidth()

> Getting a substring

Again, using str[index] uses byte index, same for strpart, perhaps
mention strcharpart()

> Checking whether a string starts with or ends with a substring

> if str =~# "^ing"

Please use single quotes, so that if one adds other regular expression
atoms such as \+ or \d one do not have to double the backslashes. 
 

Thanks for the review comments. I have updated the gist with these comments.

Regards,
Yegappan

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/71fb3ddb-9f5d-42a0-8222-8c9f49af729do%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Bram Moolenaar

Prabir Shrestha wrote:

> There is also Vim Script for JavaScripters.
> https://w0rp.com/blog/post/vim-script-for-the-javascripter/

Thanks, that also looks useful.  I'll add the link to usr_41.txt.

--
CUSTOMER:     You're not fooling anyone y'know.  Look, isn't there something
              you can do?
DEAD PERSON:  I feel happy... I feel happy.
    [whop]
CUSTOMER:     Ah, thanks very much.
MORTICIAN:    Not at all.  See you on Thursday.
CUSTOMER:     Right.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/202006131121.05DBLTmc555163%40masaka.moolenaar.net.
Reply | Threaded
Open this post in threaded view
|

Re: VimScript for Python developers

Yegappan Lakshmanan
In reply to this post by Prabir Shrestha
Hi,

On Sat, Jun 13, 2020 at 3:02 AM Prabir Shrestha <[hidden email]> wrote:
There is also Vim Script for JavaScripters. https://w0rp.com/blog/post/vim-script-for-the-javascripter/


Yes. This page is also mentioned in my gist.

BTW, I have added a lot of content to the gist recently. Review comments and
suggestions are welcome.


Regards,
Yegappan
 
On Monday, June 1, 2020 at 10:08:04 AM UTC-7, Yegappan wrote:
Hi Christian,

On Mon, Jun 1, 2020 at 9:31 AM Christian Brabandt <[hidden email]> wrote:

On So, 31 Mai 2020, Yegappan Lakshmanan wrote:

> Hi all,
>
> I have put together the following gist to help Python developers
> with VimScript:
>
> https://gist.github.com/yegappan/16d964a37ead0979b05e655aa036cad0
>
> Let me know if you have any comments/suggestions.

Very nice. Are you keeping this up to date there? Perhaps a link to this
reference should be included in the help

Yes. I am planning to keep this up-to-date.
 

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7%3DvFa4PmW%2B7H-o73nVJDoX_Yp0Lm4L%2BAFHcZmW%3Dk-YxKw%40mail.gmail.com.