Skip to content

Commit

Permalink
Prevent using 'swapfile' on 'suda#BufReadCmd' (#88)
Browse files Browse the repository at this point in the history
Close #87
  • Loading branch information
lambdalisue authored Dec 8, 2024
1 parent e333169 commit 9adda7d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions autoload/suda.vim
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ function! suda#read(expr, ...) abort range
else
" write with 'b' to ensure contents are the same
call writefile(resultlist, tempfile, 'b')
" TODO: (aarondill) can we use readfile() here?
let echo_message = execute(printf(
\ '%sread %s %s',
\ options.range,
Expand Down Expand Up @@ -181,12 +180,12 @@ function! suda#BufReadCmd() abort
let ul = &undolevels
set undolevels=-1
try
setlocal noswapfile noundofile
let echo_message = suda#read('<afile>', {
\ 'range': '1',
\})
silent 0delete _
setlocal buftype=acwrite
setlocal noswapfile noundofile
setlocal nomodified
filetype detect
redraw | echo echo_message
Expand Down

0 comments on commit 9adda7d

Please sign in to comment.