2011-12-17 74 views
1

有一个问题How to set .vimrc for c programs?,但没有什么特别有趣的地方。.vimrc for C developers

通过什么.vimrc选项是否方便您在Linux中开发C? (例如建筑物,标签,标签......)任何想法都欢迎,特别是对于“外部建筑物与制造”。

+2

如果你有做'你自己.vimrc`,你准备好在vim中编写`C`。 – kev 2011-12-17 09:43:28

+0

尝试学习如何编写vim脚本。语法很简单,学习进度会很开心。 – 2011-12-17 10:59:32

回答

3

这个怎么样?

http://mislav.uniqpath.com/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 
+0

你可能还想'设置autoindent`和`设置cindent`来获得自动tab(或启用'filetype indent on`?) – m0tive 2011-12-17 13:33:18

0

随着plan9assembler的答案选项,

运行make Vim内,你可以只使用:make但不会自动与你的错误,打开窗口。为了让这种情况发生,添加第二个:Make命令[1]:

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

我有另一件事情是我的ctags文件递归搜索。下面将使用标记文件在当前目录下,然后上面搜索递归一个目录,直到它找到一个标签文件[2]:

set tags=./tags;