Skip to content

Commit

Permalink
fix: don't error on files containing special chars
Browse files Browse the repository at this point in the history
fixes: #66
  • Loading branch information
aarondill committed Apr 10, 2024
1 parent 66727b4 commit 65ec6f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion autoload/suda.vim
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function! suda#BufEnter() abort
let bufnr = str2nr(expand('<abuf>'))
execute printf(
\ 'keepalt keepjumps edit suda://%s',
\ fnamemodify(bufname, ':p'),
\ fnameescape(fnamemodify(bufname, ':p')),
\)
execute printf('silent! %dbwipeout', bufnr)
endfunction
Expand Down
4 changes: 2 additions & 2 deletions plugin/suda.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ augroup END

function! s:read(args) abort
let args = empty(a:args) ? expand('%:p') : a:args
execute printf('edit suda://%s', args)
execute printf('edit suda://%s', fnameescape(args))
endfunction
command! -nargs=? -complete=file SudaRead call s:read(<q-args>)

function! s:write(args) abort
let args = empty(a:args) ? expand('%:p') : a:args
execute printf('write suda://%s', args)
execute printf('write suda://%s', fnameescape(args))
endfunction
command! -nargs=? -complete=file SudaWrite call s:write(<q-args>)

0 comments on commit 65ec6f7

Please sign in to comment.