4 ms·
I love Vim. But I have two problems with it: 1. When opening a file that is already open in another editor in another terminal, Vim gives me many options, but
by amelius 4y ago
I love Vim. But I have two problems with it:
1. When opening a file that is already open in another editor in another terminal, Vim gives me many options, but it doesn't give me the option to kill the other process (or ask that process to save its buffer and exit).
2. My .vimrc should really follow me around automatically. Too often I find myself installing a new machine and missing my settings. I don't know how it should be implemented, but this is something that should work. Edit: if SSH can pass the DISPLAY variable around, then it could do the same with (a key to) .vimrc. Once a .vimrc is associated with an account, it will stay there, so if I log into the machine from the console, I should have my .vimrc (this also happens to the .Xauthority file, although less useful). This could also apply to other settings, of course. And it would be even better if my Vim binary followed me around too, but this is perhaps too futuristic.
- Alekhine 4y agoA .vimrc is literally one file, and we've come up with lots of solutions for moving dotfiles around easily. Some jank, some not. But it is a hundred million miles out of scope for vim to implement some kind of sync. That would require accounts, databases, all kinds of tedious details an OSS project does not have the resources or volunteers to do.
- amelius 4y agoI was thinking that perhaps SSH should do this the way they also pass X11 credentials around.
- the_cat_kittles 4y agoan option to have vim use a url for the vimrc?
- simplotek 4y ago> an option to have vim use a url for the vimrc? Is copying .vimrc whenever logging in for the first time too much work?
- sneak 4y agoYes, plus you’d need to update it on all machines on each change. Computers are perfect automation machines. Why embrace useless toil?
- rthomas6 4y agogit clone https://my-dotfile-repo ln my-dotfile-repo/.vimrc ~/.vimrc Done.
- sneak 4y ago> But it is a hundred million miles out of scope for vim to implement some kind of sync. This doesn’t hold true in 2022. People expect their settings to follow them around automatically.
- jrumbut 4y agoI don't disagree, but some of the great parts about vim are its self-sufficiency and reliability. It's awful when your editor won't open because it's trying to write a log message to a drive that was disconnected or checking for updates but the network is extremely congested. One could make a command to check some central registry (or, what the hell, maybe a .vimrc blockchain) but typing that command would be about as much work as the curl/wget/git solutions proposed elsewhere.
- jstanley 4y agoNot the kind of people who use vim.
- sneak 4y agoThis is a tautology. By this logic vim is “done” and should forever remain in stasis.
- dredmorbius 4y agoVim can edit files over SSH. Invoke your local editor and edit the remote file. Additional benefits: no lag or delay in your buffer and editor, and you can save locally should the remote session crash. (This presumes a direct SSH connection, e.g., no bastion host, though that can be addressed via tunnelled connections.)
- Vecr 4y agoI'm not sure what you mean by "automatically" but there's no reason you can't put your configs in a remote git repo and git clone/git pull if you have a new home directory or if you want to update your config, respectively.
- mat_epice 4y agoHm. At first I was pretty reluctant about settings "following" users, but a good Vim feature might be built-in syncing to some web service (DAV, S3, git, etc.). Run some function when you start (like fetchsettings) that will query for endpoint, username, password, and boom. Something like that would be a bit better than what I'm doing now, which is just keeping a dotfiles repo that lives on github. Since password authentication is no longer allowed, and I need certain config stuff in there to stay relatively private, I have to do the public key dance to get started. The one benefit there is allowing diverging changes on different machines, and good control of what you push back to the store.
- jrumbut 4y agoI just have my .vimrc and plug-ins in a Github repository. I also have a minimal, no plug-ins required version. Now that I think of it, maybe I should put it on my website so I can curl it onto a server if there is no git available.
- fiddlerwoaroof 4y agoYou can just curl main.tar.gz which has a predictable url
- gofreddygo 4y agofor #2, Take your .vimrc. Put it on your personal domain or github or whatever. Make it publicly accessible. Use a unique combination of words in comments so it shows up in the search results for "goobleydook salamander".
- fiddlerwoaroof 4y agoI’ve setup nix home-manager such that, if I clone my dotfiles repository and setup home.nix (link it into place and make any machine-specific edits necessary), then home-manager will install a predictable version of vim, clone my plugin manager into the right place and symlink my vimrc into the right place. Then, on first launch, all my plugins install themselves and I’m ready to go.
- sullyj3 4y agoThe problem is that whenever you want to do a quick tweak, you have to do a `home-manager switch`, which can take a good 15 seconds or so. It's not the end of the world, but it's a very annoying bit of friction. It's particularly painful if you're trying to quickly test out changes that you're not confident of and iterate. This is compounded by the fact that home-manager currently doesn't work properly with the new flake based profiles (https://github.com/nix-community/home-manager/issues/2848 https://github.com/nix-community/home-manager/issues/2848).
- fiddlerwoaroof 4y agoYeah, I don’t have home-manager generate configurations for vim. I have home-manager generate a symlink to my version-controlled vimrc. This way I get the quick setup benefits of home-manager without the slow reload times. Incidentally, I just polished my script for working around that issue: https://github.com/fiddlerwoaroof/dotfiles/blob/master/scripts/hm-switch https://github.com/fiddlerwoaroof/dotfiles/blob/master/scrip...
- bumblebeast 4y agoVim supports reading s file over scp. Using your local vim to edit a remote file preserves your settings. vim scp://user@myserver[:port]//path/to/file.txt
- ar_lan 4y agoI’ve found #2 is just not that practical. Too many plugins just aren’t that portable because they depend on underlying binaries (LSP support in Neovim for example). Maybe minified, portable vimrc but even then, it makes me wonder, why not just copy all your dot files for your user?
- alwillis 4y agoMy .vimrc should really follow me around automatically. So it’s Vim’s fault because you don’t know how to sync your dotfiles? Depending on your setup, there many solutions to this problem. Start here: https://dotfiles.github.io/ https://dotfiles.github.io/
- Aperocky 4y agoSetting up vim (and other shell setups) have been the easiest things ever and this does it for me: https://github.com/Aperocky/unix-setup https://github.com/Aperocky/unix-setup I had to do it several times over the years, even have a shell file that would install all the plugins straight from git. The process take no more than 5 minutes and I'm right at home in the terminal of the new machine.
- allarm 4y agoFor 2 I use LocalCommand directive in /.ssh/config to copy some files to the remote machine, including .vimrc
- Beltalowda 4y ago> When opening a file that is already open in another editor in another terminal, Vim gives me many options, but it doesn't give me the option to kill the other process (or ask that process to save its buffer and exit). One potential risk with that is that it looks just at PID files, which may or may not be Vim. If you have a left-over swap file from a week ago after a reboot with PID 666, that PID can now be anything (including another unrelated Vim process!) It's actually kind of tricky to implement that reliably. That said, you can probably implement something like that through the SwapExists autocmd. Your second point seems more like some system design issue rather than a Vim issue per se. The problem also exists for your zshrc, tmux.conf, htoprc, and lots of other things. I don't think it's something Vim really needs to solve, but rather the system.