Code Monkey home page Code Monkey logo

xvim's Introduction

[日本語版]

For Xcode 9 support, see XVim2

XVim Build Status Bountysource Bountysource

XVim is a Vim plugin for Xcode. The plugin intends to offer a compelling Vim experience without the need to give up any Xcode features.

Announcement

Support Xcode Versions

  • Xcode7 : Use before 809527b
  • Xcode8 : Use the latest master

INSTALL

Xcode 8 Users, Follow instructions in INSTALL_Xcode8.md first.

Download source code or clone the repo. Then,

  1. Confirm xcode-select points to your Xcode
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

If this doesn't show your Xcode application path, use xcode-select -s to set.

  1. make
$ make

If you see something like

XVim hasn't confirmed the compatibility with your Xcode, Version X.X
Do you want to compile XVim with support Xcode Version X.X at your own risk? 

Press y if you want to use XVim with your Xcode version (even it is not confirmed it works)

  1. Create .xvimrc as you need and restart your Xcode.

  2. Launch Xcode. You'll be asked if you load XVim. Press 'Yes' to it. If you press 'No' by mistake, close the Xcode and execute the following from a terminal

```
defaults delete  com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-X.X     (X.X is your Xcode version)
```

 Then relaunch Xcode.

Branches and Releases

XVim has several branches and releases. Usually you only need to download one of 'releases' and use it. Here is an explanation about each release and branch.

  • Releases(tags) : Releases are tags on master branch. All the code and documents on these tags are well arranged. Usual XVim user should use one of releases.
  • master : Most stable branch. Critical bug fixes and stable feature developed in 'develop' branch are merged into 'master'. If you find a critical bug in a release, try latest 'master' branch.
  • develop : New features and non critical bug fixes are merged into this branch. If you want experimental features use this branch.

Any other branches are temporary branches to develop features or bug fixes which will be merged into 'develop' branch after all. Any pull requests should be made to 'develop' branch.

Uninstall

$ make uninstall

Manual uninstall

Delete the following directory: $HOME/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/XVim.xcplugin

Feature list

See separate FeatureList.md

Bug reports

Unfortunately XVim sometimes crashes Xcode. We are working on eliminating all the bugs, but it's really hard work. It helps greatly when we have your bug reports, with the following information:

  • Crash information ( Xcode shows threads stack trace when crashes. Copy them. )
  • The operations you did to cause the crash ( series of key strokes or mouse clicks )
  • The text you were manipulating
  • Xcode version
  • XVim version ( Version number of the revision you built )

When it is hard to solve a problem with information above, take debug log according to the following movie please.

How to get XVim debug log

We appreciate if you write test case for the bug. Read "Write test" section in Documents/Developsers/PullRequest.md how to write test case. You do not need to update any source code but just write 7 items explained there in an issue you create.

Bountysource

XVim supports Bountysource. If you want to solve your issue sooner make bounty on your issue is one option. A contributer should work on it preferentially (not guaranteed though). To make bounty visit following link and go to "Issue" tab. Select your issue and make bounty on it.

https://www.bountysource.com/teams/xvim

Contributing Guidelines

See separate CONTRIBUTING.md

Donations

If you think the plugin is useful, please donate. There are two options you can take. Donate for Japan Earthquake and Tsunami Relief or back the project via BountySource. There is no rule that you cannot take both :) .

Japan Earthquake and Tsunami Relief

Since I do not intend make money from this project, I am directing donations to the people suffering from the damage of the 2011 Tohoku earthquake and tsunami in Japan.

Please donate directly through the Paypal donation site below, as this will put more money to good use by reducing the transfer fee.

https://www.paypal-donations.com/pp-charity/web.us/campaign.jsp?cid=-12

Since no messages are sent when you donate from the paypal link, you could also write a donation message on Message Board. I(we) would really appreciate it, and it will really motivate me(us)!

BountySource

If you like to help and enhance the project directly consider backing this project via BountySource. You can back the team (which means you support the entire project) or you can make bounty on a specific issue. (If you have any bugs to be fixed or features to be implemented not in issues yet you can make one.)

Contributors

See contributors page in github repository. https://github.com/XVimProject/XVim/contributors

License

MIT License

xvim's People

Contributors

82times avatar ajylee avatar antmd avatar brucehappy avatar dengcqw avatar dojoteef avatar goles avatar hmuronaka avatar j-fields avatar jeffpearce avatar johntheappleseed avatar jugglershu avatar kabuko avatar lunastorm avatar lynxluna avatar mike-hoegeman avatar mitsuse avatar myeyesareblind avatar neybis avatar pebble8888 avatar raimon49 avatar reflejo avatar skue avatar squarefrog avatar toshi0383 avatar warwithinme avatar weaksauce avatar yixiang avatar yzlin avatar zachlatta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xvim's Issues

Line handling is broken

This is a recent regression. o and O used to behave properly, but now insert a newline midline. Likewise, p and P often paste into the middle of the previous/next line.

Addition of RegexKitLite to Xvim project

It would be nice to add the RegexKitLite regular expression package

http://regexkit.sourceforge.net/RegexKitLite/

to the Xvim build. it's seems small enough (a single a.h .m pair of files) and it would allow searching via regular expressions. If you add it to the project, i would be happy to fix up the command line search commands "/" & "?"
to use it. having regular expression capable search would be a nice addition i think and make the searching more vi like.

-mike

Next Release

I will release next version of XVim in 1 or 2 weeks.
The release will be still alpha version and form of ZIP.

The new features are followings

  • supporting a lot of navigations and more vim like motions
  • supporting some configurations such as errorbells, ignorecase,wrapscan,
  • supporting XVim original commands such as 'run', 'make'

The detail of new features are listed when released.

Acknowledgement

Most of the improvements are made by mike-hoegeman.
Thank you very much!

Clean XVim.m

This is an issue for milestone.
Separate search related functions form XVim.m file.
(We may need some property holder (NSDictionary?) to hold XVim wide variables)

And also separate ex-command process to another file.

First input of newly created view is not evaluated

When you open new view the first input to the view is not handled properly.

How to reproduce

  1. Show new file by selecting a file not viewing currently from project navigator.
  2. Click somewhere in the view and set a cursor at any position.
  3. Press 'j'

The current result

Cursor does not move

The expected result

Cursor should move down one line down

Note

Not only 'j' but 'p' or any other key input seems not working.
When input 'j' I got following log

[XVimMotionEvaluator _motionFixedFrom:To:Type:] [Line 52] from:0 to:0 type:1

I did some easy debug but could not understand why this happens...

Better not reinventing the wheel

Since the code structure will change, and all those thing I want to port seems like a little bit to large. So I will try after the big refactoring.

Anyway, during the time. I think it's better not reinventing the wheel, since I've already write some vim-common functions like getting the caret position of $ and ^ or aw text object. And those functions are plain-C function which could be easily reused.

So I suggest that instead of doing it all again, just go grab the vim.h and vim.m in my project to speed up things.

Mode Switching.

Currently

    [self xvim].mode = MODE_INSERT;
    return [[XVimInsertEvaluator alloc] initWithRepeat:1]; 

It should automatically switch to other mode, when Evaluator is inited..
For example:
Creating a XVimInsertEvaluator will automatically switch to Insert Mode.
While creating XVimNormalEvaluator will switch to Normal Mode.

word movement "w" & "b" vs word character span for commands like dw and cw

word movement "w" & "b" work properly now. but commands like dw & cw are deleting using the same span of characters which is not correct e.g. if the cursor is on the first slash on the line below and the "dw" is typed it deletes from the first slash through and including the '1' character. when moving by word that's what you want, but not for calculating a word span for dw, cw, etc..

// 1234 

for dw it should delete the slashes and the space but not the '1' character

Plugin not loading

I can unfortunately not get the plugin to load with Xcode.

If I load the xcode project and run it it will however start a new xcode instance with the plugin loaded.

The plugin is in the specified folder.

Any ideas?

/Johannes

Crash when mouse selects character past the end of the line and motion is performed

If you click past the end of a line, you can move the cursor to an invalid position. This causes crashes in much of the code where there are asserts to make sure the cursor is in a valid position.

Application Specific Information:
ProductBuildVersion: 4E1019
UNCAUGHT EXCEPTION (NSInternalInconsistencyException): index can not be invalid cursor position
UserInfo: (null)
Hints: None
Backtrace:
  0  0x00007fff880bffaa __exceptionPreprocess (in CoreFoundation)
  1  0x00007fff871f4d5e objc_exception_throw (in libobjc.A.dylib)
  2  0x00007fff880bfdfa +[NSException raise:format:arguments:] (in CoreFoundation)
  3  0x00007fff8a2e8743 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (in Foundation)
  4  0x000000010abf5c32 -[NSTextView(VimMotion) endOfLine:] at /XVim/XVim/NSTextView+VimMotion.m:333 (in XVim)
  5  0x000000010abf2cb0 -[XVimVisualEvaluator becameHandler:] at /XVim/XVim/XVimVisualEvaluator.m:35 (in XVim)
  6  0x000000010abea477 -[XVim handleKeyEvent:] at /XVim/XVim/XVim.m:229 (in XVim)
  7  0x000000010abe7058 -[DVTSourceTextViewHook keyDown:] at /XVim/XVim/DVTSourceTextViewHook.m:139 (in XVim)
  8  0x00007fff8b56bb44 -[NSWindow sendEvent:] (in AppKit)
  9  0x00007fff8b50416d -[NSApplication sendEvent:] (in AppKit)
 10  0x0000000102b051e1 -[IDEApplication sendEvent:] (in IDEKit)
 11  0x00007fff8b49a1f2 -[NSApplication run] (in AppKit)
 12  0x00007fff8b718b88 NSApplicationMain (in AppKit)
 13  0x00000001020b1eec (in Xcode)
 14  0x0000000000000002

Crash when escape from Insert mode

In XVimInsertEvaluator's "eval:ofXVim"
when it handles it often crashes.
The crash happend on 2nd line of below.

         NSString *text = [xvim string];
        NSString *insertedText = [text substringWithRange:textRange];
        [self recordText:insertedText intoRegister:[xvim findRegister:@"repeat"]];
        [self recordText:insertedText intoRegister:xvim.recordingRegister];

The debugger says the argument 'textRange' is {1710,18446744073709551613}.
The big number means its length is "-3"
I think this happens when you move cursor to some other place in insert mode especially when it moves back from the begining of insertion.
I think if the cursor position had not move one way ( if some cursor movement is occured ), we can give up to save the inserted text.( This is vim's way)

Pressing `b` at the end of a file on an empty line crashes Xcode

Pressing b at the end of a file on an empty line crashes Xcode

UNCAUGHT EXCEPTION (NSRangeException): -[__NSCFString characterAtIndex:]: Range or index out of bounds
UserInfo: (null)
Hints: None
Backtrace:
  0  0x00007fff880bffaa __exceptionPreprocess (in CoreFoundation)
  1  0x00007fff871f4d5e objc_exception_throw (in libobjc.A.dylib)
  2  0x00007fff880bfdfa +[NSException raise:format:arguments:] (in CoreFoundation)
  3  0x00007fff880bfd84 +[NSException raise:format:] (in CoreFoundation)
  4  0x00007fff8807da9e -[__NSCFString characterAtIndex:] (in CoreFoundation)
  5  0x000000010e66888a -[NSTextView(VimMotion) wordBackward:] at /XVim/XVim/NSTextView+VimMotion.m:658 (in XVim)
  6  0x000000010e668b69 -[NSTextView(VimMotion) wordsBackward:] at /XVim/XVim/NSTextView+VimMotion.m:706 (in XVim)
  7  0x00007fff880af75d -[NSObject performSelector:withObject:] (in CoreFoundation)
  8  0x000000010e66fcf1 -[XVimMotionEvaluator commonMotion:Type:] at /XVim/XVim/XVimMotionEvaluator.m:43 (in XVim)
  9  0x000000010e66fe96 -[XVimMotionEvaluator b:] at /XVim/XVim/XVimMotionEvaluator.m:73 (in XVim)
 10  0x00007fff880af75d -[NSObject performSelector:withObject:] (in CoreFoundation)
 11  0x000000010e660f48 -[XVimEvaluator eval:ofXVim:] at /XVim/XVim/XVimEvaluator.m:215 (in XVim)
 12  0x000000010e66130b -[XVimNumericEvaluator eval:ofXVim:] at /XVim/XVim/XVimEvaluator.m:269 (in XVim)
 13  0x000000010e65b5e0 -[XVim handleKeyEvent:] at /XVim/XVim/XVim.m:229 (in XVim)
 14  0x000000010e6582d8 -[DVTSourceTextViewHook keyDown:] at /XVim/XVim/DVTSourceTextViewHook.m:139 (in XVim)
 15  0x00007fff8b56bb44 -[NSWindow sendEvent:] (in AppKit)
 16  0x00007fff8b50416d -[NSApplication sendEvent:] (in AppKit)
 17  0x00000001069581e1 -[IDEApplication sendEvent:] (in IDEKit)
 18  0x00007fff8b49a1f2 -[NSApplication run] (in AppKit)
 19  0x00007fff8b718b88 NSApplicationMain (in AppKit)
 20  0x0000000105f0feec (in Xcode)
 21  0x0000000000000002

Suppress warings

This is an issue for next milestone.
Currently there are too many warning XCode pointing out.
Fix it as possible as we can.

Consider merging two project

Hi there.
I should have send you an email instead of making a new issue :)

Well, I launched a xvim project a while ago. Feel free to go ahead and have a look...

What I'm thinking is that, we are almost doing the same thing, why not merging our projects into one instead of wasting time to achieve the same thing.

Tell me about your thoughts.

Regards..

`%` only works when cursor is directly on ()

% only works when cursor is directly on () where it should find the next match. For example, if you have a line of code as follows:

void test(NSString* string);

and you place your cursor on NSString, in Vim when you press % it will go to the (. In XVim it does nothing.

Visual mode can not change between line and character modes

When in line visual mode:

  • v should switch to character mode
  • V should go to normal mode

When in character visual mode:

  • v should go to normal mode
  • V should go to line visual mode

Ideally, in both visual modes, a cursor (like in normal mode) should still be displayed,

How to treat newline in Mac

What we should use as a newline in Mac?
I found that [NSCharacterSet newlineCharacterSet] can be used to find newline...

I used it in XVimSearchLineEvaluator like

[source rangeOfCharacterFromSet:[NSCharacterSet newlineCharacterSet] options:NSBackwardsSearch range:NSMakeRange(0, original.location)]
Is this fine?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

How to get a breakpoint work

This project needs to debug XCode itself by XCode.
When invoke "Run" on this project it runs another XCode process and start debugging.
But unfortunately we can not get breakpoint work.
I have experienced that it worked.

My current understanding is its because of some lack of debug information for debugger
because when the debugee crashes with some reason the debugger outputs the call stack and
what I can see is there are no symbols for XVim method calls(only addresses are shown) while another methods are shown by name.

I do not know if we can fix this by configuring compiler or linker options or other build options.
It would be easy to debug if we can make breakpoints work properly.

`:<line number>` is inaccurate with wrapped lines

:<line number> goes to the line number in the editor instead of the code line. If you have wrapped lines, these will differ. For example:

if you do :100 in a file with wrapped lines, that will differ from gg99j which I would expect would be the same line.

Can't hook functions of "IDESourceCodeEditor"

This class is surely exist in Xcode, as it is the NSTextViewDelegate.

But when I want to hook its functions in XVim load. NSClassFromString(@"IDESourceCodeEditor") returns nil.
It's important to override the functions of this class... Any solutions?

By the way, I see the breakpoints in Xcode and launch another one, but seems like the break point doesn't work.

Key remapping

Support keymapping.

Suppested commands: nmap, imap, vmap, omap

Preferably support multiple keys -> multiple keys, for instance:
nmap ,w :w

Hunging up of XCode

Currently I'm developing XVim with using it and I sometimes encounter sudden hung up of XCode. I do not know if this is because of XVim or a problem of XCode itself.

Anyone who also encounter the same problem report it to me please!

regex search on ? and / needs to keep state to move past prev match on next search

right now it creeps one character forward for each 'n' you do after the initial search. it needs to start the next search after the the entire match from the previous search.

i have some ideas on how to do this. basically keep a _nextSearchBaseLocation (similar to _lastSearchString)
we probably also have to intercept (setSelectedRange) to also participate in maintaining _nextSearchBaseLocation by updating _nextSearchBaseLocation with r.location and then calling [super setSelectedRange r] search{forward/backward} would also update _nextSearchBaseLocation manually after it completed at search

Imcomplete implementation?

I just forked and built. It turned out many methods are missing.
For example _XVimDrawInsertionPointInRect:color:

Am I missing something, or is it intensionally not implemented?

Undoing a line join leaves a space

If you have something like:

one
two

and your cursor is on the line with "one" and you press J, you'll get:

one two

This is expected, however when you press u, you get:

one
 two

(Note the space before the "two")

Proposal for Donations

Actually I had not expected developers other than me is joining the developing of this project.
(I just expected some requests or bug reports ).

Fortunately some developers are interested in developing this and already merged some codes.

The problem is fortunately I already got some amount of donation.
It should be opened and I should report how much of donations we got.

And here is my proposal.
I want to donate all of the donations to this project as donation for Tōhoku earthquake and tsunami in 2011 in Japan.

Since I'm new to open source project I do not know how they treat the donations but this is not bad idea I think.

Let me know if you have any opinion.

`~` should change case

In normal mode ~ should change the case of the character under the cursor and move to the next character (moving to the next character allows you to do stuff like 5~ to change 5 chars to upper case)

In visual mode, ~ should change the case of the selected text and return to normal mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.