@DingCao-HJJ
2015-08-30T05:53:03.000000Z
字数 1059
阅读 1495
编程工具/环境
vim
请参考vim_百度百科
:
然后会在窗口最下面的一行出现一个命令窗口,可以调用一些全局的命令,例如替换、保存、退出、查找。Ctrl+v
即可进入,用以选择区块的文本进行编辑、复制、删除等操作i
快捷键进入,可以直接插入文本。可视模式:
快捷键 | 操作 |
---|---|
i(nsert) | 进入插入模式,在当前光标处(前)插入 |
I(nsert at the line begining) | 进入插入模式, 在行首插入 |
a(fter insert) | 进入插入模式,在当前光标处(后)插入 |
a(fter the line insert) | 进入插入模式,在行末插入 |
位置跳转 | |
h | 左移一格 |
l | 右移一格 |
j | 下一行 |
k | 下一行 |
单词跳转 | |
w | 下一个单词 |
b(egin) | 上一个单词/当前单词首 |
e(nd) | 单词末尾 |
行跳转 | |
0 | 行首 |
$ | 行末 |
^ | 行首字母 |
( | 上一句 |
) | 下一句 |
滚屏 | |
Ctrl-b | 上一屏 |
Ctrl-f | 下一屏 |
Ctrl-u(p) | 上班屏幕 |
Ctrl-d(own) | 下半屏 |
指定位置 | |
(number+)G(o) | 默认去文件末,加上行号跳转到特定行 |
gg | 文件首 |
以上就是一些比较常用的命令,以后还会陆续添加。如果需要查找更多的命令,请自行查找vim文档。
.vimrc
" sets to a dark scheme."
colorscheme evening
" shows the line numbers"
set nu
set tabstop=2
set nobackup
set showmatch
" highlights the current line and column."
set cursorline
set cursorcolumn
set ruler " adds underline"
" highlights the code limitting column."
set colorcolumn=80,120
set autoindent
" auto shows the invisible tabs and trials"
set listchars=tab:>-,trail:-
set list
" makes the space trials red and visible"
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/
" trims spaces trials when saves the buffer"
autocmd BufWrite * execute ":s/\s*$//"