Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Auto save file case redo<C-R> cmd can not use. #38

Open
orlandoxu opened this issue Nov 13, 2020 · 2 comments
Open

Auto save file case redo<C-R> cmd can not use. #38

orlandoxu opened this issue Nov 13, 2020 · 2 comments

Comments

@orlandoxu
Copy link

System:
mac os x 10.15.7
version:
NVIM v0.4.4
Build type: Release

So, I need closed auto save

let g:workspace_autosave_always = 0
let g:workspace_autosave = 0
@motephyr
Copy link
Contributor

I read the source code and figure out the reason.

function! s:Autosave(timed)
  if index(g:workspace_autosave_ignore, &filetype) != -1 || &readonly || mode() == 'c' || pumvisible()
    return
  endif

  let current_time = localtime()
  let s:last_update = get(s:, 'last_update', 0)
  let s:time_delta = current_time - s:last_update

  if a:timed == 0 || s:time_delta >= 1
    let s:last_update = current_time
    checktime  " checktime with autoread will sync files on a last-writer-wins basis.
    call s:UntrailSpaces()
    call s:UntrailTabs()
    silent! doautocmd BufWritePre %  " needed for soft checks
    silent! update  " only updates if there are changes to the file.
    if a:timed == 0 || s:time_delta >= g:workspace_autosave_au_updatetime
      silent! doautocmd BufWritePost %  " Periodically trigger BufWritePost.
    endif
  endif
endfunction

That is why we can't redo, because the file changed.

    call s:UntrailSpaces()
    call s:UntrailTabs()

Could we just autosave it and not to do this behavior?

@motephyr
Copy link
Contributor

let g:workspace_autosave = 1
let g:workspace_autosave_untrailspaces = 0
let g:workspace_autosave_untrailtabs = 0

That works for me. But I think we can remind users in the readme

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants