Skip to content

Commit

Permalink
[iOS] Adding a system-wide vimrc file
Browse files Browse the repository at this point in the history
For now, Esc is mapped to backslash
  • Loading branch information
Romain Goyet committed Nov 25, 2011
1 parent 68bd230 commit 886bfb0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
19 changes: 10 additions & 9 deletions Vim.xcodeproj/project.pbxproj
Expand Up @@ -62,7 +62,8 @@
7A71941914228FA500B62000 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A71941814228FA500B62000 /* UIKit.framework */; };
7A71941B14228FA500B62000 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A71941A14228FA500B62000 /* Foundation.framework */; };
7A71941D14228FA500B62000 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A71941C14228FA500B62000 /* CoreGraphics.framework */; };
7A7B1FA7142FBE3100A537BD /* runtime in Resources */ = {isa = PBXBuildFile; fileRef = 7A7B1FA6142FBE2E00A537BD /* runtime */; };
7A8CAA27147FAC1600908FBE /* runtime in Resources */ = {isa = PBXBuildFile; fileRef = 7A7B1FA6142FBE2E00A537BD /* runtime */; };
7A8CAA28147FAC2E00908FBE /* vimrc in Resources */ = {isa = PBXBuildFile; fileRef = 7A8CAA1D147FA3D100908FBE /* vimrc */; };
7A9DD4E5142CC10600B8F464 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A9DD4E4142CC10600B8F464 /* CoreText.framework */; };
/* End PBXBuildFile section */

Expand All @@ -75,6 +76,7 @@
7A71941A14228FA500B62000 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
7A71941C14228FA500B62000 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
7A7B1FA6142FBE2E00A537BD /* runtime */ = {isa = PBXFileReference; lastKnownFileType = folder; path = runtime; sourceTree = SOURCE_ROOT; };
7A8CAA1D147FA3D100908FBE /* vimrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = vimrc; sourceTree = "<group>"; };
7A992B5C1422932F00075221 /* arabic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = arabic.c; sourceTree = "<group>"; };
7A992B5D1422932F00075221 /* arabic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = arabic.h; sourceTree = "<group>"; };
7A992B5E1422932F00075221 /* ascii.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ascii.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -552,7 +554,6 @@
7A992DBF1422932F00075221 /* uninstal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = uninstal.c; sourceTree = "<group>"; };
7A992DC01422932F00075221 /* version.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
7A992DC11422932F00075221 /* version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
7A992DC21422932F00075221 /* vim */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = vim; sourceTree = "<group>"; };
7A992DC31422932F00075221 /* vim.def */ = {isa = PBXFileReference; lastKnownFileType = text; path = vim.def; sourceTree = "<group>"; };
7A992DC41422932F00075221 /* vim.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vim.h; sourceTree = "<group>"; };
7A992DC51422932F00075221 /* vim.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = vim.ico; sourceTree = "<group>"; };
Expand Down Expand Up @@ -672,8 +673,7 @@
7A7B1FA6142FBE2E00A537BD /* runtime */,
7A992B561422932F00075221 /* src */,
);
name = Vim;
path = VIm;
path = Vim;
sourceTree = "<group>";
};
7A992B561422932F00075221 /* src */ = {
Expand Down Expand Up @@ -847,7 +847,6 @@
7A992DBF1422932F00075221 /* uninstal.c */,
7A992DC01422932F00075221 /* version.c */,
7A992DC11422932F00075221 /* version.h */,
7A992DC21422932F00075221 /* vim */,
7A992DC31422932F00075221 /* vim.def */,
7A992DC41422932F00075221 /* vim.h */,
7A992DC51422932F00075221 /* vim.ico */,
Expand Down Expand Up @@ -1299,6 +1298,7 @@
7AE20BB1142B8D7E00848B40 /* os_ios_rsrc */ = {
isa = PBXGroup;
children = (
7A8CAA1D147FA3D100908FBE /* vimrc */,
7AE20BB2142B8D7E00848B40 /* ios_info.plist */,
7AE20BB3142B8D7E00848B40 /* ios_prefix.pch */,
);
Expand All @@ -1321,7 +1321,7 @@
dependencies = (
);
name = Vim;
productName = VIm;
productName = Vim;
productReference = 7A71941414228FA500B62000 /* Vim.app */;
productType = "com.apple.product-type.application";
};
Expand All @@ -1333,7 +1333,7 @@
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = 7A71940E14228FA500B62000 /* Build configuration list for PBXProject "VIm" */;
buildConfigurationList = 7A71940E14228FA500B62000 /* Build configuration list for PBXProject "Vim" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
Expand All @@ -1355,7 +1355,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7A7B1FA7142FBE3100A537BD /* runtime in Resources */,
7A8CAA27147FAC1600908FBE /* runtime in Resources */,
7A8CAA28147FAC2E00908FBE /* vimrc in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1503,7 +1504,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
7A71940E14228FA500B62000 /* Build configuration list for PBXProject "VIm" */ = {
7A71940E14228FA500B62000 /* Build configuration list for PBXProject "Vim" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7A71943814228FA500B62000 /* Debug */,
Expand Down
20 changes: 3 additions & 17 deletions src/gui_ios.m
Expand Up @@ -43,25 +43,11 @@
#pragma mark VImTextView

@interface VImTextView : UIView {
UIView * _inputAcccessoryView;
}
@property (nonatomic, retain) UIView * inputAccessoryView;
@end

@implementation VImTextView
@synthesize inputAccessoryView = _inputAcccessoryView;
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
UIButton * escButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[escButton addTarget:self action:@selector(sendSpecialKey:) forControlEvents:UIControlEventTouchUpInside];
_inputAcccessoryView = [escButton retain];
}
return self;
}

- (void)dealloc {
[_inputAcccessoryView release];
if (gui_ios.layer) {
CGLayerRelease(gui_ios.layer);
gui_ios.layer = NULL;
Expand Down Expand Up @@ -96,8 +82,6 @@ - (void)layoutSubviews {
}
@end



#pragma mark -
#pragma VImViewController

Expand Down Expand Up @@ -242,7 +226,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
}

- (void)_VImMain {
vim_setenv((char_u *)"VIMRUNTIME", (char_u *)[[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"runtime"] UTF8String]);
NSString * vimPath = [[NSBundle mainBundle] resourcePath];
vim_setenv((char_u *)"VIM", (char_u *)[vimPath UTF8String]);
vim_setenv((char_u *)"VIMRUNTIME", (char_u *)[[vimPath stringByAppendingPathComponent:@"runtime"] UTF8String]);

NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
if (paths.count > 0) {
Expand Down
4 changes: 4 additions & 0 deletions src/os_ios_rsrc/vimrc
@@ -0,0 +1,4 @@
" System vimrc file for Vim on iOS

set nocompatible
imap \ <Esc>

0 comments on commit 886bfb0

Please sign in to comment.