如何在vim中编辑多列文本
如何在 Vim 中编辑我的代码并在任意数量的列中显示它?
我的笔记本电脑和台式机显示器是宽屏的(我怀疑过去 5 年或 10 年制造的大多数显示器都是如此!)。当我全屏打开任何编辑器时,一半以上的屏幕完全是空的。我希望能够通过将屏幕的其余部分分成两列或三列来有效地使用屏幕的其余部分,这样我就可以在一个屏幕中看到更多的代码。
坦率地说,令我惊讶的是,除了 Microsoft Word 之外,我从未在任何编辑器中看到过此功能。
我找到了以下页面(http://vim.wikia.com/wiki/View_text_file_in_two_columns)这似乎做我想做的事,但我不太明白他们的建议。我确实设置了列和滚动绑定,但这似乎没有做任何事情。
我通常不使用 Vim,但如果我能够使用此功能,我会很乐意切换。我目前使用的是 Ubuntu 10.10 (gnome)。 Vim 的默认版本似乎是 7.2 (/usr/bin/vim.gnome)。
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 the last 5 or 10 years!). When I open any editor in full screen, more than half the screen is completely empty. I'd like to be able to effectively use the rest of the screen by splitting it into two or three columns so I can see all much more of my code in a single screen.
Frankly, I'm surprised that other than Microsoft Word, I have never seen this functionality in any editor.
I found the following page (http://vim.wikia.com/wiki/View_text_file_in_two_columns) which seems to do what I want, but I don't really understand what they are suggesting. I did set columns and scroll bind, but that didn't seem to do anything.
I don't normally use Vim, but if I can get access to this functionality, I'll switch happily. I am currently on Ubuntu 10.10 (gnome). The default version of Vim seems to be 7.2 (/usr/bin/vim.gnome).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需按
CTRL-W v
,您正在处理的文件就会被分成两个独立的列。根据需要重复CTRL-W v
多次。设置scrollbind:
将scrollbind
设置为您想要同步滚动的列。例如:
现在,当您在一列上移动时,另一列会滚动,就好像第一列将文本溢出到第二列。
Just press
CTRL-W v
and the file you are working on will be split into two separate independent columns. RepeatCTRL-W v
as many times as you want.Set scrollbind:
set scrollbind
to columns that you want to scroll in sync.For example:
Now, while you move on one column, the other one scrolls so as if the first column overflows the text to the second column.
我认为你想要做的是分割窗口...
输入
:Vexplore
垂直分割窗口。然后使用 Ctrl + W + arrowkey 导航到另一个窗口。
:Sexplore
将使您能够水平分割窗口。要在调整大小后均匀间隔,您可以键入 Ctrl + W + =
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 + =
这就是我使用的:http://vim.wikia.com/wiki/View_text_file_in_two_columns。
这有点笨重...有时滚动同步会偏移或断开,迫使您重新列视图(在cmd模式下,
CTRL+W
,q
关闭a 列窗口,& 添加一个。)但 90% 的情况下它都工作得很好。我经常使用它。
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.