Skip to content

Commit

Permalink
Merge pull request #1469 from nano-o/master
Browse files Browse the repository at this point in the history
minor improvement to vim-saw
  • Loading branch information
robdockins authored Nov 10, 2021
2 parents 7d8bf6b + d7bef81 commit b6d6bb8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vim-saw/plugin/saw.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
" a function that overrides vim-slime's default behavior:
function SlimeOverride_EscapeText_saw(text)
" create temp buffer
split __saw_slime_temp_buffer__
keepalt split __saw_slime_temp_buffer__
setlocal buftype=nofile
setlocal bufhidden=delete
" paste text in buffer
set paste
exe "normal! i" . a:text . "\<Esc>"
Expand All @@ -13,6 +14,6 @@ function SlimeOverride_EscapeText_saw(text)
silent! keepp g/^\s*\/\/.*\n/d
silent! keepp %s/\/\/.*$//eg " remove end-of-line comments
let res = join(getline(1, '$'), "\\\n") " copy buffer contents into res, adding a backslash at the end of each line
bdelete __saw_slime_temp_buffer__ " delete temp buffer (the following didn't work reliably: setlocal bufhidden=delete)
bdelete __saw_slime_temp_buffer__ " delete temp buffer
return res . "\n"
endfunction

0 comments on commit b6d6bb8

Please sign in to comment.