Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [quit]

Use this tag for questions about exiting vim.

0
votes
0answers
54 views

Can't get out of vim

This is embarrassing. I can't seem to get out of vim. ZZ, :q aren't doing anything. Furthermore, I can't seem to type anything either. All I know is that at the bottom of the screen, there is this: ...
2
votes
0answers
92 views

:q will not let me exit vim [closed]

When using nvi I have a file that I want to exit but everytime I use :q it just opens this thing and I can't exit out of it. Does anyone know what it is and how to get rid of it? Note: this is nvi ...
5
votes
2answers
127 views

What is this strange area, and how do I exit out of it

Seems to be related to this question What is the '[Command Line]' that sometimes comes up when I try to quit, and how can I quickly exit it?, but the solution doesn't work for me. I pressed ...
-1
votes
1answer
414 views

I'm stuck in Vim; I see “Command Line” at the bottom and nothing makes Vim respond

I pressed :wq to write and quit. Except now I see a Command Line at the bottom and nothing I do makes vi respond (Enter, Esc, Ctrl+c, :, q, etc.). How do I get back to civilisation from here? If you ...
4
votes
1answer
58 views

Quit subsequent files opened with gvim *.c?

I cant believe that I could not find and answer to this with a simple google search! If I use gvim *.c in a directory with multiple C files, gvim opens the next one once I close the one I am looking ...
7
votes
2answers
238 views

Any way to retrieve lost undo tree after closing window (but buffer is still open)

A lot of times, I end up accidentally closing a file with :wq when I only want to do :w. Since I work with multiple tabs and windows, the buffer is still there and I can open it with :ls followed by :...
2
votes
1answer
194 views

How to exit Vim, without saving changes using the shortcut Ctrl-Q?

I have tried several things to set the keybinding Ctrl+Q to exit Vim without saving any changes (i.e., what is normally bound to :qa!). I have tried adding: inoremap <C-q> <esc>:qa!<cr&...
8
votes
0answers
178 views

vim ZZ lost output with autocommand

I want to check file before quitinq vim with custom functions, everything seems fine with QuitPre autocommand except using ZZ to exit. In this case the output is missing. Consider following function ...
1
vote
3answers
158 views

How do you disable saving in vim unless you quit as well?

You are probably wondering what I could possibly need this for? Well, my program will sometimes deal with erroneous strings that need to be manually fixed. So what I do, is I create a process which ...
4
votes
2answers
353 views

How to detect whether Vim has been invoked by another shell command?

I would like to modify the behavior of one of my mapping but only when Vim is reading data which were piped to it by $ vipe. The mapping closes/quits the current window/session depending on certain ...
0
votes
1answer
640 views

mapping to quit using “<Ctrl> + q” not coming into effect [duplicate]

I am trying to map Ctrl + q to quit editing the file. I added the below line to my .vimrc nnoremap <C-q> :execute "q"<CR> On pressing the above key combination, nothing happens, vim ...
9
votes
3answers
4k views

Cannot exit Vim even using q!

I cannot exit vim even when I type :q!. I get the error E37: No write since last change (add ! to override) E162: No write since last change for buffer... I think the buffer is a NetrwTreeListing ...
0
votes
2answers
87 views

Why do I need to use q! after `find … | vim -`, i.e., reading from stdin?

I do find $HOME -type f -name "*.tex" -exec grep -il "$1" {} + | vim - I cannot exit vim with q only because it gives the error which I do not understand why E37: No write since last change (add ! ...
3
votes
1answer
92 views

Swap choices: how can I “skip” instead of “quit” or “abort”?

Swap file ".file.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: I usually see this message when I accidentally :edit the wrong file, i.e., one which I'm already ...
5
votes
1answer
503 views

How to safely quit vim if there's some unsaved changes?

If I have changed a bunch of files but without saving and maybe I have another pile of noname buffers which are changed and without a file name. I want vim to prompt confirmation for each one of the ...
29
votes
2answers
13k views

What are the differences between :wq<cr> :x<cr> and ZZ when exiting vim?

Vi and Vim, as all of you know, have many synonyms. There are three ways I know of to save the file and exit Vim and Vi. These are :wq <cr>, :x <cr> and ZZ. I have heard that these are ...
4
votes
1answer
146 views

Save/Quit Unprivileged File With Sudo

I found the following command, which saves the current file with sudo, meaning you can open a file you don't have write access to (as long as you do have read access), in the amazing Ultimate vimrc by ...
18
votes
4answers
3k views

How do I close Vim externally?

Let's say I have a X11 server that's hanging, keeping me from saving the work from the XTerm Vim session that X11 server controls. (Not GVim, just regular Vim-in-XTerm.) Is there a way that I could (...
1
vote
2answers
64 views

Don't close regular + help window at once, reset a variable on keypress

I have this function and mapping: fun! TwiceToQuit() sil! q if v:errmsg == 'E37: No write since last change (add ! to override)' echohl ErrorMsg echo 'No write since last ...
4
votes
3answers
1k views

How do I avoid exiting vim to open a new file?

I usually exit vim to open other files, I know it is not productive and I want to avoid it. I want to use netrw instead to open the files I want. Is there any way to prevent me from exiting vim, using ...
3
votes
3answers
261 views

Exit when only one empty window remains

I'm using a script to load files in vim remotely into one gvim instance per desktop viewport. It works fine, except that it causes an empty additional window, that will remain after closing all others,...
22
votes
2answers
2k views

What's the difference between “quit” and “abort”?

When I try to open a file from multiple vim instances, I get an error with several options: Swap file "~/.vim/tmp/file.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:...
15
votes
2answers
854 views

How to exit vim from split mode?

How to efficiently exit vim when editing multiple files in the split mode at one go? It seems when I'm having e.g. 10 split windows, I've to repeat 10 times :q! command for each window which is a bit ...
9
votes
2answers
2k views

Prevent Vim from clearing the terminal after exit

If I do: $ less file And press q to exit less, I stil see the same text as I had on the screen when less was still running. However, if I do $ vim file And :q, my terminal is blanked... ...
19
votes
3answers
2k views

Terminal borked after invoking Vim with xargs

I've sometimes tried invoking Vim using xargs, like this: find . -name '*.java' | xargs vim … which kind of works: As Vim launches, I see the following warning flash briefly: Vim: Warning: Input ...