Re: Suggestion for sshconfig.vim

116 views
Skip to first unread message

Leonard Ehrenfried

unread,
Feb 19, 2012, 5:29:51 PM2/19/12
to vim...@googlegroups.com, Tom Ryder
Dear list,

I have an update for the sshconfig.vim syntax file, which has been suggested by Tom Ryder.

The output of hg diff is as follows:

diff -r 25b3106f17bd runtime/syntax/sshconfig.vim
--- a/runtime/syntax/sshconfig.vim Sun Feb 19 18:19:30 2012 +0100
+++ b/runtime/syntax/sshconfig.vim Sun Feb 19 22:20:27 2012 +0000
@@ -4,7 +4,7 @@
 " Maintainer:   Leonard Ehrenfried <leonard.e...@web.de>
 " Modified By: Thilo Six
 " Originally: 2009-07-09
-" Last Change: 2011 Oct 31
+" Last Change: 2012 Feb 19
 " SSH Version: 5.9p1
 "
 
@@ -92,7 +92,8 @@
 syn match sshconfigHostPort "\<\(\d\{1,3}\.\)\{3}\d\{1,3}\(:\d\+\)\?\>"
 syn match sshconfigHostPort "\<\([-a-zA-Z0-9]\+\.\)\+[-a-zA-Z0-9]\{2,}\(:\d\+\)\?\>"
 syn match sshconfigHostPort "\<\(\x\{,4}:\)\+\x\{,4}[:/]\d\+\>"
-
+syn match sshconfigHostPort "\(Host \)\@<=.\+"
+syn match sshconfigHostPort "\(HostName \)\@<=.\+"
 
 " case off
 syn case ignore

I have attached an updated version of the file.

Thanks,
Leonard


On 18 February 2012 15:50, Tom Ryder <t...@sanctum.geek.nz> wrote:
Hello;

I have a suggestion for the sshconfig Vim syntax file you maintain. 

Because everything that follows a Host pragma must by definition be intended as a host, and not necessarily one that actually resolves via DNS (e.g. it could be an abbreviation for an actual host specified in the section by a HostName command), both this and the HostName option I think should always fall into the sshconfigHostPort group.

Here's a suggested patch if you agree. It uses zero-width lookbehind assertions.

--- sshconfig.vim       2012-02-19 03:47:47.000000000 +1300
+++ sshconfig.fix.vim   2012-02-19 03:47:38.000000000 +1300
@@ -92,6 +92,8 @@
 syn match sshconfigHostPort "\<\(\d\{1,3}\.\)\{3}\d\{1,3}\(:\d\+\)\?\>"
 syn match sshconfigHostPort "\<\([-a-zA-Z0-9]\+\.\)\+[-a-zA-Z0-9]\{2,}\(:\d\+\)\?\>"
 syn match sshconfigHostPort "\<\(\x\{,4}:\)\+\x\{,4}[:/]\d\+\>"
+syn match sshconfigHostPort "\(Host \)\@<=.\+"
+syn match sshconfigHostPort "\(HostName \)\@<=.\+"


 " case off

And an example of a config file stanza for which this fixes the highlighting for the word "webserver":

Host webserver webserver.example.com
    ProxyCommand ssh proxy.example.com nc %h %p 

--Tom@Sanctum


sshconfig.vim

Bram Moolenaar

unread,
Feb 22, 2012, 11:03:47 AM2/22/12
to Leonard Ehrenfried, vim...@googlegroups.com, Tom Ryder

Leonard Ehrenfried wrote:

> I have an update for the sshconfig.vim syntax file, which has been
> suggested by Tom Ryder.
>
> The output of hg diff is as follows:

Thanks.

Can we adjust the header to remove:

" Modified By: Thilo Six
" Originally: 2009-07-09

Now that you, as the maintainer, sent a new version I don't think we
need these.


--
You can't have everything. Where would you put it?
-- Steven Wright

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///

Thilo Six

unread,
Feb 22, 2012, 1:38:54 PM2/22/12
to vim...@vim.org
Bram Moolenaar wrote the following on 22.02.2012 17:03

Hello

> Can we adjust the header to remove:
>
> " Modified By: Thilo Six
> " Originally: 2009-07-09
>
> Now that you, as the maintainer, sent a new version I don't think we
> need these.

/me thinks so, too.


--
Regards,
Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


Tom Ryder

unread,
Feb 23, 2012, 5:18:16 AM2/23/12
to vim_dev
I would be interested in helping out for known problems in other
syntax files; I've been wanting to contribute to Vim for quite a
while.

Thilo Six

unread,
Feb 23, 2012, 12:37:51 PM2/23/12
to vim...@vim.org
Tom Ryder wrote the following on 23.02.2012 11:18

> I would be interested in helping out for known problems in other
> syntax files; I've been wanting to contribute to Vim for quite a
> while.

That would be appreciated. There are quite a number runtimefiles which use
linecontinuation but are known not to take care of cpoptions, see ':h cpo-C'.

When providing patches, one might also check the value of 'ts' in modelines. For
official runtimefiles a 'ts=8' is preferred. Probably a reindent is necessary then.

Also i think there a quite a common mistake which i made myself, too. Inside
square brackets '[]' characters like '[.~' do not need to be escaped. But then
one can find often '[\[\~\.]' and so on. These just mean '\' is added to list
which might or might not be what is intended.

I'm currently a bit short of time myself.

Leonard Ehrenfried

unread,
Feb 24, 2012, 5:46:48 AM2/24/12
to vim...@googlegroups.com
I agree with Thilo and Bram and have removed the two lines and reattached the file.

Leonard

--
You received this message from the "vim_dev" 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

sshconfig.vim

Bram Moolenaar

unread,
Feb 24, 2012, 3:36:18 PM2/24/12
to Leonard Ehrenfried, vim...@googlegroups.com

Leonard Ehrenfried wrote:

> I agree with Thilo and Bram and have removed the two lines and reattached
> the file.

I'll include it, thanks.

--
I AM THANKFUL...
...for the clothes that fit a little too snug because it
means I have more than enough to eat.

Reply all
Reply to author
Forward
0 new messages