" 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. 如何使用UDP进行跨网段广播(转)

    源:http://blog.chinaunix.net/uid-22670933-id-3716646.html 广播域首先我们来了解一下广播域的概念.广播域是网络中能接收任一台主机发出的广播帧的所有 ...

  2. 获取一个gridcontrol的数据行数

    ((DataTable)gc_excel.DataSource).Rows.Count;

  3. 【BZOJ 1572】 1572: [Usaco2009 Open]工作安排Job(贪心+优先队列)

    1572: [Usaco2009 Open]工作安排Job Description Farmer John 有太多的工作要做啊!!!!!!!!为了让农场高效运转,他必须靠他的工作赚钱,每项工作花一个单 ...

  4. 轻量级sqlite是增删改查

    --创建数据库 create database ios --使用数据库 use ios --创建数据表 create table student ( stuid int primary key aut ...

  5. UIScroll和UIPickView

    .h #import <UIKit/UIKit.h> #define WIDTH self.view.frame.size.width #define HEIGHT self.view.f ...

  6. C语言实现GBK/GB2312/五大码之间的转换(转)

    源:C语言实现GBK/GB2312/五大码之间的转换 //----------------------------------------------------------------------- ...

  7. jquery中如何以逗号分割字符串_百度知道

    body{ font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI& ...

  8. Jsoup使用教程

    一.解析和遍历一个HTML文档1.解析Html及Url链接 String html = "<html><head><title>First parse&l ...

  9. linux日常巡检脚本

    ######################以下是脚本内容开始部分###################################### #!/bin/bash #set -x2012-02-2 ...

  10. 理解Twisted与非阻塞编程

    先来看一段代码: # ~*~ Twisted - A Python tale ~*~ from time import sleep # Hello, I'm a developer and I mai ...