Tip #294: Use Ctrl-S to save current or new files.
tip karma |
Rating 15/10, Viewed by 939
|
created: |
|
July 30, 2002 12:37 |
|
complexity: |
|
basic |
author: |
|
Thomas R. Kimpton |
|
as of Vim: |
|
5.7 |
I wanted to have a single key stroke that would save existing files, or call the file browser.
Here's a key map for Ctrl-S to accomplish that (place in vimrc file):
if has("gui_running")
" If the current buffer has never been saved, it will have no name,
" call the file browser to save it, otherwise just save it.
:map <silent> <C-S> :if expand("%") == ""<CR>:browse confirm w<CR>:else<CR>:confirm w<CR>:endif<CR>
endif
Tom Kimpton
<<remember where you had ended reading help |
Line/word/file/whatever completion >>
Additional Notes
|