0

I am a relative new user to vim. I started using it along with a newly set up arch installation. So when I created different netctl profiles in vim, it highlighted the parameters like shown in the image, without having defined a filetype. But from one moment, it stopped doing so, the plain text profiles are now unicolored and I cant get it back working, e.g. by switching on syntax highlighting manually.highlighting as it worked out of the box Edit: the shown profile is named like in the description, htw_eduroam. No file extension.

  • What is an example filename? – D. Ben Knoble Oct 24 '18 at 18:38
  • Hey Phil! It looks like you're having some trouble logging into your account. Just so you know, you can use the contact us page to get your two accounts merged – DJMcMayhem Oct 24 '18 at 21:50
  • 1
    Most likely, since your file does not have an extension, vim cannot determine what filetype it is. You can try setting the filetype manually. However from your example I cannot tell, what filetype this should be. – Christian Brabandt Oct 25 '18 at 6:00
  • My best bet is that the syntax is python. You can try :set syntax=python. Another note is that you can see the type of file you are working on easily using the powerline plugin. – eyal karni Oct 25 '18 at 23:11
1

Vim generally identifies the filetype(and therefore the syntax higlighting) from the extension of a file. one.py would imply that it's a Python file. But in your case, since your file netctl does not have an extension, it is not able to ascertain the filetype.

Since the syntax of assignments in netctl is very similar to Python, you can type :set syntax=python in the normal mode. You could also do the same with :set filetype=python. Though it would do the trick, I do not recommend the same.

If you extensively work with these files, you could make your own vim syntax files . Have a look at :help syntax in vim.

Edit : As @Christian mentioned in comment,:set syntax=dosini will set the syntax highlighting as it's an ini file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.