4

I had problem with YCMD server not shutting down properly, so I tried to kill it on VimLeave. After a couple tries I detected that VimLeave/VimLeavePre event not firing on vim exit. VimEnter is working though. What could be the cause of this?

fourslashw
  • 141
  • 2
  • How did you determine VimLeave and VimLeavePre are not triggered? – Sato Katsura Jul 20 '16 at 15:21
  • @SatoKatsura autocmd VimLeave * :!touch ~/hiVimLeave - nothing and
    autocmd VimEnter * :!touch ~/hiVimEnter - file created
    – fourslashw Jul 20 '16 at 15:25
  • @fourslashw just to be sure you are attempting to trigger these events by issuing a :quit command right? – DoYouEvenCodeBro Jul 20 '16 at 15:28
  • @f41lurizer right. Is there something wrong with it? – fourslashw Jul 20 '16 at 15:29
  • 2
    Not a good test, since you no longer have any buffer. Try something like this instead: autocmd VimLeave * call writefile([v:dying], '/tmp/some_file', 'a'). Don't expect writefile() to resolve ~ and the like. – Sato Katsura Jul 20 '16 at 15:30
  • @SatoKatsura I tried autocmd VimLeave * call writefile([v:dying], '/home/user/some_file', 'a') and its not working – fourslashw Jul 20 '16 at 15:34
  • What version of Vim are you running? – Sato Katsura Jul 20 '16 at 15:35
  • @SatoKatsura VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:35:24) Included patches: 1-488, 576 Modified by pkg-vim-maintainers@lists.alioth.debian.org Compiled by jamessan@debian.org – fourslashw Jul 20 '16 at 15:37
  • 1
    You might want to complain to Debian maintainers of Vim then. It works fine with recent versions of Vim. – Sato Katsura Jul 20 '16 at 15:42
  • @SatoKatsura Ill try to updating vim then, thanks! – fourslashw Jul 20 '16 at 15:43
  • 1
    You might already have a VimLeave auto command defined somewhere, which will take precedence; futher ones won't be executed. :au vimleave to see what's already defined. Try au! vimleave before defining your autocommand to delete any existing ones. – Antony Jul 20 '16 at 16:17

0 Answers0