3 ms·
I don't use vim, but can't you just skip the first command? I would guess that the second command would work just fine. Presumably the only difference would be
by tshaddox 5y ago
I don't use vim, but can't you just skip the first command? I would guess that the second command would work just fine. Presumably the only difference would be that the file wouldn't be created until you first save the file within vim.
- JadeNB 5y ago> I don't use vim, but can't you just skip the first command? I would guess that the second command would work just fine. You are correct.
- version_five 5y ago> Presumably the only difference would be that the file wouldn't be created until you first save the file within vim. And for me anyway, this is a benefit. When I used windows (and the same holds for google docs) I always had "New Folder"s everywhere that I'd created for whatever reason and then changed my mind or got distracted. Same with new documents. In vim, I do like to say, and it I change my mind and don't save it, I never see it again. If I touch'd it first, inevitably I'd have empty files everywhere.
- EarthLaunch 5y agoWhy I do 'touch' first: I'm in vim creating the file, then I try to save and discover I don't have write permissions [1]. With a touch first, saving the file always works. 1: https://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-without-root-permission/ https://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-w...
- koyote 5y agoThat's a good tip! Sadly it does not save me from going and editing a system file as non-root and then trying to save... :(
- michaelmrose 5y agoYou could have a function that writes contents of buffer to current path as root in your editor of choice.