Author's Bio: Anton Mamaenko

Thursday, July 12, 2012

Setting up vim on Fedora 17

Introduction

Dealing with setting up vim to work according to my tastes on Fedora 17 First of all replaced the standard compact vim (does not include syntax highlighting for example) with the full package, using this article as a cheat-sheet: http://www.if-not-true-then-false.com/2012/vi-vim-syntax-highlighting-on-fedora-centos-red-hat-rhel Then modified some settings looking at another article for the rough outline: http://www.slackorama.com/projects/vim/vimrc.html

Yet another useful setting to enable autoindent in c-style:
set cindent
More info: http://vim.wikia.com/wiki/Indenting_source_code

Configuring for make files

By default I configured vim for using expandtab option to expand tabs into spaces. That would work perfectly in Python but cause some troubles when working with make-files as they use Tab symbol as command-separator. To work around this I created a file-type plug-in for make files. On Fedora it means creating a ~/.vim/ftdetect/ folder and putting file named make.vim in there. This file only contains one line:
au BufRead,BufNewFile make  set filetype=make
This detection would run before loading the ~/.vimrc file, and condition for the expandtab is set as following:
:if &ft != "make"
:    set expandtab    " spaces instead of tabs
:endif
All pretty straightforward.
 

No comments:

Post a Comment

Search This Blog