.vimrc for C developers

15,866

Solution 1

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

Solution 2

https://github.com/jslim89/dotfiles

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

Share:
15,866

Related videos on Youtube

Cartesius00
Author by

Cartesius00

Fun

Updated on June 04, 2022

Comments

  • Cartesius00
    Cartesius00 almost 2 years

    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".

    • kev
      kev over 12 years
      If you have make .vimrc on your own, you're ready to code C in vim.
    • Frank Cheng
      Frank Cheng over 12 years
      Try to learn how to write vim script. The grammar is quite easy and learning progress will be very happy.
  • m0tive
    m0tive over 12 years
    You might also want to set autoindent and set cindent to get automatic tabbing (or are those enabled with filetype indent on?)
  • m0tive
    m0tive over 12 years
    I actually use set tags=tags;/ in my .vimrc. I think it does the same thing...
  • u0b34a0f6ae
    u0b34a0f6ae over 12 years
    I would recommend to use set expandtab, set shiftwidth=4 softtabstop=4 and not touch tabstop at all. sts will make the soft tabs behave nicely with backspace.