Thursday, December 20, 2018

Re: How to vim recognize ssh config file?

On Fri, Dec 21, 2018 at 3:53 AM Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
>
> On Fri, Dec 21, 2018 at 3:39 AM 'Grant Taylor' via vim_use
> <vim_use@googlegroups.com> wrote:
> >
> > On 12/20/18 5:27 PM, Peng Yu wrote:
> > > Hi
> >
> > Hi,
> >
> > > vim recognize ~/.ssh/config. But I'd like to recognize it in a none
> > > standard location via some file extension. Is there a standard file
> > > extension that will make vim recognize it in a none standard location?
> > > Thanks.
> >
> > I don't know the nuances of file type detection. But I do know that you
> > can easily set it for any arbitrary file by running the following command:
> >
> > :set syntax=sshconfig
> >
> > If you support mode lines (?) you can add that.
>
> Normally you set 'filetype', not 'syntax'. The difference is that
> 'filetype' sources the appropriate filetype-plugin(s) (which declare
> filetype-specific mappings, etc.); if filetype indenting is on it also
> sources the appropriate indent script, and in addition to all that it
> sets 'syntax' to the value of 'filetype' in order (if syntax
> highlighting is on) to setup the syntax highlighting. Setting only
> 'syntax' would set the syntax highlighting but not the mappings and
> (even if you have used "filetype indent on") not the filetype-specific
> indenting.

P.S. And regardless of whether you set 'filetype' or 'syntax', use
:setlocal, not plain :set, in order to avoid setting the default for
new files you write from scratch (the global default should be empty).
>
> Best regards,
> Tony.

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: