首页 > 代码库 > vim-1-window,buffer and tab

vim-1-window,buffer and tab

Summary:
A buffer is the in-memory text of a file.

A window is a viewport on a buffer.

A tab page is a collection of windows.

窗口切换快捷键:

nnoremap <C-j> <C-w>j        向下切换

nnoremap <C-k> <C-w>k      向上切换

nnoremap <C-h> <C-w>h      向左切换

nnoremap <C-l> <C-w>l         向右切换

窗口生成快捷键:

nnoremap <C-v> <C-w>v         垂直分割,内容与原内容一致

nnoremap <C-n> <C-w>n         生成新的空窗口

:sp                                             上下分割

vim -o(-O)  file1 file2...               多窗口打开

:sp file1                                      :sp file1=:sp+:edit file1

Remark:不能按<C-s>,<C-s>组合键的特殊意义是暂停终端,<C-q>退出暂停

 较好的参考:

http://harttle.com/2015/11/17/vim-buffer.html

http://harttle.com/2015/11/14/vim-window.html

http://harttle.com/2015/11/12/vim-tabpage.html

vim-1-window,buffer and tab