3 ms·
Big fan of Vim. One thing I wish they fixed is the UX around opening a file twice.
by amelius 2y ago
Big fan of Vim. One thing I wish they fixed is the UX around opening a file twice.
- henearkr 2y agoFwiw it's useful in split mode to view and edit simultaneously different parts of the same text. Not only in split mode, as you can also just switch between two buffers (or more) focused on different parts of the text.
- sundarurfriend 2y agoWhat specifically do you need fixed?
- amelius 2y agoWell, if I open the same file that I already opened in another terminal, then it shows me the PID of the Vim process and a question about removing the lock file. What I normally do is kill the PID, and then open the file again and tell Vim to remove the lock file. This can be automated. But even better would be to allow me to take over the session in case there were any unsaved changes.
- konfekt 2y agoThere's the built-in `packadd editexisting` to take care of that; On Unix https://github.com/gioele/vim-autoswap https://github.com/gioele/vim-autoswap could be more convenient.
- amelius 2y agoThanks, but these only seem to work with graphical versions of Vim. Also, if you suspend your Vim session, these seem to stop working.
- konfekt 2y agoTry these work-arounds: - either adding to your `:help vimrc` if has('clientserver') && empty(v:servername) try call remote_startserver('VIM-' . getpid()) catch '^Vim\%((\a\+)\)\=:E\%(941\|240\)' endtry endif - or, at least on Unix, calling vim by, say `$HOME/bin/vim` with `$HOME/bin` in `$PATH` and launching /usr/bin/vim --servername vim -u ~/.vim/vimrc "$@"