Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Thursday, 17 December 2009

Linux Tips: Vim autoconfigure for different filetypes

Thanks to Ajay Somani, over at http://ajayfromiiit.wordpress.com/ for this post that finally helped me solve a long term gripe with vim.

When I'm in 'programmer' mode, I use vim with syntax highlight turned on.
When I'm in 'wannabe fiction writer' mode, I use it with spell check turned on.

And these two personas keep fighting like Jekyll and Hyde. Because I have both of these turned on, vim insists on syntax highlighting my fiction, interpreting apostrophes as quotes and then coloring everything after them. Worse still, it spell-checks my C-code. It'll highlight some text in red, and then spell-check it, and decide it's mis-spelt, and thus surround it in a background colored.... red. This results in large blocks of red-on-red text that cannot be... uh... read.

The solution, it turns out, is to add this magic line to my vimrc:

autocmd BufEnter *.txt set spell

Sunday, 29 November 2009

Linux tips: Recovering lost text data from disk, or EVEN MEMORY

Okay, first new post for the new 'technical' blog. The topic is "Holy ****!!! I just had my browser/text editor crash, and I've lost all that work! What do I do now?"

Well, so long as the editor you were using stores it's data in some form of plain text, and so long as you are using linux, freebsd, or some other unix, (or possibly Mac OSX), I may be able to help.


WARNING: These techniques, like any secret powers, come with a degree of risk. I take no responsibility for any accidents where you wipe your hard-disk, explode your computer, or accidentally sell your soul to the devil. In fact I take no responsiblity for anything at all. You have been warned.