I used to use Code::blocks and eclipse for code editing, but started to find them slow. I started searching for lightweight IDE's and found that the prevailing opinion is that if you are looking for lightweight code creation you should use vim/emacs, gcc and the other gnu utilities.

I started doing this on my linux box and found it wonderful. Then I sat down in front of my windows computer, installed the core utils, created a custom cmd with batch and installed vim for windows.

My cmd:

@echo off

rem Set the title
title LABinux

rem Set the text colour (this is yellow on black)
color 0E

rem Load into a cleaner directory
cd /d D:\LNX

rem Set console width to 81 characters, height to 80
mode 81,80


rem Set the prompt to current directory> treating D:\LNX as ~
set /p cmd="%cd:D:\LNX=~%> "
rem Call the entered command
call %cmd%

rem Padding between lines
goto getcmd

I am very happy with my setup (despite the fact that HJKL for movement on dvorak is painful!) but there is a problem with it that is bugging me.

My problem is that vim doesn't highlight some of the languages I use very effectively. For example WLPP (a custom language used occasionally by the University of Waterloo) is highlighted horrendously by default in vim. Some esoteric languages and other less-known languages are also poorly highlighted.

I have seen some tutorials on making vim highlight c++ better, but I am wondering how one can set up vim so that it highlights custom file extensions in a custom way.

For example, consider a language where every word ending with ~ should be highlighted differently with its own set of custom keywords. How could I achieve this? Note: I am very comfortable writing parsers and have even written a few compilers before (including a full c compiler, granted with very little optimization).

Recommended Answers

All 3 Replies

I am not sure how to help you out but as you mentioned you've checked out about text editors, I am using SublimeText 3 , I found it really REALLY good, it highlights great, supports possibly 90% of all existing languages, it has AI involved and autofills every existing variable/method/like everything. If you have the time, and you haven't looked into it yet, go for it

The issue with sublime, as with notepad++ etc, is that they only do existing languages, not languages that my prof's invent to help us learn specific algorithms and techniques. On top of that, I have never been a fan of autofill (I had to disable it in C::B).

The benefit to using languages invented by prof's is that they always come with a complete BNF description, so it is really easy to write parsers for them (we did an example writing an HTML highlighter). I remember reading somewhere that you can create a specific type of xml document to get C::B or notepad++ to do custom highlighting, but couldn't find an example anywhere.

I think I am going to duplicate this post in a couple of dedicated vim forums as well, to increase my chance of getting a result.

I just used the "Jellybeans" theme with WLPP (and set it to use c++ syntax highlighting) and it looked fine. Though I didn't spend much time writting in WLPP except when I was testing parts of my compiler for the last two assignments.

EDIt: If you want to edit/create the themes, the best place to start looking is the .vim files (you should be able to specify the things you want to colour with regexs I beleive). Also, the help system in vim is amazing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.