Skip to content

how to map qa to exit nvim in oil buffer ? #714

Open

Description

@WingDust
No description provided.

Activity

  1. changed the title [-]how map qa to exit nvim in oil buffer ?[/-] [+]how to map qa to exit nvim in oil buffer ?[/+] on Jan 11, 2026
  2. rionnwastaken commented on Feb 10, 2026

    @rionnwastaken

    :help oil-config

    I have this keymap that switches to the alternate file
    vim.keymap.set('n', '', function()
    local keys = vim.api.nvim_replace_termcodes('<C-^>', true, false, true)
    vim.api.nvim_feedkeys(keys, 'n', false)
    end, { noremap = true, desc = 'Switch to alternative file' })

  3. yal212 commented on Jul 13, 2026

    @yal212

    You can add a buffer-local keymap for Oil buffers:

    vim.api.nvim_create_autocmd("FileType", {
      pattern = "oil",
      callback = function()
        vim.keymap.set("n", "qa", "<cmd>qa<CR>", {
          buffer = true,
          desc = "Quit all from Oil",
        })
      end,
    })
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions