Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim save then make automatically?

Tags:

vim

I want to call a command when I save the file. I am calling it by :make manually now, but I wish it could be called when I execute :w and :wq.

I also want enable this feature in any subfolder that doesn't contain a Makefile but its parents contains one. Just like this topic said, but it doesn't works for me:

How to efficiently "make" with Vim

like image 414
guilin 桂林 Avatar asked Sep 17 '10 04:09

guilin 桂林


People also ask

Is AutoSave feature of VI editor?

AutoSave is disabled by default, run :AutoSaveToggle to enable/disable AutoSave. If you want plugin to be always enabled it can be done with g:auto_save option (place 'let g:auto_save = 1' in your . vimrc). Inspired by the same feature in RubyMine text editor.

How do I save progress in vim?

Press Esc key and type :w to save a file in vim. One can press Esc and type :wq to save changes to a file and exit from vim. Another option is to press :x.

When in vim the correct way to write Save changes and quit is?

To save a file in Vim / vi, press Esc key, type :w and hit Enter key. One can save a file and quit vim / Vi by pressing Esc key, type :x and hit Enter key.


2 Answers

:autocmd BufWritePost <buffer> make
like image 199
too much php Avatar answered Oct 11 '22 00:10

too much php


au BufWritePost        *.c
            \ make
like image 40
amphetamachine Avatar answered Oct 10 '22 23:10

amphetamachine