Skip to content

Commit

Permalink
Consider issue #39
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGyver83 committed Mar 2, 2024
1 parent 92f91aa commit 139bb89
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions plugin/paredit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1119,9 +1119,15 @@ endfunction

" Handle <Enter> keypress, insert electric return if applicable
function! PareditEnter()
if pumvisible() && &completeopt !~# 'longest\|noinsert\|noselect'
" Pressing <CR> in a pop up selects entry.
return "\<C-Y>"
if pumvisible()
let lastchar = getline('.')[col('.')-2]
if stridx(')]}', lastchar) >= 0
" Select entry and add closing bracket (which vim removes)
return "\<C-Y>" . lastchar . "\<Left>"
else
" Pressing <CR> in a pop up selects entry.
return "\<C-Y>"
endif
else
let line = getline( '.' )
let pos = col( '.' ) - 1
Expand Down

0 comments on commit 139bb89

Please sign in to comment.