I'm writing TypeScript and there is a command npx tsc --watch that will (over)write to an output file every time the source file is changed. I open one split for each of these files. But when I save the source file the output file didn't get updated. How?

As the following img indicates: I've saved the file on the left, but the file on the right isn't changed/synced. I'm willing to record the entire process if someone really want to help me solve this tricky problem.

  • Not sure if I understand correctly. Please check the 'backupcopy' option Dec 10, 2021 at 10:24
  • @ChristianBrabandt: Could you describe the exact steps to make it work?
    – job_start
    Dec 10, 2021 at 11:03
  • try to explain your problem correctly. The title talks about buffer being updated in a split window, but you are actually writing something like writing a file. So what exactly is your problem? What do you want to achieve? Very unclear to me. Dec 10, 2021 at 11:47
  • @ChristianBrabandt: I just observed that I need to run :w twice to reflect the changes I've made to the output file, which is opened in a split in my neovim, which is generated every time the input file, which is also opened in a split in my neovim, is changed.
    – job_start
    Dec 10, 2021 at 12:12
  • 1
    the idea of 'backupcopy' is, to tell Vim how to write a file safely. It usually does create a backup copy of the current file by renaming the original file. Then it saves the file and copies metadata over. Please check the documentation for that option. BTW: I would never set the swapfile to false. You may lose data! Dec 10, 2021 at 15:01


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.