Skip to content

Commit 9884073

Browse files
committed
feat: (309) Implement csf/dsf
Ported: tpope#309
1 parent 64d17ce commit 9884073

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

import/surround.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ export def DoSurround(value: string = null_string, new_value: string = null_stri
502502
execute 'normal! l'
503503
endif
504504
execute "normal! \<Plug>(surround-d)t" .. char
505+
elseif char ==# 'f'
506+
execute "normal! \<Plug>(surround-d)i(" .. char
505507
else
506508
execute "normal! \<Plug>(surround-d)" .. strcount .. 'i' .. char
507509
endif
@@ -548,7 +550,14 @@ export def DoSurround(value: string = null_string, new_value: string = null_stri
548550
else
549551
# One character backwards
550552
search('\m.', 'bW')
551-
execute "normal! \<Plug>(surround-d)a" .. char
553+
554+
if char ==# 'f'
555+
execute "normal! \<Plug>(surround-d)a(" .. char
556+
execute 'normal! b\<Plug>(surround-d)w'
557+
original = getreg('"')
558+
else
559+
execute "normal! \<Plug>(surround-d)a" .. char
560+
endif
552561
endif
553562

554563
var removed = getreg('"')

0 commit comments

Comments
 (0)