Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Big fan of Vim. One thing I wish they fixed is the UX around opening a file twice.


Fwiw 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.


What specifically do you need fixed?


Well, 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.


There's the built-in `packadd editexisting` to take care of that; On Unix https://github.com/gioele/vim-autoswap could be more convenient.


Thanks, but these only seem to work with graphical versions of Vim. Also, if you suspend your Vim session, these seem to stop working.


Try 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 "$@"




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: