Thursday, August 16. 2007DrProject/Trac Wiki Syntax Highlighting for VimAfter being frustrated with boring white-on-almost-black (spectro) while working with DrProject wiki files, I broke down and wrote a Vim plugin to make the syntax pretty. It will also parse most of the Trac syntax (and more should be easy to add). Get it: http://wolever.net/~wolever/drpwiki.vim Using it:
Friday, June 15. 2007Fixing Files with Vim MacrosI got an email a couple days ago asking me to add a small header to all the pages of a website I work on from time to time. The site was built with static HTML a couple of years ago and this was the first site-wide modification I've had to make since then. So I fired up Vim, loaded the session I use to work on the page and got to work. It didn't take too long to make the changes to one page -- add a couple of JavaScript functions, add a call to the the body's But then came the problem. How do I apply this change to all the pages? Normally, to do multi-file search-and-replace, I use So how did I do it? By writing a Vim script! I used As I made the changes, I used general steps so that they could be repeated on each file. For instance, I used Finally, after saving the file, I used Now, this makes me curious... Faced with a similar situation, how would you solve a problem like this? 1: Now, in retrospect, I realize I could have used:
for FILE in `find . -name '*.html'`; do
read -p "Edit $FILE? " R
if [[ $R == "y" ]]; then
perl -pi -e 's/old/new' $FILE
fi
done
But that would assume that I was putting some serious level of thought in to this. Also, unless I also had the presence of mind to add
(Page 1 of 1, totaling 2 entries)
|
QuicksearchLinks
CategoriesSyndicate This Blog |
