Keeping the swapfile on is really helpful when I accidentally open the same file in two different vim editors. But I do recommend configuring vim to place swapfiles in a different location, so you’re not scattering them all over your disk.
I actually went full on in the other direction and often have multiple vim instances working on the same file. It feels so much better than having to deal with swap file error messages. With the below it reloads the file when the window gets into focus. Super helpful when working in lots of terminal tabs. You just have to get into a habit of saving after every change as it conflicts otherwise. " check for and load fi…
Five lines I put in a blank .vimrc
41–50 of 133 posts
Re: Five lines I put in a blank .vimrc
#42It’s not enough. You should go all the way: set nobackup set nowritebackup set noundofile set noswapfile I explain why at https://lee-phillips.org/badvim/ Also, it’s best to just have one instance of Vim running, in server mode, so you can send files to it from the command line.
Why would you not just set the location of the backup and swapfiles to a fixed place in your system? Try this: set backupdir=~/.vim/backups,. set directory=~/.vim/swapfiles,. It will only write in the current directory, if ~/.vim/backups does not exist, and the dot is just there for portability, so nothing breaks when using my vimrc on a new system. Edit: Upon actually reading your blog-post, I understand at least on…
Edit: Hmmm. I’ll have to think some more about it. Anyway, glad you found my witeup useful.
Re: Five lines I put in a blank .vimrc
#43Earlier quoted context omitted.
Line numbers are great, until you try to cut and paste. But then again, VI/M wasn't designed for GUIs.
I don’t copy and paste, I just don’t see the need for line numbers. But then I also code with syntax highlighting off about half of the time.
Re: Five lines I put in a blank .vimrc
#44I find it odd that you would use the short version of a command in a config file. Brevity is important when you are doing repetitive tasks. In a config file (or code), clarity is more important that brevity. I know you could argue that you know VI so well that you know these commands off the top of your head.. even so, it's particularly pointless to list them this way in a blog where you have to turn around and expla…
Re: Five lines I put in a blank .vimrc
#45The swap file saved my work a number of times. If you never use recover and use Vim regularly, then go ahead and disable it; if you haven't used it because you don't know how to use it or you only rarely use Vim, then I'd encourage you to either try it first or leave it enabled (as it is by default) until it becomes a nuisance. And like u/strogonoff, I also disable line numbers, but that's just personal preference of…
> Or typing only Q because you didn't hit the : and accidentally entering ex mode. I'm not certain this is different (because I don't use either deliberately) but I'm forever hitting q (not even trying to quit) and entering some kind of macro recording mode. I think the only reason I haven't yet disabled it like you suggest (after doing it for years now) is that... Well 'some kind of macro recording' does sound like…
Re: Five lines I put in a blank .vimrc
#46I find it odd that you would use the short version of a command in a config file. Brevity is important when you are doing repetitive tasks. In a config file (or code), clarity is more important that brevity. I know you could argue that you know VI so well that you know these commands off the top of your head.. even so, it's particularly pointless to list them this way in a blog where you have to turn around and expla…
Re: Five lines I put in a blank .vimrc
#47I wonder if there are more convenient ways to do this.
Re: Five lines I put in a blank .vimrc
#48Earlier quoted context omitted.
Line numbers are great, until you try to cut and paste. But then again, VI/M wasn't designed for GUIs.
I don’t copy and paste, I just don’t see the need for line numbers. But then I also code with syntax highlighting off about half of the time.
I've always found syntax highlighting super distracting, but everyone i have met thinks im crazy.
Otoh i do love me line numbers.
Re: Five lines I put in a blank .vimrc
#49So for me, installing CtrP or FZF is pretty much mandatory (I've settled on FZF). I know this is about config options, and this is an extension, but for me, fuzzy search is pretty much essential for coding once you get to a moderate sized code-base.
Re: Five lines I put in a blank .vimrc
#50Earlier quoted context omitted.
I actually went full on in the other direction and often have multiple vim instances working on the same file. It feels so much better than having to deal with swap file error messages. With the below it reloads the file when the window gets into focus. Super helpful when working in lots of terminal tabs. You just have to get into a habit of saving after every change as it conflicts otherwise. " check for and load fi…
Can't you also auto-save when losing focus?
See [0] for something to try.
[0] https://vim.fandom.com/wiki/Auto_save_files_when_focus_is_lo...