Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

TAG: vim

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"

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!

There are no more results.