Thursday, December 20, 2018

Re: How to vim recognize ssh config file?

On 2018-12-20, Peng Yu wrote:
> 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.

Vim recognizes only the patterns ssh_config and */.ssh/config.
(Open $VIMRUNTIME/filetype.vim and search for ssh.) There are
several ways to add your own non-standard pattern for a filetype.
See ":help new-filetype". I use the method of paragraph C.2: Create
the file ~/.vim/filetype.vim and put the following in it, where the
pattern I've shown as "config.ssh" can by anything you want.

if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufNewFile,BufRead config.ssh setf sshconfig
augroup END

That said, and since you don't seem to care what the file is named,
it might be easiest to just name your file ssh_config.

Regards,
Gary

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