Vim常用配置

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常用配置的更多相关文章
- Vim - 常用配置
基本配置 不用任何插件的情况下,先按如下配置: set nu syntax on set hlsearch set tabstop=4 set shiftwidth=4 set expandtab s ...
- vim常用配置 vimrc文件
自从接触vim,自己瞎鼓捣.vimrc也有一段时间了.收集记录一下好用的配置. 一.奇技淫巧 1.折叠代码 折叠代码常常用在代码块较长的情况下,比如一个文件里定义了很多个函数,或者注释.括号影响的阅读 ...
- Vim 常用配置及插件安装使用
在 Linux 中习惯了 vim 编辑器. 找了一些资料后自己尝试配置起来了.下面是一些过程. 首先需要知道 vim 相关的配置都是写在 ~/.vimrc 文件中.我下面的笔记只配置了一些我常用的功能 ...
- Vim常用配置(~/.vimrc)(转载)
原文地址:http://www.2cto.com/os/201309/246271.html " This must be first, beacuse it changes other o ...
- Vim常用命令及配置方案
Vim常用命令及配置方案 几句话 很久之前就接触到vim,初学那阵觉得vim很酷炫,但确实对新手不是很友好.我也就简单看了下基本操作就上手了,但又不是长期在vim下工作,这就导致了每一次重新使用v ...
- vim+vundle配置
Linux环境下写代码虽然没有IDE,但通过给vim配置几个插件也足够好用.一般常用的插件主要包括几类,查找文件,查找符号的定义或者声明(函数,变量等)以及自动补全功能.一般流程都是下载需要的工具,然 ...
- Vim 常用技巧:
Vim 常用技巧: 将回车由默认的8个空格改为4个空格: 命令:set sw=4 修改tab为4空格: 命令:set ts=4 设置每一级的缩进长度: 命令:set shiftwidth=4 设置文件 ...
- VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装
VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...
- Linux常用命令及vim的使用、vim常用插件(推荐)
看了3篇文章,很好 vim中的区域拷贝 剪切,粘贴: 正常模式,移动光标到剪切的区域开始处,按v,进入可视模式,然后选择区域.按x键,剪切.到指定位置按p粘贴. 撤销按u 恢复按ctrl-r 简明 ...
随机推荐
- UGUI之用ScrollRect做下拉刷新
在ScrollView下有中层次是scorllview->viewport->content scorllView对象下的ScrollRect组件是关键 ,scorllRect中指定其对 ...
- m个小朋友手拉手站成一个圈,从第k个小朋友开始报数,报到n的那个小朋友退到圈外,然后他的下一位重新报“1”。这样继续下去,直到只剩下一个小朋友,求解这个小朋友原来站什么地方。
约瑟夫环问题. package pack; import java.util.*; public class demo_2 { static int a[]; public static void m ...
- Python练习三
1.使用while和for循环分别打印字符串s=’asdfer’中每个元素. s = "asdfer" index = 0 while index < int(len(s)) ...
- [ZJOI2004]嗅探器
题目概要: 在无向图中寻找出所有的满足下面条件的点:割掉这个点之后,能够使得一开始给定的两个点a和b不连通,割掉的点不能是a或者b.(ZJOI2004) 数据范围约定结点个数N≤100边数M≤N*(N ...
- Java(常用排序算法)
冒泡排序 比较相邻的元素.如果第一个比第二个大,就交换他们两个,对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对.在这一点,最后的元素应该会是最大的数. 针对所有的元素重复以上的步骤,除了最 ...
- SQL Server初探
SQL Server的结构与Oracle不同,SQL Server里边可以包括很多的database,每个database有自己的表,用户等信息.比如目前有一个应用,应用的每个数据集都是一个datab ...
- 什么是真正的Java技术,本篇文章让你了解
“你学习一门技术的最佳时机是三年前,其次是现在.”这句话对于哪一种行业都很适用,如果你已经学习过Java,那么恭喜你你很有先见之明,如果你并不了解Java,这篇文章带你快速掌握Java的几个核心知识点 ...
- 游戏编程算法与技巧 Game Programming Algorithms and Techniques (Sanjay Madhav 著)
http://gamealgorithms.net 第1章 游戏编程概述 (已看) 第2章 2D图形 (已看) 第3章 游戏中的线性代数 (已看) 第4章 3D图形 (已看) 第5章 游戏输入 (已看 ...
- DevExpress 控件汉化代码和使用方法
DevExpress 第三方控件汉化的全部代码和使用方法 DevExpress.XtraEditors.Controls 此控件包中包含的控件最多,包括文本框,下拉列表,按钮,等等 ...
- LOJ 3089 「BJOI2019」奥术神杖——AC自动机DP+0/1分数规划
题目:https://loj.ac/problem/3089 没想到把根号之类的求对数变成算数平均值.写了个只能得15分的暴力. #include<cstdio> #include< ...