Can you do something with Vim? – Ehm, actually, yeah, why not! I’d better not tell you where I got that enlightening moment. But I get this question over and over again, so here I am or better said, here is your Vim beginners course.
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:
set nonumber " turn off the line numbers
set laststatus=0 " turn of my status bar
set columns=80 " define a smaller window for better
setlocal spell spelllang=en_us " define a language for spell checking(more in the next article)
Now you got a clean vim environment.
If you questions just drop a line in the comments.
Interested in a book about a productive workflow on the command line? Sign up for my book!