Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix neocomplcache when pumvisible() #61

Closed
wants to merge 3 commits into from

2 participants

@zhaocai

Test case:

suppose the cursor location is #

type something with neocomplcache popup like:

len(#

The cursor will be moved to the next line:

len()
    #

without neocomplcache popup like:

goodman(#

The cursor will be moved to the expected location:

goodman(#)
@zhaocai

I am not sure if this is the best way to solve this because I only have a rudimentary understanding of vim-smartinput...

@zhaocai

I am able to fix this from neocomplcache.

@zhaocai zhaocai closed this
@jordwalke

@zhaocai Could you please provide a link to your fix in neocomplcache?

@zhaocai

@jordow it is in the develop branch of my fork: https://github.com/zhaocai/neocomplcache/tree/develop . This is working but need improvement after I get response from @Shougo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 2 deletions.
  1. +14 −2 autoload/smartinput.vim
View
16 autoload/smartinput.vim
@@ -72,7 +72,7 @@ function! smartinput#define_default_rules() "{{{2
let self.table[a:name] = a:urules
endfunction
call urules.add('()', [
- \ {'at': '\%#', 'char': '(', 'input': '()<Left>'},
+ \ {'at': '\%#\_s', 'char': '(', 'input': '()<Left>'},
\ {'at': '\%#\_s*)', 'char': ')', 'input': '<C-r>=smartinput#_leave_block('')'')<Enter><Right>'},
\ {'at': '(\%#)', 'char': '<BS>', 'input': '<BS><Del>'},
\ {'at': '()\%#', 'char': '<BS>', 'input': '<BS><BS>'},
@@ -308,6 +308,14 @@ function! s:_encode_for_map_char_expr(rhs_char)
return s
endfunction
+function! s:_input_pre_expr()
+ let s = ''
+ if exists('g:loaded_neocomplcache')
+ let s = neocomplcache#smart_close_popup()
+ endif
+ return s
+endfunction
+
function! s:_trigger_or_fallback(char, fallback)
let nrule =
\ mode() =~# '\v^(i|R|Rv)$'
@@ -322,10 +330,13 @@ function! s:_trigger_or_fallback(char, fallback)
\ getcmdpos(),
\ getcmdtype()
\ )
+
if nrule is 0
+ " call tlog#Log("smartinput fallback:" . PP(a:fallback))
return a:fallback
else
- return nrule._input
+ " call tlog#Log("smartinput _input " . s:_input_pre_expr() . nrule._input)
+ return s:_input_pre_expr() . nrule._input
endif
endfunction
@@ -588,6 +599,7 @@ function! s:do_initial_setup() "{{{2
if !exists('g:smartinput_no_default_key_mappings')
call smartinput#map_trigger_keys()
endif
+
endfunction
Something went wrong with that request. Please try again.