Cursor movement
h - move left
j - move down
k - move up
l - move right
w - jump by start of words (punctuation considered words)
W - jump by words (spaces separate words)
e - jump to end of words (punctuation considered words)
E - jump to end of words (no punctuation)
b - jump backward by words (punctuation considered words)
B - jump backward by words (no punctuation)
0 - (zero) start of line
^ - first non-blank character of line
$ - end of line
G - Go To command (prefix with number - 5G goes to line 5)
Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.
Insert Mode - Inserting/Appending? text
i - start insert mode at cursor
I - insert at the beginning of the line
a - append after the cursor
A - append at the end of the line
o - open (append) blank line below current line (no need to press return)
O - open blank line above current line
ea - append at end of word
Esc - exit insert mode
Editing
r - replace a single character (does not use insert mode)
J - join line below to the current one
cc - change (replace) an entire line
cw - change (replace) to the end of word
c$ - change (replace) to the end of line
s - delete character at cursor and subsitute text
S - delete line at cursor and substitute text (same as cc)
xp - transpose two letters (delete and paste, technically)
u - undo
. - repeat last command
Marking text (visual mode)
v - start visual mode, mark lines, then do command (such as y-yank)
V - start Linewise visual mode
o - move to other end of marked area
Ctrl+v - start visual block mode
O - move to Other corner of block
aw - mark a word
ab - a () block (with braces)
aB - a {} block (with brackets)
ib - inner () block
iB - inner {} block
Esc - exit visual mode
Visual commands
> - shift right
< - shift left
y - yank (copy) marked text
d - delete marked text
~ - switch case
Cut and Paste
yy - yank (copy) a line
2yy - yank 2 lines
yw - yank word
y$ - yank to end of line
p - put (paste) the clipboard after cursor
P - put (paste) before cursor
dd - delete (cut) a line
dw - delete (cut) the current word
x - delete (cut) current character
Exiting
:w - write (save) the file, but don't exit
:wq - write (save) and quit
:q - quit (fails if anything has changed)
:q! - quit and throw away changes
Search/Replace?
/pattern - search for pattern
?pattern - search backward for pattern
n - repeat search in same direction
N - repeat search in opposite direction
:%s/old/new/g - replace all old with new throughout file
:%s/old/new/gc - replace all old with new throughout file with confirmations
Working with multiple files
:e filename - Edit a file in a new buffer
:bnext (or :bn) - go to next buffer
:bprev (of :bp) - go to previous buffer
:bd - delete a buffer (close a file)
:sp filename - Open a file in a new buffer and split window
ctrl+ws - Split windows
ctrl+ww - switch between windows
ctrl+wq - Quit a window
ctrl+wv - Split windows vertically
vim -p file1 file2 file3 同时用3个tab打开3个文件
:tabnew filename - Edit a file in a new tab
:tabs - show tabs information
:tabn - go to the next tab
:tabp - go to the previous tab
:tabfirst - go to the first tab
:tablast - go to the last tab
Some useful config(written in ~/.vimrc)
set expandtab "输入tab时用space来取代
set shiftwidth=4 "输入tab等于输入4个space
set smarttab "用一次退格键就可以删除由tab产生的4个space
set autoindent "自动缩进
"({[<的自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>
function ClosePair(char)
if getline('.')[col('.')-1] == a:char
return "\<Right>"
else
return a:char
endif
endf
"智能提示
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
"配色
colorscheme default "(具体的名字可以在/usr/share/vim/colors或~/.vim/colors中找)
分享到:
相关推荐
VIM快捷键 VIM快捷键 VIM插件 VIM快捷键 VIM插件
英文版的vim快捷键整理。 一张图片上总结了vim的快捷键。
vim常用快捷键和插件设置 包括vim中tab操作 vim中使用cscope nerdtree等。 其中一些好用但不常用的快捷键可以明显提高工作效率
idea快捷键设置
vi vim很全的快捷键操作 vi/vim 命令繁多,专门介绍vi的书可以写到四五百页,但本文档主要是介绍常用和实用的一些vi操作。 另外,对vi配置文件.vimrc的适当配置可以使vi更易用更强大,所以随本文档也提供一份vi配置...
配置 vim快捷键,方便vim进行开放,文本处理,删除、添加、替换、粘贴,彻底告别鼠标
NULL 博文链接:https://yizhilong28.iteye.com/blog/967746
" 将F10设置为开关NERDTree的快捷键 map <f10> :NERDTreeToggle " 修改树的显示图标 " let g:NERDTreeDirArrowExpandable = '+' " let g:NERDTreeDirArrowCollapsible = '-' " 窗口位置 let g:NERDTreeWinPos='left'...
vim下常用快捷键使用技巧,基本配置设置,gvim设置,编辑技巧和配置文件设置
vimrc, gvimrc 是我个人使用的 vim 配置文件, 主要是绑定了一些快捷键, 比如打开新的 tab, 或是打开函数列表 cp vimrc ~/.vimrc cp gvimrc ~/.gvimrc taglist.vim 是用于在 vim 中显示函数列表的插件 mkdir -p ~/....
vim的快捷键和常用插件都已配好。。 支持cscope ctag,扩展工具栏,支持各类代码跳转查看。可以完全替代sourceinsight 支持自动编译输出窗口 支持代码符号定义快速预览窗口,需要生成完cscope数据库,按Fx键启用...
我的vim配置主要有以下优点: 1 按F5可以直接编译并执行C C++ java代码以及执行shell脚本 按“F8”可进行C C++代码的调试 2 自动插入文件头 新建C C++源文件时自动插入表头:包括文件名 作者 联系方式 建立时间等 ...
vi(vim)是上Linux非常常用的编辑器,很多Linux发行版都默认安装了vi(vim)。...3)低行模式:可以保存文件、退出vi、设置vi、查找等功能(低行模式也可以看作是命令模式里的)。 下面给大家介绍vim快捷
各个插件配置设置单独配置: ls bundle/.configs/ : asyncrun.vim_conf.vim EasyMotion_conf.vim lookupfile_conf.vim supertab_conf.vim vim-markdown-toc_conf.vim bufexplorer_conf.vim eclim_conf.vim maximizer...
通过个性化配置和插件系统,用户可以定制快捷键、颜色方案等。Vim 还可以作为图形化编辑器,在不同操作系统上运行,并与版本控制系统集成。总之,Vim 是一款高效、灵活的编辑器,为用户提供优秀的编辑体验。 0x00 ...
一、插件介绍: auto-pairs是vim的一个极小的插件。它对于用vim来编写程序,提供了极大的便。我ubuntu16中,用vim编写c和c++程序,安装了此插件,极...所以你可以在图形界面中,用快捷键ctr + h来显示隐藏的文件夹。
里面的vim插件已经包含了taglist,omnicppcomplete等插件,无需再下载,详细的配置参考.vimrc,注意快捷键使用即可。有什么不喜欢和bug的地方,自行调整.vimrc。ctags命令工具还是要下载安装的。 1. 安装ctags和...
vim的完美配置,左边有文件列表,高亮显示,各种快捷键方便调试
掌握: Vim文本编辑器界面快捷键 【能力目标】 会初步使用Vim文本编辑器 【思政目标】 在克服学习困难中培养学生良好的意志品质 ,树立学习自信心,提升自学能力。 vi(visual interface)是Linux和UNIX中功能最为...
vim函数自动补齐,追踪代码,F2函数列表,F3文件列表等等快捷键,可看.vimrc参考,记得下载sudo apt-install cscope sudo apt-install ctags,要不然会报错。用法:解压后直接把.vimrc文件 和.vim文件夹直接放在家...