gioele / vim-autoswap

Please Vim, stop with these swap file messages. Just switch to the correct window!
Creative Commons Zero v1.0 Universal
115 stars 25 forks source link

Fix TTY identification in Tmux when using Mac OS #13

Closed thalesmello closed 6 years ago

thalesmello commented 7 years ago

This solves #12 , at least on my computer.

Maybe other people with the same problem might test this to see if it solves their problem as well.

I used just head, tail and sed in my solution, so I expect this implementation to be compatible with Linux.

However, it would be desirable to have someone test it.

ddickstein commented 7 years ago

How can I test this version? I use vim-plug for package management.

thalesmello commented 7 years ago

@ddickstein Plug 'thalesmello/vim-autoswap'

ddickstein commented 7 years ago

Yes, this patch fixes the problem for me.

gioele commented 7 years ago

@thalesmello: thank you for the PR. Your patch does solve this issue on MacOS, but breaks Linux. :(

I'll find an incarnation of sed that words for GNU ps as well as for the BSD ps. (If nobody beats me to it ;))

thalesmello commented 7 years ago

What if we simply parse the result using Vimscript? It probably would work in both Linux and Mac. I will have my laptop with me on Sunday night, I can give it a look then.

On Fri, Jun 16, 2017, 16:56 Gioele notifications@github.com wrote:

@thalesmello https://github.com/thalesmello: thank you for the PR. Your patch does solve this issue on MacOS, but breaks Linux. :(

I'll find an incarnation of sed that words for GNU ps as well as for the BSD ps. (If nobody beats me to it ;))

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/gioele/vim-autoswap/pull/13#issuecomment-309120121, or mute the thread https://github.com/notifications/unsubscribe-auth/ABEz4oPL7S6J6zXGA3zL9JGCuaXUeeJuks5sEt35gaJpZM4Nza8z .

thalesmello commented 7 years ago

@gioele I've pushed a new commit. Could you try it out in Linux, please?

thalesmello commented 7 years ago

Updates on this?

gioele commented 7 years ago

Thank you @thalesmello for the attempt, but the problem on Linux doesn't have to do with the sed invocation but with tail -n +2 | head -n 1. ps h PID returns a single line, so tail -n +2 will return an empty string.

On the bright side, I can sort-of-replicate this problem now on FreeBSD VM. Expect a fix soon. :)