diff --git a/Documents/Users/FeatureList.md b/Documents/Users/FeatureList.md index 3c7045dd..9784ac4b 100644 --- a/Documents/Users/FeatureList.md +++ b/Documents/Users/FeatureList.md @@ -264,6 +264,7 @@ Examples: [no]relativenumber | [no]alwaysuseinputsource | With this option all the input is first sent to input source of the system. If you are using France, Portugese or Swedish keyboard consider turning this on. When enabling this, also consider running `defaults write com.apple.dt.Xcode ApplePressAndHoldEnabled -bool false` to disable the press and hold character menu in recent OS X releases. (See issue https://github.com/JugglerShu/XVim/issues/598). [no]blinkcursor | + [no]blockcursor | Tells XVim to use a block cursor when in insert mode. Defaults to off. [no]startofline | Tells XVim to move the cursor to the first non-blank of the line when using jump commands (`gg, G` etc). Defaults to on. diff --git a/XVim/DVTSourceTextView+XVim.m b/XVim/DVTSourceTextView+XVim.m index e2693bfa..04945d92 100644 --- a/XVim/DVTSourceTextView+XVim.m +++ b/XVim/DVTSourceTextView+XVim.m @@ -118,10 +118,10 @@ - (void)xvim_keyDown:(NSEvent *)theEvent{ }@catch (NSException* exception) { ERROR_LOG(@"Exception %@: %@", [exception name], [exception reason]); [Logger logStackTrace:exception]; - // For debugging purpose we rethrow the exception - if( [XVim instance].options.debug ){ - @throw exception; - } + // For debugging purpose we rethrow the exception + if( [XVim instance].options.debug ){ + @throw exception; + } } return; } @@ -197,7 +197,10 @@ - (void)xvim__drawInsertionPointInRect:(NSRect)aRect color:(NSColor*)aColor{ // TRACE_LOG(@"%f %f %f %f", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height); @try{ XVimWindow* window = [self xvim_window]; - if( [[[window currentEvaluator] class] isSubclassOfClass:[XVimInsertEvaluator class]]){ + + // Only execute this code if we do NOT want a blockcursor + if( ![[[XVim instance] options] blockcursor] && + [[[window currentEvaluator] class] isSubclassOfClass:[XVimInsertEvaluator class]] ){ // Use original behavior when insert mode. return [self xvim__drawInsertionPointInRect:aRect color:aColor]; } @@ -300,7 +303,7 @@ - (void)xvim_viewDidMoveToSuperview { } - (void)xvim_observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if([keyPath isEqualToString:@"ignorecase"] || [keyPath isEqualToString:@"hlsearch"] || [keyPath isEqualToString:@"lastSearchString"] || [keyPath isEqualToString:@"highlight"]){ + if([keyPath isEqualToString:@"ignorecase"] || [keyPath isEqualToString:@"hlsearch"] || [keyPath isEqualToString:@"lastSearchString"] || [keyPath isEqualToString:@"highlight"]){ [self setNeedsUpdateFoundRanges:YES]; [self setNeedsDisplayInRect:[self visibleRect] avoidAdditionalLayout:YES]; } diff --git a/XVim/XVimOptions.h b/XVim/XVimOptions.h index bf1655df..2be2b566 100644 --- a/XVim/XVimOptions.h +++ b/XVim/XVimOptions.h @@ -26,6 +26,7 @@ @property BOOL relativenumber; @property BOOL alwaysuseinputsource; //XVim original @property BOOL blinkcursor; +@property BOOL blockcursor; @property BOOL startofline; @property BOOL expandtab; @property (nonatomic, strong) NSDictionary* highlight; diff --git a/XVim/XVimOptions.m b/XVim/XVimOptions.m index cc36e486..3768a886 100644 --- a/XVim/XVimOptions.m +++ b/XVim/XVimOptions.m @@ -39,6 +39,7 @@ - (id)init{ @"relativenumber", @"rn", @"alwaysuseinputsource", @"auis", @"blinkcursor", @"bc", + @"blockcursor", @"blockc", @"startofline", @"sol", @"expandtab", @"et", @"highlight", @"hi", @@ -49,10 +50,10 @@ - (id)init{ _wrapscan = YES; _errorbells = NO; _incsearch = YES; - _gdefault = NO; - _smartcase = NO; - _clipboard = @""; - _guioptions = @"rb"; + _gdefault = NO; + _smartcase = NO; + _clipboard = @""; + _guioptions = @"rb"; _timeoutlen = @"1000"; _laststatus = 2; _hlsearch = NO; @@ -61,6 +62,7 @@ - (id)init{ _relativenumber = NO; _alwaysuseinputsource = NO; _blinkcursor = NO; + _blockcursor = NO; _startofline = YES; _expandtab = YES; self.highlight = @{@"Search": @{