Is there a shortcut like o that ignores the E445
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
In many cases I have one spare window which contains garbage and when I am in my main window, I'd like to close all other (with <C-W>o
), but I am getting E445 for those that are not saved.
Is there a relatively sort key combination that can close all other saved and not saved windows?
key-bindings
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
2
down vote
favorite
In many cases I have one spare window which contains garbage and when I am in my main window, I'd like to close all other (with <C-W>o
), but I am getting E445 for those that are not saved.
Is there a relatively sort key combination that can close all other saved and not saved windows?
key-bindings
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Try:set hidden
– Christian Brabandt
3 hours ago
Thanks, but I am looking for key combination that I will use only in some cases, not always.
– John
3 hours ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
In many cases I have one spare window which contains garbage and when I am in my main window, I'd like to close all other (with <C-W>o
), but I am getting E445 for those that are not saved.
Is there a relatively sort key combination that can close all other saved and not saved windows?
key-bindings
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
In many cases I have one spare window which contains garbage and when I am in my main window, I'd like to close all other (with <C-W>o
), but I am getting E445 for those that are not saved.
Is there a relatively sort key combination that can close all other saved and not saved windows?
key-bindings
key-bindings
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 3 hours ago
John
111
111
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Try:set hidden
– Christian Brabandt
3 hours ago
Thanks, but I am looking for key combination that I will use only in some cases, not always.
– John
3 hours ago
add a comment |Â
Try:set hidden
– Christian Brabandt
3 hours ago
Thanks, but I am looking for key combination that I will use only in some cases, not always.
– John
3 hours ago
Try
:set hidden
– Christian Brabandt
3 hours ago
Try
:set hidden
– Christian Brabandt
3 hours ago
Thanks, but I am looking for key combination that I will use only in some cases, not always.
– John
3 hours ago
Thanks, but I am looking for key combination that I will use only in some cases, not always.
– John
3 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
If you want to dispose of the unpersisted buffers right away, you'd need to write a custom function that iterates over all visible buffers and :bdelete!
s them.
However, I think it's better to postpone the problem until Vim is eventually closed. This behavior is built-in via the :help 'hidden'
option.
If you don't want to set this permanently, you could just temporarily set it (I'm using the upper-case O
key to avoid overriding the original mapping; you could also use the alternative <C-o>
):
:nnoremap <C-w>O :set hidden<CR><C-w>o:set nohidden<CR>
That's ugly, we can use :wincmd
to make a single, concatenated command-line:
:nnoremap <C-w>O :set hidden<Bar>wincmd o<Bar>set nohidden<CR>
But wait, there's a special :only
command that does the same:
:nnoremap <C-w>O :set hidden<Bar>only<Bar>set nohidden<CR>
And reading the documentation, this takes an optional !
to force hiding without having to set the option. I think that's a winner:
:nnoremap <C-w>O :only!<CR>
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
If you want to dispose of the unpersisted buffers right away, you'd need to write a custom function that iterates over all visible buffers and :bdelete!
s them.
However, I think it's better to postpone the problem until Vim is eventually closed. This behavior is built-in via the :help 'hidden'
option.
If you don't want to set this permanently, you could just temporarily set it (I'm using the upper-case O
key to avoid overriding the original mapping; you could also use the alternative <C-o>
):
:nnoremap <C-w>O :set hidden<CR><C-w>o:set nohidden<CR>
That's ugly, we can use :wincmd
to make a single, concatenated command-line:
:nnoremap <C-w>O :set hidden<Bar>wincmd o<Bar>set nohidden<CR>
But wait, there's a special :only
command that does the same:
:nnoremap <C-w>O :set hidden<Bar>only<Bar>set nohidden<CR>
And reading the documentation, this takes an optional !
to force hiding without having to set the option. I think that's a winner:
:nnoremap <C-w>O :only!<CR>
add a comment |Â
up vote
3
down vote
If you want to dispose of the unpersisted buffers right away, you'd need to write a custom function that iterates over all visible buffers and :bdelete!
s them.
However, I think it's better to postpone the problem until Vim is eventually closed. This behavior is built-in via the :help 'hidden'
option.
If you don't want to set this permanently, you could just temporarily set it (I'm using the upper-case O
key to avoid overriding the original mapping; you could also use the alternative <C-o>
):
:nnoremap <C-w>O :set hidden<CR><C-w>o:set nohidden<CR>
That's ugly, we can use :wincmd
to make a single, concatenated command-line:
:nnoremap <C-w>O :set hidden<Bar>wincmd o<Bar>set nohidden<CR>
But wait, there's a special :only
command that does the same:
:nnoremap <C-w>O :set hidden<Bar>only<Bar>set nohidden<CR>
And reading the documentation, this takes an optional !
to force hiding without having to set the option. I think that's a winner:
:nnoremap <C-w>O :only!<CR>
add a comment |Â
up vote
3
down vote
up vote
3
down vote
If you want to dispose of the unpersisted buffers right away, you'd need to write a custom function that iterates over all visible buffers and :bdelete!
s them.
However, I think it's better to postpone the problem until Vim is eventually closed. This behavior is built-in via the :help 'hidden'
option.
If you don't want to set this permanently, you could just temporarily set it (I'm using the upper-case O
key to avoid overriding the original mapping; you could also use the alternative <C-o>
):
:nnoremap <C-w>O :set hidden<CR><C-w>o:set nohidden<CR>
That's ugly, we can use :wincmd
to make a single, concatenated command-line:
:nnoremap <C-w>O :set hidden<Bar>wincmd o<Bar>set nohidden<CR>
But wait, there's a special :only
command that does the same:
:nnoremap <C-w>O :set hidden<Bar>only<Bar>set nohidden<CR>
And reading the documentation, this takes an optional !
to force hiding without having to set the option. I think that's a winner:
:nnoremap <C-w>O :only!<CR>
If you want to dispose of the unpersisted buffers right away, you'd need to write a custom function that iterates over all visible buffers and :bdelete!
s them.
However, I think it's better to postpone the problem until Vim is eventually closed. This behavior is built-in via the :help 'hidden'
option.
If you don't want to set this permanently, you could just temporarily set it (I'm using the upper-case O
key to avoid overriding the original mapping; you could also use the alternative <C-o>
):
:nnoremap <C-w>O :set hidden<CR><C-w>o:set nohidden<CR>
That's ugly, we can use :wincmd
to make a single, concatenated command-line:
:nnoremap <C-w>O :set hidden<Bar>wincmd o<Bar>set nohidden<CR>
But wait, there's a special :only
command that does the same:
:nnoremap <C-w>O :set hidden<Bar>only<Bar>set nohidden<CR>
And reading the documentation, this takes an optional !
to force hiding without having to set the option. I think that's a winner:
:nnoremap <C-w>O :only!<CR>
answered 1 hour ago
Ingo Karkat
11k2538
11k2538
add a comment |Â
add a comment |Â
John is a new contributor. Be nice, and check out our Code of Conduct.
John is a new contributor. Be nice, and check out our Code of Conduct.
John is a new contributor. Be nice, and check out our Code of Conduct.
John is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f17856%2fis-there-a-shortcut-like-c-wo-that-ignores-the-e445%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Try
:set hidden
– Christian Brabandt
3 hours ago
Thanks, but I am looking for key combination that I will use only in some cases, not always.
– John
3 hours ago