GithubHelp home page GithubHelp logo

Comments (5)

dundargoc avatar dundargoc commented on July 22, 2024

How often does neovim crash that this becomes relevant lol?

Also I don't think it's as obvious as you say that autowrite "should" save on abort. In all cases now autowrite is triggered by a deliberate action by the user, while this will write on any random state it happens to be on. Do the recovery functionality/swap mechanism not essentially fulfill this need anyway?

from neovim.

justinmk avatar justinmk commented on July 22, 2024

preserve_exit is called on deadly signal:

neovim/src/nvim/os/signal.c

Lines 180 to 181 in a2d510e

// Preserve files and exit.
preserve_exit(IObuff);

IIUC, that only writes swap files. For SIGHUP/SIGQUIT (but not others like SIGTERM) maybe it makes sense to also write the buffer contents.

from neovim.

robin-carlier avatar robin-carlier commented on July 22, 2024

@dundargoc

How often does neovim crash that this becomes relevant lol?

It’s not relevant for crashes, but the use case that makes me want such a functionality is the following: I wanted a "quick and dirty" neovim scratchpad windows in my desktop environment, and I’m used to quit windows through my DE shorcuts, which calls a SIGHUP.

I agree that there are multiple workarounds for this particular usage but as @justinmk says for signals like SIGHUP or SIGQUIT (but not SIGTERM, I agree), I thought it would make more sense that neovim goes through its usual exit sequence as a :q would.

from neovim.

justinmk avatar justinmk commented on July 22, 2024

'autowrite' already (should) works like this for :suspend (SIGTSTP). And 'autowriteall' is intended to extend 'autowrite' behavior for "quit" (:help autowriteall mentions "closing the Vim window").

Proposal

  • Respect 'autowriteall' for SIGHUP/SIGQUIT.
  • Are VimLeave/VimLeavePre triggered on SIGHUP/SIGQUIT? Or should they be? Or should the Signal autocmd allow hooking into SIGHUP/SIGQUIT?

from neovim.

matveyt avatar matveyt commented on July 22, 2024

Are VimLeave/VimLeavePre triggered on SIGHUP/SIGQUIT? Or should they be?

I believe, they should if v:dying == 1 (i.e. only one deadly signal caught), as documented at :h v:dying.

from neovim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.