Cartesius00
Cartesius00

Reputation: 24414

.vimrc for C developers

There is a question How to set .vimrc for c programs?, but nothing especially interesting in there.

By what .vimrc options do you facilitate your C development in Linux? (e.g. for building, ctags, tabs...) Any ideas welcome, especially for "external building with make".

Upvotes: 2

Views: 18985

Answers (3)

plan9assembler
plan9assembler

Reputation: 2984

how about this?

https://mislav.net/2011/12/vim-revisited/

set nocompatible                " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
set showcmd                     " display incomplete commands
filetype plugin indent on       " load file type plugins + indentation

"" Whitespace
set nowrap                      " don't wrap lines
set tabstop=2 shiftwidth=2      " a tab is two spaces (or set this to 4)
set expandtab                   " use spaces, not tabs (optional)
set backspace=indent,eol,start  " backspace through everything in insert mode

"" Searching
set hlsearch                    " highlight matches
set incsearch                   " incremental searching
set ignorecase                  " searches are case insensitive...
set smartcase                   " ... unless they contain at least one capital letter

Upvotes: 3

m0tive
m0tive

Reputation: 2956

Along with options in plan9assembler's answer,

Run make from inside vim, you can just use :make but that won't automatically open the quickfix window with you're errors. To get that to happen, add a second :Make command [1]:

command! -nargs=* Make write | make! <args> | cwindow

Another thing I have is a recursive search for my ctags file. The following will use the tags file in the current directory, then search one directory above recursively till it finds a tag file [2]:

set tags=./tags;

Upvotes: 0

Js Lim
Js Lim

Reputation: 3695

https://github.com/jslim89/dotfiles

This is my repo. Inside already got a few type of vim plugins including c.vim, ctags, autocomplete, etc.

Upvotes: 1

Related Questions