Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

CATEGORY: RANDOM

Trial And Error

Change is good! Well at least sometimes. I tried multiple formats for blogs over the years, for example opslife, which still works very well, even if I do not put any content on it, for a year or so. I tried to split up different topics, to different blogs. I’ve always put very much effort in creating new blog. Even spent money on this kind of stuff. Logos, domains, themes, designs. Not cheap at all 😉 But I recognized it’s hard to keep them all up and running. It’s hard enough to have one blog besides a more than full time job. Enough bla bla here.

Static Site Generators vs Classical CMS

You wanted to start a blog and researched how to do it? Then you probably came across some content management systems like WordPress, Drupal or typo3. But I bet you also saw something called static site generators with titles like Pelican, Jekyll or octopus. In this article, I want to help you decide, what could be right for you and take a look at advantages and disadvantages.

 

Spell Checking In Vim

This is the second part of the Series New Series: Writing and Publishing for Command Line Users.

Since my book is written in English, and I am not a native speaker, it would be great to have a spell checking while writing.
Nearly every word processor software comes with pre installed spell checking enabled. So does vim.

How to enable it?

Like mentioned in the first part, I don’t want to have the options for writing enabled while coding, so I put them all into a function called writing.
Check this out here.

And to enable spell checking just add the following line into the function:

If you need another language, for example German, just change it to:

Make sure it installed on your system.

Make use of it

If you followed the steps in ‘prepare vim for writing‘, spell checking should just work as you open a markdown file.

If you type a line like this and make willful errors like me you should recognize the hightlighted words like this:
vim spell checking

So how do I quickly fix these misspelled words?

You can easily go to next misspelled with ]s or search backwards with [s.
Both options can be used with capitals, for example [S. This will only recognize ‘bad’ words. I’ll explain later what these ‘bad’ words are.
When your cursor is at anywhere in between the word, you have multiple options.

You are sure, that the word is right. For example, my book is about TMUX, so I want to add it to my word list, so it won’t be highlighted again.
To add it type zg.

If you did accidentally like me with ‘tesst’ you can just reverse it with zw.

So what is if you really typed wrong words like me here?
Screenshot from 2015-09-27 21-22-56

The first thing you should recognize are the different colors.

‘colour’ is turquoise. stuppid is red, equally to ‘silli’ and ‘english’.

There a different types of highlighting.
For example, colour isn’t totally wrong. In the UK it is ok, but in the US colours is written without an U.

This is a SpellLocal-Error.

To fix this error, just use vim’s built-in suggestions and type z= when your word is under the cursor and you’ll a list like this: Screenshot from 2015-09-27 21-42-55

Now check if the list contains the correct word you’ve meant to write. In this case it’s the number 1.

So just type 1 and and vim replaces ‘colours’ with ‘colors’. Isn’t that great?

But what’s with stuppid, this is totally wrong and highlighted in red?
This is a so called SpellBad-Error. You can fix this in the same way as with SpellLocal-Errors.
Same with ‘silli’ and ‘english’.

Customize it your way

If you don’t like the colors you can easily adjust them. Just remember to it in your Writing() function.

For example if you’d like to have SpellLocal-Errors with yellow background and black foreground, you’d type this:

This works with all the described errors.

I hope you enjoyed reading and it is useful to you.
To stay up to date follow me on twitter or subscribe to the newsletter on the right side.

Prepare Vim for Writing

This is the first part of the Series New Series: Writing and Publishing for Command Line Users.

As I am writing on my first book I recognized, I need a different environment than for coding.

While coding python or C I got my autoindentation, syntaxhighlighting, line numbers and a lot of stuff that becomes disturbing while writing.
I need to turn it off.

The first attempt was the following:
Create a separate .vimrc for writing.
So I created a file .writing_vimrc and added an alias
alias wvim="vim -u BRALALALA"
NO, STOP DOING THIS, THAT’S STUPID!

Vim has so many nice features, so don’t waste your time with bullshit like that.

My second attempt was better. I write my book, notes and blog posts in markdown all the time.
If you got “filetype on”, vim already knows that it’s markdown, so why don’t use this?

So I created an autocmd for markdown files, which works like this:

autocmd FileType markdown call Writing()

What happens here is, vim runs the command “call Writing()” everytime it recognizes the filetype ‘markdown’.
Of course you need to define a function called “Writing()” where you declare, what should happen, to get a noisefree workspace in vim.

Here’s mine for example:

Now you got a clean vim environment.

If you questions just drop a line in the comments.

Have Fun!

Interested in a book about a productive workflow on the command line? Sign up for my book!