Close unsaved file without asking to save it


I would like to have a way to be able to exit the current unsaved bugger without being prompted to save it.

As in vim there’s the command


Which closes the buffer and don’t asks to save it.


Are you using the vim-mode package?


Yes I am @AbeEstrada


Not sure if there’s an API to remove the confirmation when trying to close a pane, but, can you please make that suggestion here ? They can help more than me.


As a simple workaround for when this potentially gets added to the vim-mode package, you can put something like this in your init script

atom.workspaceView.command "user:forcequit", => atom.exit()
atom.keymaps.addKeymap "user", ".workspace": "ctrl-cmd-q": "user:forcequit"

Be warned that this closes all windows without any prompts. If you just want to force close a single file, you can do something like

atom.workspaceView.command "user:forceclose", =>
atom.keymaps.addKeymap "user", ".workspace": "ctrl-cmd-w": "user:forceclose"

Obviously, if you want to, you can move the keymaps to your keymap file instead, but I inlined them to keep them close to the functionality they are tied to.

Edit: Wrap the long line in the second snippet to avoid confusion


Excellent this accomplished what I needed. Thanks.


I would like to second this request. vim-mode-plus doesn’t recognize the “:command” operations, nonetheless, this capability should exist out of the box by a simple menu item and/or key bindings to not prompt, but just close all files open in adjacent panes without saving any changes. I make this request because I frequently open many files, modify their appearance to make them easier to analyze, then close without saving my changes.


This is still not implemented in current Atom. So I expanded on @thomasjo answer to add close all (ctrl-shift-w).


function centerPane() {
  const panes = atom.workspace.getPanes()
    .filter(pane => pane.getContainer().getLocation() === 'center' 
                    && pane.getContainer().getActivePane() === pane)
  if(panes.length !== 1) {
    throw 'No center panel found'
  return panes[0]
function isTextEditor(item) {
  return item && === 'TextEditor'
function forceCloseTabs() {
  atom.commands.add('atom-text-editor', 'Custom:Close Active Editor', () => {
    activeItem = centerPane().getActiveItem()
    isTextEditor(activeItem) && activeItem.destroy()
  atom.commands.add('atom-workspace', 'Custom:Close All Editor', () => {
      .filter(item => isTextEditor(item))
      .forEach(item => item.destroy())
  atom.keymaps.add("user", {"atom-text-editor": {"ctrl-w": "Custom:Close Active Editor"}})
  atom.keymaps.add("user", {"atom-workspace": {"ctrl-shift-w": "Custom:Close All Editor"}})