I have a Macbook. I want to save files by pressing command + s (this should happen if it is in insert mode or not, and I want it to go to non-insert mode after it is saved).

How do I do this?

Thanks in advance! :)

  • 1
    Is this on vim on the terminal (also like iTerm2 etc.) or on MacVim? On terminal, you can't tell whether "command" key was pressed AFAICT, so I don't know if you can really get this done on terminal vim... – filbranden Feb 13 '19 at 6:54
  • 1
    If it's on MacVim, you can use <D-s> for Cmd+s in mappings (see stackoverflow.com/q/11979313/9447571) – filbranden Feb 13 '19 at 6:56
  • 1
    Note iTerm uses cmd+s for Save Selected Text... to a txt file. Similarly, Terminal.app has mapped it to Export Text As.... So you have to free the mapping first. This is actually not a question for vi.stackexchange.com. – Hotschke Feb 13 '19 at 7:45
  • 1
    see also superuser.com/questions/387897/…. I am not sure whether all answers can be recommended. Answer by romainl is probably not what you want to hear but should be considered. If you want to use bindings like cmd+s for the transition to vim, I'd recommend to use macvim for the beginning. In the long run you should get used to :w, ZZ and similar. – Hotschke Feb 13 '19 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.