Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbfd70f7

Browse files
committed
fixed auto insert for rope complete
For details, see `:h completeopt` in vim.vim has many flags of option &completeopt, the flags like menu, menuone,noinsert, noselect and so on control the autocomplete behaviour.e.g. if the set completeopt=menu, and there's only one possiblecompletions, the vim will not popup a menu and just insert thecompletions, this like auto insert __init__ describe above, user there'sno chance to confirm the completions they want or not.but if set completeopt=menuone,noinsert, vim will popup menu also whenthere is only one match. for case above, vim will popup a menu with onecompletion item __init__ and let user choose insert it or escape, if addnoselect with &completeopt, vim will even not selected the firstcompletion item.
1 parentac97c66 commitbfd70f7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎autoload/pymode/rope.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ endfunction
1515

1616
fun!pymode#rope#complete(dot)
1717
ifpumvisible()
18-
return"\<C-n>"
18+
ifstridx('noselect', &completeopt)!=-1
19+
return"\<C-n>"
20+
else
21+
return""
22+
endif
1923
endif
2024
ifa:dot
2125
PymodePython rope.complete(True)
2226
else
2327
PymodePython rope.complete()
2428
endif
25-
returnpumvisible() ?"\<C-p>\<Down>" :""
29+
returnpumvisible()&&stridx('noselect', &completeopt)!=-1?"\<C-p>\<Down>" :""
2630
endfunction
2731

2832
fun!pymode#rope#complete_on_dot()"{{{

‎pymode/rope.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def complete(dot=False):
9494
line=env.lines[row-1]
9595
cline=line[:col]+p_prefix+line[col:]
9696
ifcline!=line:
97-
env.curbuf[row-1]=env.prepare_value(cline,dumps=False)
97+
if'noinsert'notinenv.var('&completeopt'):
98+
env.curbuf[row-1]=env.prepare_value(cline,dumps=False)
9899
env.current.window.cursor= (row,col+len(p_prefix))
99100
env.run('complete',col-len(prefix)+len(p_prefix)+1,proposals)
100101
returnTrue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp