GithubHelp home page GithubHelp logo

xvimproject / xvim Goto Github PK

View Code? Open in Web Editor NEW
5.2K 5.2K 596.0 15.33 MB

Xcode plugin for Vim keybindings

License: MIT License

HTML 8.95% Ruby 0.01% Makefile 0.01% Objective-C 76.40% C 1.34% C++ 13.30%

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

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.

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

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,

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..

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.

Key remapping

Support keymapping.

Suppested commands: nmap, imap, vmap, omap

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

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.

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

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...

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.

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!

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.

`~` 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.

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.

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!

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?

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

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.

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")

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.

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.

`:<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.

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

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

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)

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

`%` 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.

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.