首頁 » VIM 手札
2012/03/16

vim : vimrc 好資源

https://groups.google.com/forum/#!topic/vim-taiwan/2kZypaK_VXY


繼續閱讀
2008/08/21

Vim 訣竅:使用view ports

Ref: http://www.linux.com/articles/54157

Vim tips: Using viewports
Vim 訣竅:使用view ports

By Joe 'Zonker' Brockmeier on May 10, 2006 (8:00:00 AM)

試譯者:jiing

A lot of folks use Vim, but many exploit only a small percentage of the editor's features. Sure, you might know how to do the basics in Vim, but what about using more advanced features such as folding, split windows, and marks? With a little practice, you can really boost your productivity with Vim.
In this and future articles, I'm going to cover Vim features that you may not be familiar with if you're a casual Vim user. If you're confident using Vim to edit configuration files or make short edits in text files, but maybe not too comfortable with undertaking major writing or coding in Vim, then these articles should be for you.


有許多人使用vim,不過許多人只探索了編輯器特性的一丁點。當然了,你可能知道Vim的基本用法,不過關於更進階的特性,例如摺疊(folding)、分割(split)視窗和標示(marks)呢?用一個小小的練習,你可以用Vim真正地提升你的生產力。

在本篇和未來的文章中,我將涵括Vim中你可能不熟悉的特性(如果你是個隨性的Vim使用者)。如果你有信心用Vim來編輯組態設定檔或是使用小小的文字編輯,但可能用Vim來寫程式碼或是進行大量的書寫時不是太舒服的話,那麼這些文章應該是為你而寫的。

Splitting Vim's viewport
分割Vim的視埠(viewport)


A really useful feature in Vim is the ability to split the viewable area between one or more files, or just to split the window to view two bits of the same file more easily. The Vim documentation refers to this as a viewport or window, interchangeably.

在Vim中一個真的很有用的特性是去將一或多個檔案分割成數個可視的區域的能力,或只是分割視窗更容易地看同個檔案中的二個位元(2 bits)。Vim文件中將這個稱作viewport或window,二個詞是可被交換使用的。

You may already be familiar with this feature if you've ever used Vim's help feature by using :help topic or pressing the F1 key. When you enter help, Vim splits the viewport and opens the help documentation in the top viewport, leaving your document open in the bottom viewport.

如果你曾經使用Vim的輔助特性(藉由:help topic 或是按下 F1 鍵),你可能已經熟悉這項特性。當你進入輔助說明(help)時,Vim分割viewport,並且開啟輔助說明文件在上面的viewport,而讓你的文字開啟在底下的viewport。

Vim viewport keybinding quick reference
Vim viewport的鍵盤對應的快速參考

:sp will split the Vim window horizontally. Can be written out entirely as :split .

:sp 將View視窗水平分割。可以完整寫出成:split

:vsp will split the Vim window vertically. Can be written out as :vsplit .

:vsp 會將視窗垂直分割。能被寫成 :vsplit

Ctrl-w Ctrl-w moves between Vim viewports.

Ctrl-w Ctrl-w 會在View的viewports間移動

Ctrl-w j moves one viewport down.

Ctrl-w j 會把一個viewport 往下移

Ctrl-w k moves one viewport up.

Ctrl-w k 會把一個viewport 往上移


Ctrl-w h moves one viewport to the left.

Ctrl-w h 將一個viewport往左移

Ctrl-w l moves one viewport to the right.

Ctrl-w l 將一個viewport往右移

Ctrl-w = tells Vim to resize viewports to be of equal size.

Ctrl-w = 告訴Vim 去將viewports的尺寸變成相同的大小

Ctrl-w - reduce active viewport by one line.

Ctrl-w - 將作用中的viewport 減少一行

Ctrl-w + increase active viewport by one line.

Ctrl-w + 將作用中的viewport 增加一行

Ctrl-w q will close the active window.

Ctrl-w q 會關閉作用中的視窗

Ctrl-w r will rotate windows to the right.

Ctrl-w r 會將視窗轉到右方

Ctrl-w R will rotate windows to the left.

Ctrl-w R 會將視窗轉到左方
繼續閱讀
1