I mounted the remote server directory to my local machine mount point with sshfs. Thus I could use my local vim to edit my code, it is much faster than editing with the vim installed to the remote server. However, the saving process and switching between buffers becomes very slow. Each time I run :w, it will cost me around 20s to accomplish the saving process, and it is also very slow when I run ctrl + w + l or <leader>+f to switch between the split buffers or other opened buffers. The network is sort of slow but I am sure it is not so slow when I use rsync to transmit files. What is the cause of this and how could I fix it please?

  • Coin, in general this doesn't look like Vims fault, but there are a few settings that might influence the write performance. Could you test the following: 1) Create the directory /tmp/vimbackup 2) in Vim do set backupdir=/tmp/vimbackup// (trailing slashes are needed) 3) edit and save a file from sshfs. How is the write performance now? – Ralf May 8 at 9:30
  • I am not sure whether my operation is correct. But I checkout the default backupdir by running :set backupdir? and see the result of backupdir=.,~/tmp,~/. So I checked the current directory by running ls -a, but I saw no relevant files created. Also after creating /tmp/vimbackup and running :set backupdir=/tmp/vimbackup, I saw the result of :set backupdir? because /tmp/vimbackup. Then I edited the file and run :w. I saw no result of the command ls -a /tmp/vimbackup. Is my configuration not approperiate? – coin cheung May 8 at 9:49
  • What Vim version do you have? – Ralf May 8 at 10:26
  • By running vim --version the first lines are like this: VIM - Vi IMproved 8.1 (2018 May 18, compiled May 2 2019 14:08:08) Included patches: 1-1244 Compiled by coin@Arch-Dell – coin cheung May 8 at 10:48
  • @Ralf I have made it work, and I saw backup files generated in the /tmp/vimbackup, but I observed no speed improvement. It is still slow when I switch between buffers or splits or save my changes. Do you have other suggestions please? – coin cheung May 8 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.