Skip to content

Commit

Permalink
Fix tests, BS in expansions and close #105.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raimondi committed Jun 18, 2013
1 parent cfc6654 commit 8a8aad1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autoload/delimitMate.vim
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function! delimitMate#WriteAfter(str) "{{{
let len = 1 "len(a:str)
let line = split(getline('.'), '\zs')
let col = delimitMate#CursorIdx() - 1
if (col + 1) < 0
if (col + 1) < 0 || col('.') == 1
let line = insert(line, a:str)
elseif col('.') == col('$')
let line = add(line, a:str)
Expand Down
2 changes: 1 addition & 1 deletion plugin/delimitMate.vim
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ endfunction "}}}

function! s:ExtraMappings() "{{{
" If pair is empty, delete both delimiters:
inoremap <silent><expr> <Plug>delimitMateBS delimitMate#WithinEmptyPair() ? "\<C-R>=delimitMate#BS()\<CR>" : "\<BS>"
inoremap <silent> <Plug>delimitMateBS <C-R>=delimitMate#BS()<CR>
if !hasmapto('<Plug>delimitMateBS','i') && maparg('<BS>'. 'i') == ''
silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
endif
Expand Down
2 changes: 2 additions & 0 deletions test/autoclose_quotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ set cpo=ces$
" 'x" " 'x'"
# Make sure we jump over a quote on the right. #89.
"('test'x" "('test'x)"
# Duplicate whole line when inserting quote at bol #105
"}\<Home>'" "''}"
6 changes: 4 additions & 2 deletions test/expand_cr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ $(document).ready(function() {
--------------------------------------------------------------------------------
# Issue #95
new
let b:delimitMate_jump_expansion = 1
DelimitMateReload
exec "normal i(\<CR>test)x"
================================================================================
(
Expand Down Expand Up @@ -43,10 +45,10 @@ sub foo {
}
--------------------------------------------------------------------------------
%d
call setline(1, "\"{bracketed}")
call setline(1, '"{bracketed}')
normal A"x
================================================================================
"{bracketed""x
"{bracketed}"x"
--------------------------------------------------------------------------------
# Syntax folding enabled by autocmd breaks expansion. But ti can't be tested
# with :normal
Expand Down
2 changes: 2 additions & 0 deletions test/expand_space.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Issue #95
new
let b:delimitMate_jump_expansion = 1
DelimitMateReload
exec "normal i( test)x"
================================================================================
( test )x
Expand Down

0 comments on commit 8a8aad1

Please sign in to comment.