Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim/gvim difference between close and hide

Tags:

vim

I'm kind of new to VIM, I'd like to know the difference between the :close window command and the :hide window command. I've read the docs but they both seem to do the about same...

like image 676
Tsef Avatar asked Mar 16 '13 08:03

Tsef


1 Answers

:clo[se][!]

Can:

  • fail when there is only one window on the screen.

  • :set hidden.

  • use [!] to exit the current session without saving it (i.e. :clo[se]!).

Can't

  • execute a side command.

:hid[e]

Can't

  • fail when there is only one window on the screen.

  • :set hidden (irrelevant).

  • use [!] to exit the curent session without saving it.

Can:

  • execute a side command (i.e. :hid[e] {cmd}).

This side command executes {cmd} with :set hidden. After execution of {cmd}, the previous value of :set hidden is restored. For example, :hide edit example will edit example and hide the current buffer if it has any changes.


(Referenced from :help close and :help hide from $vim)

like image 154
melvynkim Avatar answered Oct 26 '22 06:10

melvynkim