.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.
Related videos on Youtube
Comments
-
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 yourC
development in Linux? (e.g. for building, ctags, tabs...) Any ideas welcome, especially for "external building with make".-
kev over 12 yearsIf you have make
.vimrc
on your own, you're ready to codeC
in vim. -
Frank Cheng over 12 yearsTry to learn how to write vim script. The grammar is quite easy and learning progress will be very happy.
-
-
m0tive over 12 yearsYou might also want to
set autoindent
andset cindent
to get automatic tabbing (or are those enabled withfiletype indent on
?) -
m0tive over 12 yearsI actually use
set tags=tags;/
in my.vimrc
. I think it does the same thing... -
u0b34a0f6ae over 12 yearsI would recommend to use
set expandtab
,set shiftwidth=4 softtabstop=4
and not touchtabstop
at all.sts
will make the soft tabs behave nicely with backspace.