Vim Autocommands

Uncategorized Add comments

I started using “vi” because it was everywhere, and worked out-of-the-box. It acted the same regardless which server I got to, and even on embedded systems, that’s been fairly consistent.

Emacs was complex, consumed massive memory (“Emacs is an OS”)(“Due to RAM contention on shared systems, USL engineers will not use Emacs”) and it required this configuration out-of-the-box to get anything done.

Whelp, it seems I”ve become enamored with Vi (Vim) configuration. Minimally. I can quit anytime. Honest.

:autocmd BufRead,BufNewFile   *.py      set ts=4 sts=4 sw=4 tw=99 et ai ff=unix

Expanded, this auto-sets Python options to be:

  • tabstop=4
  • softtabstop=4
  • shiftwidth=4
  • textwidth=99 (word-wrap after)
  • expandtab (tabs -> spaces)
  • autoindent
  • fileformat=unix

I’m a bit embarrassed that I haven’t looked into this until now, I kinda didn’t feel the need. Today has been frustrating, so I think this issue has been painted with The Angry Brush for the day.

Anger has a blast radius; I’m using it to fix my editor. Ever so slightly.

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in