" llvm CODING GUIDELines conformance for VIM
" $Revision$
"
" Maintainer: The LLVM Team, http://llvm.org
" WARNING: Read before you source in all these commands and macros! Some
" of them may change VIM behavior that you depend on.
"
" You can run VIM with these settings without changing your current setup with:
" $ vim -u /path/to/llvm/utils/vim/vimrc

" It's VIM, not VI
set nocompatible

" A tab produces a 2-space indentation
set softtabstop=4
set shiftwidth=4
set expandtab

" Highlight trailing whitespace and lines longer than 80 columns.
highlight LongLine ctermbg=DarkYellow guibg=DarkYellow
highlight WhitespaceEOL ctermbg=DarkYellow guibg=DarkYellow
if v:version >= 702
" Lines longer than 80 columns.
"au BufWinEnter * let w:m0=matchadd('LongLine', '\%>80v.\+', -1)
au BufWinEnter * let w:m0=matchadd('Underlined', '\%>80v.\+', -1)

" Whitespace at the end of a line. This little dance suppresses
" whitespace that has just been typed.
au BufWinEnter * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
au InsertEnter * call matchdelete(w:m1)
au InsertEnter * let w:m2=matchadd('WhitespaceEOL', '\s\+\%#\@<!$', -1)
au InsertLeave * call matchdelete(w:m2)
au InsertLeave * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
else
"au BufRead,BufNewFile * syntax match LongLine /\%>80v.\+/
au BufRead,BufNewFile * syntax match Underlined /\%>80v.\+/
au InsertEnter * syntax match WhitespaceEOL /\s\+\%#\@<!$/
au InsertLeave * syntax match WhitespaceEOL /\s\+$/
endif

" Enable filetype detection
filetype on

" Optional
" C/C++ programming helpers
augroup csrc
au!
autocmd FileType * set nocindent smartindent
autocmd FileType c,cpp set cindent
augroup END
" Set a few indentation parameters. See the VIM help for cinoptions-values for
" details. These aren't absolute rules; they're just an approximation of
" common style in LLVM source.
set cinoptions=:0,g0,(0,Ws,l1
" Add and delete spaces in increments of `shiftwidth' for tabs
set smarttab

" Highlight syntax in programming languages
syntax on

" LLVM Makefiles can have names such as Makefile.rules or TEST.nightly.Makefile,
" so it's important to categorize them as such.
augroup filetype
au! BufRead,BufNewFile *Makefile* set filetype=make
augroup END

" In Makefiles, don't expand tabs to spaces, since we need the actual tabs
autocmd FileType make set noexpandtab

" Useful macros for cleaning up code to conform to LLVM coding guidelines

" Delete trailing whitespace and tabs at the end of each line
command! DeleteTrailingWs :%s/\s\+$//

" Convert all tab characters to two spaces
command! Untab :%s/\t/ /g

" Enable syntax highlighting for LLVM files. To use, copy
" utils/vim/llvm.vim to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.ll set filetype=llvm
augroup END

" Enable syntax highlighting for tablegen files. To use, copy
" utils/vim/tablegen.vim to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.td set filetype=tablegen
augroup END

" Additional vim features to optionally uncomment.
"set showcmd
"set showmatch
"set showmode
"set incsearch
"set ruler

" Clang code-completion support. This is somewhat experimental!

" A path to a clang executable.
let g:clang_path = "clang++"

" A list of options to add to the clang commandline, for example to add
" include paths, predefined macros, and language options.
let g:clang_opts = [
\ "-x","c++",
\ "-D__STDC_LIMIT_MACROS=1","-D__STDC_CONSTANT_MACROS=1",
\ "-Iinclude" ]

function! ClangComplete(findstart, base)
if a:findstart == 1
" In findstart mode, look for the beginning of the current identifier.
let l:line = getline('.')
let l:start = col('.') - 1
while l:start > 0 && l:line[l:start - 1] =~ '\i'
let l:start -= 1
endwhile
return l:start
endif

" Get the current line and column numbers.
let l:l = line('.')
let l:c = col('.')

" Build a clang commandline to do code completion on stdin.
let l:the_command = shellescape(g:clang_path) .
\ " -cc1 -code-completion-at=-:" . l:l . ":" . l:c
for l:opt in g:clang_opts
let l:the_command .= " " . shellescape(l:opt)
endfor

" Copy the contents of the current buffer into a string for stdin.
" TODO: The extra space at the end is for working around clang's
" apparent inability to do code completion at the very end of the
" input.
" TODO: Is it better to feed clang the entire file instead of truncating
" it at the current line?
let l:process_input = join(getline(1, l:l), "\n") . " "

" Run it!
let l:input_lines = split(system(l:the_command, l:process_input), "\n")

" Parse the output.
for l:input_line in l:input_lines
" Vim's substring operator is annoyingly inconsistent with python's.
if l:input_line[:11] == 'COMPLETION: '
let l:value = l:input_line[12:]

" Chop off anything after " : ", if present, and move it to the menu.
let l:menu = ""
let l:spacecolonspace = stridx(l:value, " : ")
if l:spacecolonspace != -1
let l:menu = l:value[l:spacecolonspace+3:]
let l:value = l:value[:l:spacecolonspace-1]
endif

" Chop off " (Hidden)", if present, and move it to the menu.
let l:hidden = stridx(l:value, " (Hidden)")
if l:hidden != -1
let l:menu .= " (Hidden)"
let l:value = l:value[:l:hidden-1]
endif

" Handle "Pattern". TODO: Make clang less weird.
if l:value == "Pattern"
let l:value = l:menu
let l:pound = stridx(l:value, "#")
" Truncate the at the first [#, <#, or {#.
if l:pound != -1
let l:value = l:value[:l:pound-2]
endif
endif

" Filter out results which don't match the base string.
if a:base != ""
if l:value[:strlen(a:base)-1] != a:base
continue
end
endif

" TODO: Don't dump the raw input into info, though it's nice for now.
" TODO: The kind string?
let l:item = {
\ "word": l:value,
\ "menu": l:menu,
\ "info": l:input_line,
\ "dup": 1 }

" Report a result.
if complete_add(l:item) == 0
return []
endif
if complete_check()
return []
endif

elseif l:input_line[:9] == "OVERLOAD: "
" An overload candidate. Use a crazy hack to get vim to
" display the results. TODO: Make this better.
let l:value = l:input_line[10:]
let l:item = {
\ "word": " ",
\ "menu": l:value,
\ "info": l:input_line,
\ "dup": 1}

" Report a result.
if complete_add(l:item) == 0
return []
endif
if complete_check()
return []
endif

endif
endfor

return []
endfunction ClangComplete

" This to enables the somewhat-experimental clang-based
" autocompletion support.
set omnifunc=ClangComplete

set number
set nobackup
set noswapfile
"set ignorecase
set hlsearch
set incsearch
"set autochdir
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
match Character /\t/
hi Character term=standout ctermfg=0 ctermbg=3 guifg=Black guibg=DarkYellow
let Tlist_Ctags_Cmd = 'ctags'
let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
au BufNewFile,BufRead *.md set filetype=lisp

cs add ./cscope.out

nmap <F2> :cs f s <C-R>=expand("<cword>")<CR><CR>
nmap <F3> :cs f g <C-R>=expand("<cword>")<CR><CR>
nmap <F4> :cs f f <C-R>=expand("<cword>")<CR><CR>

我的Linux系统的VIMRC的更多相关文章

  1. linux系统各种乱码问题

    linux系统乱码问题 最近使用ubuntu操作系统(客户端)在ssh连接linux服务器的时候发现乱码问题,但是本机查看中文显示中文没有问题,只是在使用终端more查看本地或远端gbk之类中文编码的 ...

  2. linux系统下Vi编辑器或者Vim编辑器设置显示行号、自动缩进、调整tab键宽度的技巧?

    工作中嫌vim 中一个tab键的宽度太大,linux系统默认,没改之前是一个tab键宽度是8个字符,想改成4个字符, 操作如下:(注意:这是在root用户下)cd ~vim .vimrc添加如下几行: ...

  3. Linux系统一本通(实用篇)

    本人最近一直在ubuntu,接下来和大家分享我曾经踩过的坑,和一些非常实用的命令知识- 安装中的磁盘分配 一般来说,在linux系统中都有最少两个挂载点,分别是/ (根目录)及 swap(交换分区), ...

  4. 一般的linux系统默认安装的vim是精简版

    一般的linux系统默认安装的vim是精简版(vim-tiny),所以不能配置语法检查等属性或获取在线帮助.需要安装vim-x:x.x.x,vim-common,vim-runtime. :synta ...

  5. 实验三:Linux系统用户管理及VIM配置

    项目 内容 这个作业属于哪个课程 班级课程的主页链接 这个作业的要求在哪里 作业要求链接地址 学号-姓名 17043133-木腾飞 学习目标 1.学习Linux系统用户管理2.学习vim使用及配置 实 ...

  6. 实验三 Linux系统用户管理及VIM配置

    项目 内容 这个作业属于哪个课程 班级课程的主页链接 这个作业的要求在哪里 作业要求链接接地址 学号-姓名 17041428-朱槐健 作业学习目标  1.学习Linux系统用户管理 2.学习vim使用 ...

  7. 在Linux系统下运行微信Web开发者工具

    微信Web开发者工具只有window版本和mac版本,如果想要在Linux系统下运行微信Web开发者工具,需要花费很大周折. 注:带 * 的步骤或文件为不确定是否管用的步骤或文件.本人系统为Linux ...

  8. Linux实战教学笔记06:Linux系统基础优化

    第六节 Linux系统基础优化 标签(空格分隔):Linux实战教学笔记-陈思齐 第1章 基础环境 第2章 使用网易163镜像做yum源 默认国外的yum源速度很慢,所以换成国内的. 第一步:先备份 ...

  9. Linux系统中的Device Mapper学习

    在linux系统中你使用一些命令时(例如nmon.iostat 如下截图所示),有可能会看到一些名字为dm-xx的设备,那么这些设备到底是什么设备呢,跟磁盘有什么关系呢?以前不了解的时候,我也很纳闷. ...

随机推荐

  1. CSS——宽高问题大汇总

    1.宽高继承 他们是要属性的,并不是直接就能继承,inherit. 2.浮动的盒子不要给宽,宽度由内容来决定

  2. Bootstrap Table的使用

    前言:BootstrapTable基于Bootstrap,Bootstrap基于jquery,所以需要引入jquery后再引入bootstrap. <link href="${ctx} ...

  3. mrql初级教程-概念、使用(一)

    以下是本人原创,如若转载和使用请注明转载地址.本博客信息切勿用于商业,可以个人使用,若喜欢我的博客,请关注我,谢谢!博客地址 感谢您支持我的博客,我的动力是您的支持和关注!如若转载和使用请注明转载地址 ...

  4. nexus 中央仓库

    nexus 中央仓库 下载地址:http://www.sonatype.org/nexus/archived 下载最新版本 mkdir -p /opt/local/nexus tar zxvf nex ...

  5. java数组的声明由几种方式

    数组的声明由几种方式: 1,String []a = new String[length];再赋值 a[0]=?;....... 2,new完就直接初始化: String []a = new Stri ...

  6. 8、手把手教你Extjs5(八)自定义菜单2

    这一节来定义另外三种类型的菜单类.首先定义菜单按钮类.文件放于app/view/main/region目录下面,文件名为ButtonMainMenu.js. /** * 显示在顶部的按钮菜单,可以切换 ...

  7. C socket post数据到url

    #define HOST_SERVER_IP "192.168.1.15" #define HOST_PORT 80 int gsh_post_clients(const char ...

  8. Mapreduce TopK

      思想比较简单,就是每个通过map来获取当前的数据块中的的topk个数据,然后将他们以相同的key值放到reduce中,最后通过reduce来对这n*k个数据排序并获得topk个数据.具体的就是建立 ...

  9. hdu 2614

    #include<stdio.h> int map[99][99]; int vist[99]; int sum=1; int maxsum=1; int max=0; int N; vo ...

  10. libusb开发者指南(转)

    源:libusb开发者指南 译者: gashero 作者: Johannes Erdfelt 日期: 2010-04-17 地址: http://libusb.sourceforge.net/doc/ ...