I
I
Intelide2016-12-01 21:51:11
linux
Intelide, 2016-12-01 21:51:11

How to quickly save a file in vim?

Good afternoon.
Is it possible to quickly save changes to a file in vim?
in normal editor I press ctrl+s 2 presses
in nano ctrl + o enter
and in vim I have to press esc shift : w enter

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Masterov, 2016-12-01
@AlexMasterov

As an example.

" Ctrl-Enter: force save file
nnoremap <silent> <C-Enter> :<C-u>write!<CR>

" Shift-Enter: force save file when buffer was changed
nnoremap <silent> <S-Enter> :<C-u>update!<CR>

" Ctrl-s: force save file
inoremap <silent> <C-s> <Esc> :write!<CR>i

For the expected operation <C-s>in the terminal, add to the config:
stty start undef
stty stop undef
setopt noflowcontrol

I
Ivan, 2016-12-02
@galbator1x

There is a great autosave plugin.

Plug '907th/vim-auto-save'

let g:auto_save = 1  " enable AutoSave on Vim startup
let g:auto_save_silent = 1  " do not display the auto-save notification
let g:auto_save_events = ["InsertLeave", "TextChanged"]

M
MrKMV34, 2016-12-02
@MrKMV34

Can I have some more
ZZ

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question