Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor improvement to vim-saw #1469

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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