Tuesday, December 15, 2015

Source Code Viewer

I wrote a Source Code Viewer.

There are two things behind this project. The first was the practical problem. I was cutting and copying code for display on my site and I accidentally added errors to the code.

Since my goal is to discuss working code, why not just pull the code from my site?

The second thing. I was playing with the vim text editor that comes with Linux and I wanted to see if I could just sit down and write a program in vim.

Now, I admit, I had become accustomed to the advance code editing features of the WYSIWYG Notepad++ editor. So, I wanted to prove that I could write code in another editor.

By default the code viewer shows the code I wrote to make the code viewer. Unfortunately, this particular piece of code is a big funky as I haven't figured out how to efficiently move text around with vim. In Notepad++, I just highlight it with the mouse, copy and paste. In vim one has to switch modes, yank and move.

I think it is good to periodically switch environments as it forces a rethinking of basics.

My Source Code Viewer lets me display the actual source code of my new site online. It pulls the code from production directory with file_get_contents() and highlights the different parts of the code with bright colors for easy reading.

Currently the code only shows two programs. I will add more as I start porting my sites to this new server. You can comment on the project below or on the Discus Forum.

No comments: