" 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. unittest单元测试框架总结

    unittest单元测试框架不仅可以适用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行测试用例,并且提供了丰富的断言方法,判断测试用例是否通过,最终生成测试结果.今天笔者 ...

  2. JavaScript(三)---- 控制流程语句

    常用的控制流程语句有判断语句.分支语句.循环语句.基本用法都和java中的一致,switch有几点特殊. 1.判断语句 格式:        if(判断条件){            符合条件执行的代 ...

  3. 51Nod 1534

    分析:Pwin代表Polycarp走的步数,而Win代表Vasiliy走的步数,则有Pwin=p.x+p.y,Vwin=max(v.x,v.y);显然若Pwin<=Win,肯定是Vasiliy胜 ...

  4. [算法] kruskal最小生成树算法

    #include <stdio.h> #include <stdlib.h> #define MAX 100 int N, M; struct Edge { int u,v; ...

  5. 生成R文件

    aapt package -f -m -J H:/workspaces/java_android/Test2/gen -S H:/workspaces/java_android/Test2/res - ...

  6. iOS开发UI篇—ios应用数据存储方式(归档) :转发

    本文转发至:文顶顶http://www.cnblogs.com/wendingding/p/3775293.html iOS开发UI篇—ios应用数据存储方式(归档)  一.简单说明 在使用plist ...

  7. 自动安装脚本-------------基于LVMP搭建Nagios 监控

    Mysql初始化参数(mysql-5.6.31) /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local ...

  8. AOP:代理实现方式①通过继承②通过接口

    文件结构: 添加日志: package com.wangcf.manager; public class LogManager { public void add(){ System.out.prin ...

  9. #Pragma Pack(n)与内存分配

    #pragma pack(n) 解释一: 每个特定平台上的编译器都有自己的默认"对齐系数"(也叫对齐模数).程序员可以通过预编译命令#pragma pack(n),n=1,2,4, ...

  10. MySQL的char和varchar

    一.VARCHAR与CHAR字符型数据的差异 在MySQL数据库中,用的最多的字符型数据类型就是Varchar和Char,这两种数据类型虽然都是用来存放字符型数据,但是无论从结构还是从数据的保存方式来 ...