Wikia

Vim Tips Wiki

Changes: Change filetype based on directory path

Edit

Back to page

(merge in the comment)
(formatting and some rewording)
 
Line 3: Line 3:
 
|previous=741
 
|previous=741
 
|next=743
 
|next=743
|created=June 8, 2004
+
|created=2004
 
|complexity=basic
 
|complexity=basic
 
|author=Michael Pyne
 
|author=Michael Pyne
|version=5.7
+
|version=6.0
 
|rating=10/8
 
|rating=10/8
 
|category1=
 
|category1=
 
|category2=
 
|category2=
 
}}
 
}}
I recently installed pyblosxom to do blogging, and I use vim to edit my blog posts. pyblosxom automatically transforms your .txt files under a certain path into HTML, RSS, or whatever else is appropriate. Obviously, your .txt files will probably contain HTML, so if you would like to tell vim to use a different syntax highlighting style for files under a directory path, try adding this to your vimrc:
+
I recently installed pyblosxom to do blogging, using Vim to edit blog posts. Pyblosxom automatically transforms .txt files under a certain path into HTML, RSS, or whatever else is appropriate. These .txt files will probably contain HTML, so if you would like to tell Vim to use a different syntax highlighting style for files under a directory path, try adding this to your [[vimrc]]:
 
 
<pre>
 
<pre>
 
autocmd BufRead,BufNewFile ~/.pyblosxom/data/* set syntax=html
 
autocmd BufRead,BufNewFile ~/.pyblosxom/data/* set syntax=html

Latest revision as of 07:17, January 22, 2011

Tip 742 Printable Monobook Previous Next

created 2004 · complexity basic · author Michael Pyne · version 6.0


I recently installed pyblosxom to do blogging, using Vim to edit blog posts. Pyblosxom automatically transforms .txt files under a certain path into HTML, RSS, or whatever else is appropriate. These .txt files will probably contain HTML, so if you would like to tell Vim to use a different syntax highlighting style for files under a directory path, try adding this to your vimrc:

autocmd BufRead,BufNewFile ~/.pyblosxom/data/* set syntax=html

CommentsEdit

As an aside, another way to go about this would be a user command that gives you a skeleton entry, saved and named (for instance current time/date stamp) as you desire with your cursor placed where you want. File format, patch mode and other such options can be set as desired as well.

Around Wikia's network

Random Wiki