Skip to content

SudaRead files have the last exit position mark off by one #90

@alcroito

Description

@alcroito

Hi,
Thanks for the great plugin!
I found a small issue that is slightly annoying.
With the following file

$ sudo chown root hello.txt
$ cat hello.txt
a
b
c
keep_cursor_here_on_exit
d
e

And the following minimal neovim config file

$ cat my_init.vim
set runtimepath^=./vim
let &packpath = &runtimepath

call plug#begin('./vim/plugged')

Plug 'lambdalisue/vim-suda'

call plug#end()

" Enable auto sudo write
let g:suda_smart_edit = 1

If i open the file with

$ nvim -u ./my_init.vim ./hello.txt

navigate to the keep_cursor_here_on_exit line, exit neovim, then open it again, and run the To the cursor position when last exiting the current buffer command aka,

`" 

the cursor is placed on the line containing c rather than keep_cursor_here_on_exit.
In contrast, if the file is owned by my user, and SudaRead is not executed, going to the last exit mark successfully goes to the keep_cursor_here_on_exit line.

I'm guessing vim-suda somehow modifies the last exit line mark during its execution.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions