首页 \ 问答 \ Vim:有没有一个命令来切换窗口(Vim: is there a command to switch windows)

Vim:有没有一个命令来切换窗口(Vim: is there a command to switch windows)

我需要一个:命令来切换窗口,因为我在一个函数中使用它。 所以<CW>W不会这样做。


I need a : command to switch windows because I'm using it in a function. so <C-W>W won't do.


原文:https://stackoverflow.com/questions/8822237
更新时间:2022-12-26 09:12

最满意答案

我认为第二种方法是反模式,应该避免,它类似于臭名昭着的SimpleDateFormat类(它看起来像无状态和线程安全,但事实并非如此)。

关于其他方法,如果你真的有很多私有方法,最好使用第一种方法,否则你可以使用第三种方法,它对我来说看起来不太难看。

另请注意,使用第一种方法“按原样”涉及比第三种更多的耦合。 在第三种情况下,您可以通过注入预配置的验证器实例来将验证器的客户端与其实现分离,而在第一种情况下,您需要引入工厂以实现相同的效果。


I think the 2nd approach is an antipattern and should be avoided, it resembles the infamous SimpleDateFormat class (it looks like stateless and thread safe, but it's not).

Regarding the other approaches, if you really have many private methods it would be better to use the 1st approach, otherwise you can use the 3rd approach, it doesn't look too ugly for me.

Also note that using the 1st approach "as is" involves more coupling than the 3rd one. In the 3rd case you can decouple clients of validator from its implementation by injecting a preconfigured instance of validator, whereas in the 1st case you need to introduce a factory to achieve the same effect.

相关问答

更多
  • 我认为第二种方法是反模式,应该避免,它类似于臭名昭着的SimpleDateFormat类(它看起来像无状态和线程安全,但事实并非如此)。 关于其他方法,如果你真的有很多私有方法,最好使用第一种方法,否则你可以使用第三种方法,它对我来说看起来不太难看。 另请注意,使用第一种方法“按原样”涉及比第三种更多的耦合。 在第三种情况下,您可以通过注入预配置的验证器实例来将验证器的客户端与其实现分离,而在第一种情况下,您需要引入工厂以实现相同的效果。 I think the 2nd approach is an ant ...
  • 订单是: 成员变量初始化为层次结构中所有类的默认值 然后从最传导的类开始: 对于最推导类型执行变量初始化器 构造函数链构造出要调用哪个基类构造函数 基类被初始化(所有这一切递归:) 该类中的链中的构造函数体被执行(注意,如果它们与Foo() : this(...)链接,则可以有多个构造函数Foo() : this(...)等 请注意,在Java中,基类在运行变量初始化程序之前被初始化。 如果你有任何代码移植,这是一个重要的不同,要知道:) 如果您有兴趣,我有一个页面提供更多的细节 。 The order i ...
  • 我有一些应该是Serializable的类,因此需要一个空参数构造函数。 这不是强制性的。 如果一个类或它的超类是可序列化的,那么在您要将该类扩展到由于构造函数链接而需要的其他类之前,不必在该类中定义无参数构造函数。 I have some classes that should be Serializable, thus require an empty argument constructor. It is not mandatory . If a class or its super-class is ...
  • 在parent::__construct($options)调用init()方法。 尝试这个: public function __construct($options = null, $formState = self::CREATE) { $this->_formState = $formState; parent::__construct($options); $this->setAction('/user/' . $this->_formState); } 我切换了构造函 ...
  • 您可以使用ViewModel代码静态访问IsInDesignMode属性 (bool)DependencyPropertyDescriptor.FromProperty( DesignerProperties.IsInDesignModeProperty, typeof(DependencyObject) ).M ...
  • §12.6.2/ 6说 如果mem-initializer-id指定构造函数的类,它应该是唯一的mem-initializer ...一旦目标构造函数返回,就会执行委托构造函数的主体。 所以没有冲突,因为在委托构造函数之前你不能初始化任何东西。 委托构造函数只需调用该构造函数,运行目标构造函数的初始化列表,运行目标构造函数,然后运行主构造函数。 §12.6.2/6 says If a mem-initializer-id designates the constructor’s class, it shal ...
  • 在这种情况下,“调用”是指您调用它时,“执行”是指代码体实际运行时 。 在您调用它和代码运行的时间之间,字段被初始化。 所以,你调用它,然后初始化发生, 然后执行。 尝试这个: class Example { static int report() { System.out.println("initialize"); return 0; } int x = report(); // <- [Step 2] Initialization Example () { ...
  • 如果您使用Scala 2.9,您可以安排以下内容: class A { println("Hi") } class B extends A with DelayedInit { private[this] var count = 0 println("Hey") def delayedInit(x: => Unit) { x count += 1 if (count==2) { println("There") } } } class C extends B { ...
  • 这段代码: t = T(100); 是等价的: T _temp(100); t = _temp; 这有助于想象出一些T被摧毁的原因。 这不是你的,它是临时的T(100) 。 这就是为什么你看到两个“毁灭”的印刷品......一个是临时的,一个是A::t 。 要避免虚假破坏,请使用初始化列表: A::A() : t(100) { } This code: t = T(100); is, equivalently: T _temp(100); t = _temp; Which helps visua ...
  • 如果您明确定义Test2() {}则会发生同样的事情。 这种初始化形式称为聚合初始化,只有在没有用户定义的构造函数时才适用。 它不会通过任何构造函数,而是直接从支撑的初始化列表中初始化成员。 所以没有什么可以默认的; 你必须明确定义你想要的任何构造函数。 实际上我觉得有点惊讶明确默认的构造函数不会禁用聚合初始化。 根据@juachopanza,C ++ 11的具体措辞是聚合初始化取决于没有定义 ,允许专门用于声明。 The same thing happens if you explicitly defin ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。