Перезаписать без получения Вы действительно хотите написать в него (да / нет)?в редакторе vim - PullRequest
2 голосов
/ 19 мая 2011

Как избавиться от сообщения, указанного в заголовке поста

1 Ответ

1 голос
/ 19 мая 2011

Из справки vims: w!:

                            *:w!*
:[range]w[rite]! [++opt] {file}
            Write the specified lines to {file}.  Overwrite an
            existing file.

Или это то, что вы ищете?

                *'confirm'* *'cf'* *'noconfirm'* *'nocf'*
'confirm' 'cf'      boolean (default off)
            global
            {not in Vi}
    When 'confirm' is on, certain operations that would normally
    fail because of unsaved changes to a buffer, e.g. ":q" and ":e",
    instead raise a |dialog| asking if you wish to save the current
    file(s).  You can still use a ! to unconditionally |abandon| a buffer.
    If 'confirm' is off you can still activate confirmation for one
    command only (this is most useful in mappings) with the |:confirm|
    command.
    Also see the |confirm()| function and the 'v' flag in 'guioptions'.

Или, может быть, даже автозапись / autowriteall:

                 *'autowrite'* *'aw'* *'noautowrite'* *'noaw'*
'autowrite' 'aw'    boolean (default off)
            global
    Write the contents of the file, if it has been modified, on each
    :next, :rewind, :last, :first, :previous, :stop, :suspend, :tag, :!,
    :make, CTRL-] and CTRL-^ command; and when a :buffer, CTRL-O, CTRL-I,
    '{A-Z0-9}, or `{A-Z0-9} command takes one to another file.
    Note that for some commands the 'autowrite' option is not used, see
    'autowriteall' for that.

             *'autowriteall'* *'awa'* *'noautowriteall'* *'noawa'*
'autowriteall' 'awa'    boolean (default off)
            global
            {not in Vi}
    Like 'autowrite', but also used for commands ":edit", ":enew", ":quit",
    ":qall", ":exit", ":xit", ":recover" and closing the Vim window.
    Setting this option also implies that Vim behaves like 'autowrite' has
    been set.

Большим будущим в справочной системе vims является то, что вы вводите что-то, а затем нажимаете "ctrl-d", тогда vim отобразит все соответствующие записи:

:help autowrite ctrl-d
'autowrite' 'autowriteall' 'noautowrite' 'noautowriteall'

То, что вы также можете сделать, это сделать запись vim в файл, как только фокус изменится, добавив это в ваш файл .vimrc:

au FocusLost * :wa
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...