how to edit text in multiple columns in vim

前端 未结 3 420
别那么骄傲
别那么骄傲 2021-01-30 11:06

How can I edit my code in Vim by displaying it in any number of columns?

My laptop and desktop monitors are widescreen (I suspect that is true of most monitors made in t

相关标签:
3条回答
  • 2021-01-30 11:52

    I think what you want to do is split windows...

    Type :Vexplore to split a window vertically.

    Then use Ctrl + W + arrowkey to navigate to another window. :Sexplore will enable you to split the window horizontally.

    To evenly space after resizing, you can type Ctrl + W + =

    0 讨论(0)
  • 2021-01-30 11:55

    Just press CTRL-W v and the file you are working on will be split into two separate independent columns. Repeat CTRL-W v as many times as you want.

    Set scrollbind: set scrollbind to columns that you want to scroll in sync.

    For example:

    vim afile         # Open a file
    ^w v              # split it
    gg                # go to top
    :set scrollbind   # bind this one
    ^w l              # go to the new split
    L                 # go to bottom of this split
    zt                # make it the top line
    :set scrollbind   # bind with this one
    

    Now, while you move on one column, the other one scrolls so as if the first column overflows the text to the second column.

    0 讨论(0)
  • 2021-01-30 12:04

    This is what I use: http://vim.wikia.com/wiki/View_text_file_in_two_columns.

    It's a little clunky... Sometimes the scroll synchronization gets offset or disconnected, forcing you to re-columnate the view (in cmd mode, CTRL+W,q to close a a col. window, & \vs to add one.).

    But it works great 90% of the time. I use it a lot.

    0 讨论(0)
提交回复
热议问题