vim多窗口

打开窗口

ex command vi command Description
:[n]split [++opt] [+cmd] [file] ^Ws ^WS WS Split the current window into two from side to side, placing
the cursor in the new window. The optional file argument
places that file in the newly created window. The windows
are created as equal in size as possible, determined by free
window space.
:[n]new [++opt] [+cmd] ^Wn WN Same as :split, but start the new window editing an empty
file. Note that the buffer will have no name until one is
assigned.
:[n]sview [++opt] [+cmd] [file] Read-only version of :split.
:[n]sfind [++opt] [+cmd] [file] Split window and open file (if specified) in the new window.
Look for file in the path.
:[n]vsplit [++opt] [+cmd] [file] ^Wv WV Split current window into two from top to bottom and open
file (if specified) in the new window.
:[n]vnew [++opt] [+cmd] Vertical version of :new.
:split #Split window.
:vsplit #Split window vertically.
:split otherfile #Split window and open aother file.
:[n]split [++opt] [+cmd] [file] 
:15split ++fileformat=unix otherfile #Set the new window to be 15 lines tall; open file with unix file format.
:[n]new [++opt] [+cmd] [file] #In addition to creating the new window, the WinLeave, WinEnter, BufLeave, and BufEnter autocommands execute.
:vnew
:sview filename #Splits the screen horizontally to open a new window and sets the readonly for that buffer. :sview requires the filename argument.
:sfind [++opt] [+cmd] filename #Works like :split, but looks for the filename in the path. If Vim does not find the file, it doesn’t split the window.
:topleft [cmd] #tells Vim to execute cmd(split, new ...) and display a new window with the cursor at the top left if cmd opens a new file

在窗口间移动

Command Description
^W<DOWN>
WJ
^Wj
Move to the next window down.
Note that this command does not cycle through the windows; it simply
moves down to the next window below the current window. If the cursor is
in a window at the bottom of the screen, this command has no effect. Also,
this command bypasses adjacent windows on its “way down”; for example,
if there is a window to the right of the current window, the command does
not jump across to the adjacent window. (Use WW to cycle
through windows.)
^W<UP>
WK
^Wk
Move to the next window up. This is the opposite-direction counterpart to the ^W j command.
^W<LEFT>
WH
Move to the window to the left of the current window.
^Wh
^W<BS>
^W<RIGHT>
WL
^Wl
Move to the window to the right of the current window.
^Ww
WW
Move to the next window below or to the right. Note that this command, unlike ^Wj , will cycle through all of the Vim windows. When the
lowermost window is reached, Vim restarts the cycle and moves to the top leftmost window.
^W Move to next window above or to the left. This is the upward counterpart to the ^W w command.
^Wt
WT
Move cursor to the top leftmost window.
^Wb
WB
Move cursor to the bottom rightmost window.
^Wp
WP
Move to the previous (last accessed) window.

移动窗口

Command Description
^Wr
WR
Rotate windows down or to the right.
^WR Rotate windows up or to the left.
^Wx
WX
Swap positions with the next window, or if issued with a count n, swap with nth next window.
^WK Move window to top of screen and use full width. The cursor stays with the moved window.
^WJ Move window to bottom of screen and use full width. The cursor stays with the moved window.
^WH Move window to left of screen and use full height. The cursor stays with the moved window.
^WL Move window to right of screen and use full height. The cursor stays with the moved window.
^WT Move window to new tab. The cursor stays with the moved window. If the current window is the only window in the current tab, no action is taken.

改变窗口大小

Command Description
^W= Resize all windows equally. The current window honors the settings of the winheight and winwidth options.
:resize -n
^W-
Decrease the current window size. The default amount is one line.
:resize +n
^W+
Increase the current window size. The default amount is one line.
:resize n
W_
^W_
Set the current window height. The default is to maximize window height (unless n is specified).
zn <ENTER> Set the current window height to n.
^W< Increase the current window width. The default amount is one column.
^W> Decrease the current window width. The default amount is one column.
:vertical resize n
^W
Set the current window width to n. The default is to make window as wide as possible.
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,445评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,889评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,047评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,760评论 1 276
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,745评论 5 367
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,638评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,011评论 3 398
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,669评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,923评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,655评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,740评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,406评论 4 320
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,995评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,961评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,197评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,023评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,483评论 2 342

推荐阅读更多精彩内容