Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question
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. –  echristopherson Oct 16 '12 at 21:55
    
@echristopherson I'm looking for "markdown". Thank you. –  Ярослав Рахматуллин Oct 16 '12 at 22:01
    
Then you can just :set ft=markdown. However, [*] is not part of Markdown proper; you can use + or - or *. –  echristopherson Oct 17 '12 at 0:12
add comment

2 Answers

up vote 0 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
    
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 '12 at 22:10
1  
I think the idea was to just use vbnet.vim as a point to start making a new syntax file. –  echristopherson Oct 17 '12 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. –  embedded.kyle Oct 17 '12 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 '12 at 15:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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