我最近添加了优秀的fholgado/minibufexpl.vim插件,以便随时显示所有现有缓冲区。
我现在的问题是,我严重依赖CTRL+W W/H/J/K/L
在分割之间切换,我一直想念我在插件的分裂中。
是否可以编写一些Vim代码来跳过或禁用导航到某个分割?
答案 0 :(得分:1)
以下代码是否符合您的期望?它重新映射一些窗口焦点命令(#import "LEDebugScene.h"
#import "LEPhysicsCategories.h"
@implementation LEDebugScene
SKNode* rootNode;
SKFieldNode* fieldNode;
SKShapeNode* targetPosShape;
- (void) didMoveToView:(SKView *)view {
self.backgroundColor = [SKColor blackColor];
// This will be the desired field's position (in parent space)
CGPoint fieldPosition = CGPointMake(-self.size.width * 0.25, -self.size.height * 0.25);
// 1. Set up a root node to move around to translate the "world"
rootNode = [SKNode node];
rootNode.position = CGPointMake(self.size.width/2.0, self.size.height/2.0);
[self addChild:rootNode];
// 2. Mark the target position of the field with a circle
targetPosShape = [SKShapeNode shapeNodeWithCircleOfRadius:20.0];
targetPosShape.fillColor = [UIColor yellowColor];
targetPosShape.strokeColor = [UIColor brownColor];
[rootNode addChild:targetPosShape];
targetPosShape.position = fieldPosition;
// 3. Mark the initially visible portion of the scene
SKShapeNode* initialViewportShape = [SKShapeNode shapeNodeWithRect: CGRectMake(-self.size.width/2.0,
-self.size.height/2.0,
self.size.width,
self.size.height)];
initialViewportShape.fillColor = [UIColor clearColor];
initialViewportShape.strokeColor = [UIColor redColor];
initialViewportShape.lineWidth = 3.0;
[rootNode addChild:initialViewportShape];
// 4. Add an emitter at the center of the initial viewport
NSString* emitterPath = [[NSBundle mainBundle] pathForResource:@"DebugEmitter" ofType:@"sks"];
SKEmitterNode* emitterNode = [NSKeyedUnarchiver unarchiveObjectWithFile:emitterPath];
emitterNode.fieldBitMask = LECategoryDust;
emitterNode.particlePositionRange = CGVectorMake(self.size.width, self.size.height);
emitterNode.position = CGPointZero;
[rootNode addChild:emitterNode];
// 5. Create a field at the desired position
fieldNode = [SKFieldNode radialGravityField];
fieldNode.userData = [NSMutableDictionary dictionary];
fieldNode.categoryBitMask = LECategoryDust;
fieldNode.falloff = 1.8;
fieldNode.minimumRadius = 20.0;
fieldNode.strength = 2.5;
fieldNode.position = fieldPosition;
[rootNode addChild:fieldNode];
}
- (void) touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
//Get the touch movement vector
UITouch* touch = [touches anyObject];
CGPoint prevLoc = [touch previousLocationInNode:self];
CGPoint location = [touch locationInNode:self];
CGVector delta = CGVectorMake(location.x - prevLoc.x, location.y - prevLoc.y);
//Translate the world by repositioning the root node
rootNode.position = CGPointMake(rootNode.position.x + delta.dx, rootNode.position.y + delta.dy);
CGPoint rootScenePos = [self convertPoint:rootNode.position fromNode:rootNode.parent];
CGPoint fieldScenePos = [self convertPoint:fieldNode.position fromNode:fieldNode.parent];
CGPoint targetShapeScenePos = [self convertPoint:targetPosShape.position fromNode:targetPosShape.parent];
NSLog(@"");
NSLog(@"Root scene pos: %.0fx, %.0fy | parent pos: %.0fx, %.0fy",
rootScenePos.x, rootScenePos.y, rootNode.position.x, rootNode.position.y);
NSLog(@"Field scene pos: %.0fx, %.0fy | parent pos: %.0fx, %.0fy",
fieldScenePos.x, fieldScenePos.y, fieldNode.position.x, fieldNode.position.y);
NSLog(@"Target scene pos: %.0fx, %.0fy | parent pos: %.0fx, %.0fy",
targetShapeScenePos.x, targetShapeScenePos.y, targetPosShape.position.x, targetPosShape.position.y);
}
@end
),以便它跳过BDE窗口(如果它已打开)。
<C-W>l/h/j/k/w
我不完全确定你在问什么。当你说:
我非常依赖
" Remapping the following <ctrl-w>... commands: for wincmd in ['l', 'h', 'j', 'k', 'w'] exe 'noremap <silent> <c-w>'.wincmd.' :WincmdSkipMBE '.wincmd.'<cr>' endfor command! -nargs=1 WincmdSkipMBE call WincmdSkipMBE(<f-args>) function! WincmdSkipMBE(cmd) let l:first = winnr() while 1 let l:last = winnr() exe 'wincmd '.a:cmd let l:new = winnr() if l:last == l:new | exe l:first.'wincmd w' | break elseif bufname('%') != '-MiniBufExplorer-' | break endif endw endf
来切换分割
,你的意思是CTRL+W W/H/J/K/L
(小写)吗?