1

I am looking for a filetype= argument that will format or color document constructs such as lists, headers and sub headrs.

Particularly I want the filetype plugin (or syntax plugin) to interpret these formats:

Header
======

Sub
---

Sub2
----


[*] moo
[*] foo
[*] bar
3
  • 1
    Is this a format you've come up with, or an existing one? If it's an existing one, it probably already has a plugin for Vim; just search vim.org/scripts/index.php for the name of the markup language. If not, you can probably take an existing language (such as Markdown) and adapt its plugin fairly easily. Oct 16, 2012 at 21:55
  • @echristopherson I'm looking for "markdown". Thank you. Oct 16, 2012 at 22:01
  • Then you can just :set ft=markdown. However, [*] is not part of Markdown proper; you can use + or - or *. Oct 17, 2012 at 0:12

2 Answers 2

1

Markdown is sufficient enough or applying basic styles and formatting to plain-text documents.

-1

What you probably want is to use syntax highlighting.

Check out the vbnet.vim plugin to see a more complex example of a syntax file than is shown in the tutorial. You'll need to create your own syntax file to handle the custom formats you show in your question. You would do this by setting up various keyword, match, cluster, and region groups to get what you want. Examples of how to set up each of these groups can be found in the vbnet.vim plugin.

Once you've written your own custom syntax file, then assign those syntax groups a name as seen in the last line of vbnet.vim:

let b:current_syntax = "vbnet"

And in your .vimrc use an autocmd to turn on that specific syntax highlighting for a specific file extention:

autocmd BufNewFile,BufRead *.vb set ft=vbnet

Adjust the highlighting of various groups in your colorscheme file.

4
  • Isn't all .net stuff C#? Why can't I simply use a C# syntax file and use :set syntax=c# (or even let it auto-detect it)? I know that I want to use syntax highlighting, but not for visual basic, because I can guess they don't use headers and lists like I asked for in the question. All I wanted was a name of a format. Oct 16, 2012 at 22:10
  • 1
    I think the idea was to just use vbnet.vim as a point to start making a new syntax file. Oct 17, 2012 at 0:00
  • @Ярослав Рахматуллин .NET is a framework that is language agnostic. But that's neither here nor there. The example formats you gave in your question are not part of any standard filetype. What I provided was a tutorial on how to set up custom syntax highlighting and an example of a more complex syntax file to get a feel for how to write your own. echristopherson is correct, it was meant only as a starting point. Sorry if that wasn't clear. Oct 17, 2012 at 12:02
  • Markdown is part of my distro's vim package. I don't know the syntax, hence the wrong [*] list elements. Headers are right, tough. Thanks for your answer. Oct 17, 2012 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .