mkdir -p ~/.vim/bundle/Vundle.vim

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

####################################################.vimrc ####################################################

set nocompatible              " be iMproved, required
filetype off " required " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim' Plugin 'taghighlight' Plugin 'majutsushi/tagbar'
nmap tb :TagbarToggle<CR>
let g:tagbar_ctags_bin='ctags' "ctags程序的路径
let g:tagbar_width=30 "窗口宽度的设置
"map <F3> :Tagbar<CR>
"autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen() "如果是c语言的程序的话,tagbar自动开启 Plugin 'scrooloose/nerdtree' "文件资源管理器
nmap fb :NERDTreeToggle<CR>
let NERDTreeWinPos='left'
let NERDTreeWinSize=30
"map <F2> :NERDTreeToggle<CR>
Plugin 'git://github.com/kien/ctrlp.vim.git' "NERDTree 下按Ctrl-p搜索文件名
Plugin 'bling/vim-airline' "状态栏
set laststatus=2 Plugin 'fholgado/minibufexpl.vim'
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
let g:miniBufExplMoreThanOne = 0
map <F11> :MBEbp<CR>
map <F12> :MBEbn<CR>
Plugin 'vim-scripts/DoxygenToolkit.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
""Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
""Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
""Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'} " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just:PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line set nu
set ts=4
set expandtab
set smartindent
set shiftwidth=4
set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,gbk,latin1
set hls
"hi comment ctermfg=6 func CFileTitle()
call setline(1, "/**")
call append(1, "* ".expand("%"))
call append(2, "* wangkaichao@skyworth.com ".strftime("%Y-%m-%d"))
call append(3, "*/")
endfunc map title :call CFileTitle()<CR> "inoremap { {}<LEFT>
"inoremap [ []<LEFT>
"inoremap ( ()<LEFT>
"inoremap " ""<LEFT>
"inoremap ' ''<LEFT>

#################################################### 基本应用 ####################################################

(1) 调出 vim 命令历史列表

<ESC>q:

(2) 查看 打开的文件缓冲区

<ESC>:ls

(2) 文件缓冲区 文件切换

方法1 <ESC>:bn # n是ls显示的id号

方法2 <Ctrl + 6> #顺序切换

方法3 <ESC>:e filename

(3) <ESC>:vs 垂直分割窗口

(4) <ESC>:sv 水平分割窗口

(5) <ESC><Ctrl + w> hjkl 在窗口之间切换

Ctrl-w H或键入:wincmd H水平布局到垂直布局。

Ctrl-w J或键入:wincmd J垂直布局到水平布局。

Ctrl-w r或键入:wincmd r交换两个缓冲区,但保持窗口布局相同。

Ctrl-w w或键入:wincmd w移动光标两个窗口/缓冲器之间。

(6) 不同窗口文件间复制粘贴

复制 <ESC>v(进块模式) 选择文件内容 +y 或者*y

粘贴 <ESC>+p 或者*p

(6.1)寄存器复制粘贴

复制 <ESC>v(进块模式) 选择文件内容

"[a-z]y

"[a-z]p

(7) 调整窗口大小

水平调整窗口的各种操作:
<ESC><Ctrl+w> 松手,n+     #窗口边界上移n
<ESC><Ctrl+w> 松手,n-      #窗口边界下移n
<ESC><Ctrl+w> _       #将当前窗口调到最大
<ESC><Ctrl+w> =       #平分窗口
 垂直调整窗口的各种操作:
<ESC><Ctrl+w> 松手,n<    #窗口边界左移n
<ESC><Ctrl+w> 松手,n>   #窗口边界右移n
<ESC><Ctrl+w> |       #将当前窗口调到最大
<ESC><Ctrl+w> =        #平分窗口,这个快捷键是通用的。

(8) 常用删除操作

di( #删除括号内内容

di[

di{

daB #删除{内容包括{}

(9) vim 前后台切换

<ESC><Ctrl-z>  #进入后台

jobs  #查看当前后台的vim

fg n  #根据jobs列出的id,将该id切入前台

(10) vim 编辑目录

<ESC>:e pathanme

<ESC>:Exp[lore] pathname       # 浏览该目录
<ESC>:Sex[plore] .     #在水平分割窗口中浏览该目录
<ESC>:Vex[plore] .     #在垂直分割窗口中浏览该目录

(11) vim 使用文件标签tab

<ESC>:tabe filename

<ESC>:tabs     #显示已打开标签页的列表,并用“>”标识出当前页面,用“+”标识出已更改的页面。

<ESC>:tabc n  #关闭tabs 列出来的签页id=n,tabc不加参数,默认关闭 “>”,即当前标签页 。

<ESC>:tabo     #关闭所有的标签页。

<ESC>:tabn或<ESC>gt   #移动到下一个标签页。

<ESC>:tabp或<ESC>gT  #移动到上一个标签页。

#################################################### cscope ####################################################

#######################################cscope 貌似比ctags强大,存系统api的符号更好,不用更新

apt-get install cscope

find /opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/include/c++/4.8.3 -name "*" > c++.files

cscope -bkq -i c++.files -f c++.out

find /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/usr/include -name "*.[h|c]" > c.files

cscope -bkq -i c.files -f c.out

vim file

<ESC> cs add /path/c.out

注意在查找标识符之前,当前文件一定要<ESC>:w

<ESC> cs find g/s funcname

显示多个项,按空格,输入id,跳转到声明出,返回方法:ls + bn  或者<Ctrl+6>

#################################################### ctags ####################################################

####################################################比较灵活,多用来同步应用代码的标识,要更新

apt-get install ctags

ctags --c++-kinds=+p --fields=+iaS --extra=+q -R -f xxtags ./

# set tags+=xxtags

<Ctrl> + ] 跳转到的定义

<Ctrl> + o/t 返回

=========================================================================================================

set fenc                 查看现在文本的编码

:set fenc=编码       转换当前文本的编码为指定的编码

:set enc=编码        以指定的编码显示文本,但不保存到文件中。

:set ff?                   查看当前文本的模式类型,一般为dos,unix

:set ff=dos            转换为dos模式
:set ff=unix           转换为unix模式,等同于:%s/^M//g

Vim常用配置的更多相关文章

  1. Vim - 常用配置

    基本配置 不用任何插件的情况下,先按如下配置: set nu syntax on set hlsearch set tabstop=4 set shiftwidth=4 set expandtab s ...

  2. vim常用配置 vimrc文件

    自从接触vim,自己瞎鼓捣.vimrc也有一段时间了.收集记录一下好用的配置. 一.奇技淫巧 1.折叠代码 折叠代码常常用在代码块较长的情况下,比如一个文件里定义了很多个函数,或者注释.括号影响的阅读 ...

  3. Vim 常用配置及插件安装使用

    在 Linux 中习惯了 vim 编辑器. 找了一些资料后自己尝试配置起来了.下面是一些过程. 首先需要知道 vim 相关的配置都是写在 ~/.vimrc 文件中.我下面的笔记只配置了一些我常用的功能 ...

  4. Vim常用配置(~/.vimrc)(转载)

    原文地址:http://www.2cto.com/os/201309/246271.html " This must be first, beacuse it changes other o ...

  5. Vim常用命令及配置方案

    Vim常用命令及配置方案   几句话 很久之前就接触到vim,初学那阵觉得vim很酷炫,但确实对新手不是很友好.我也就简单看了下基本操作就上手了,但又不是长期在vim下工作,这就导致了每一次重新使用v ...

  6. vim+vundle配置

    Linux环境下写代码虽然没有IDE,但通过给vim配置几个插件也足够好用.一般常用的插件主要包括几类,查找文件,查找符号的定义或者声明(函数,变量等)以及自动补全功能.一般流程都是下载需要的工具,然 ...

  7. Vim 常用技巧:

    Vim 常用技巧: 将回车由默认的8个空格改为4个空格: 命令:set sw=4 修改tab为4空格: 命令:set ts=4 设置每一级的缩进长度: 命令:set shiftwidth=4 设置文件 ...

  8. VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装

    VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...

  9. Linux常用命令及vim的使用、vim常用插件(推荐)

    看了3篇文章,很好 vim中的区域拷贝 剪切,粘贴: 正常模式,移动光标到剪切的区域开始处,按v,进入可视模式,然后选择区域.按x键,剪切.到指定位置按p粘贴. 撤销按u 恢复按ctrl-r  简明 ...

随机推荐

  1. 利用Python代码编写计算器小程序

    import tkinter import tkinter.messagebox import math class JSQ: def __init__(self): #创建主界面 self.root ...

  2. IDT表连接

    一.table A为基础表,左外连接table B,若要限制B的条件,需加(+),否则会对结果集以B表的条件进行过滤. DWD_REASON_CODE.CODE(+)=DWR_EDA_CL_TST_D ...

  3. pip install torch on windows, and the 'from torch._C import * ImportError: DLL load failed:' solution

    通过pip安装PyTorch 0.4.0成功(cpu, not gpu; python3.5; pip): pip3 install http://download.pytorch.org/whl/c ...

  4. 简单尝试利用维控LeviStudioU的一栈缓冲区溢出漏洞

    这是别人给我发的,让我分析一下,看能否写出exp.只怪自己水平不够,最后没能写出exp,以下为自己的分析思路 环境为win10 pro x64 英文版(10.0.16299) 默认安全配置 一.漏洞分 ...

  5. Windows batch file

    Echo off @ECHO OFF echo string to generate the output create a blank line echo . create a file echo ...

  6. Logback动态修改日志级别

    https://blog.csdn.net/totally123/article/details/78931287

  7. 使用LFSR搭建误差补偿系统

    使用LFSR搭建误差补偿系统 首先弄明白什么是LFSR 线性反馈移位寄存器(LFSR)是内测试电路中最基本的标准模块结构,既用作伪随机测试码产生器,也作为压缩测试结果数据的特征分析器. 一个n阶的LF ...

  8. 解决AndroidStudio引入Jar出现Unable to resolve dependency for ':app@debug/compileClasspath

    今天在做Android项目时遇到一个万脸懵逼的错误,表示没看懂,百度一圈说是被墙啥的 不过最终还是被朕给找到了答案,解决办法如下 点击AndroidStudio左上角 File -> setti ...

  9. Windows Server 2008 R2 /2012 修改密码策略

    今天建了域环境,在添加新用户的时候,发现用简单的密码时域安全策略提示密码复杂度不够,于是我就想在域安全策略里面把密码复杂度降低一点. 问题:    在“管理工具 >> 本地安全策略 > ...

  10. Log4j配置发邮件功能

    # 发送日志到指定邮件log4j.appender.mail=org.apache.log4j.net.SMTPAppenderlog4j.appender.mail.Threshold=DEBUGl ...