Adventures in programming: Why is vim doing that?

Often in programming, you set out to write some code and you end up on a wild tangent instead. Seeing how someone else walks through one of their wild tangents can be very helpful, so here’s a walk through of the wild tangent I went on today.

What was I trying to do?


I’m working on scanning a bunch of old family photos and I eventually plan to put them online. Before I do so, I want to make sure the EXIF metadata is useful and well formatted, so I created myself a new github repo to store some scripts I’m planning to write. As I was writing a commit message while adding my initial .gitignore, I noticed that vim was inserting newlines and wrapping my commit message without me hitting Enter to move to a new line. While I certainly love a well formatted commit message, it really pulls me out of any kind of flow to have my text editor moving me to a new line without my asking. This annoys me enough, that I decided to dig into vim and figure out why my text was auto wrapping.

Why is vim automatically wrapping text?


Continue reading “Adventures in programming: Why is vim doing that?”

Quick .vimrc for golang

Like vim? Hate tabs, but are writing some golang, which insists on tabs? Here’s what I just updated my .vimrc to today:

set expandtab
set tabstop=4
set ruler
syntax on
if has('autocmd')
    filetype on
    if !exists("autocommands_loaded")
        let autocommands_loaded = 1
        autocmd FileType go setlocal noexpandtab
    endif
endif