简体   繁体   English

如何在vim中控制新缓冲区的位置

[英]how to control the position of new buffer in vim

I write a vim plugin to get the weather info in python, I use print to print weather info, all core code are wrapped in a function Weather() . 我编写了一个vim插件来获取python中的天气信息,我使用print来打印天气信息,所有核心代码都包装在一个Weather()函数中。 when I call this function in vim, the weather info will be showed in a new buffer under current buffer, can I control this new buffer in the left of current buffer or any other position. 当我在vim中调用此函数时,天气信息将显示在当前缓冲区下的新缓冲区中,我可以将这个新缓冲区控制在当前缓冲区的左侧还是任何其他位置。

If you plan to publish this plugin, you should honor the user's preferences (eg the 'splitbelow' setting), and offer a configuration variable to influence the window placement. 如果打算发布此插件,则应'splitbelow'用户的首选项(例如, 'splitbelow'设置),并提供一个配置变量来影响窗口的放置。

Generally, there are prefix commands that influence the window placement: :vertical , :leftabove , :rightbelow , :topleft , :botright . 通常,有一些前缀命令会影响窗口的放置:: :vertical:leftabove:rightbelow:topleft:botright They are used like this: 它们的用法如下:

:topleft new

Sometimes, it may also be necessary to first go to a particular window, :execute winnr . 'wincmd w' 有时,也有必要首先转到特定的窗口:execute winnr . 'wincmd w' :execute winnr . 'wincmd w' can do this. :execute winnr . 'wincmd w'可以做到这一点。 And finally, many commands that split a new window can be passed an initial window height. 最后,许多拆分新窗口的命令都可以传递初始窗口高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM