Wikia

Vim Tips Wiki

Changes: Quick save

Edit

Back to page

(change "anon" author to blank; trim "created" date; minor manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 16: Line 16:
 
</pre>
 
</pre>
   
With the default leader key, just press <tt>\s</tt> to save any changes to the current file. If the buffer has not been modified since the last save, the file is not written.
+
With the default leader key, just press <code>\s</code> to save any changes to the current file. If the buffer has not been modified since the last save, the file is not written.
   
On many Windows systems, the file mswin.vim is sourced when Vim starts. In that case, Ctrl-S is mapped to <tt>:update</tt>, so the above mapping is not necessary (press Ctrl-S to save).
+
On many Windows systems, the file mswin.vim is sourced when Vim starts. In that case, Ctrl-S is mapped to <code>:update</code>, so the above mapping is not necessary (press Ctrl-S to save).
   
 
==References==
 
==References==

Latest revision as of 05:36, July 13, 2012

Tip 582 Printable Monobook Previous Next

created 2003 · complexity basic · version 5.7


To easily save the current file, while keeping it open, use a mapping in your vimrc:

noremap <Leader>s :update<CR>

With the default leader key, just press \s to save any changes to the current file. If the buffer has not been modified since the last save, the file is not written.

On many Windows systems, the file mswin.vim is sourced when Vim starts. In that case, Ctrl-S is mapped to :update, so the above mapping is not necessary (press Ctrl-S to save).

ReferencesEdit

CommentsEdit

Around Wikia's network

Random Wiki