Is it possible to map to save in vim in a standard terminal? I know how to set it in my vimrc but am not sure if it is possible to pass it from terminal to vim instead of attempting to save the terminal.
Bind in Vim
terminal
Related Question
- Mac – Saving files on lost focus in console Vim
- Mac – Sharing mac clipboard with vim inside terminal
- Use Cmd as Ctrl key in vim
- MacOS – VIM in Terminal using Solarized Theme
- MacOS – Vi for Mac OS, differences with Vim
- MacOS – Setting Terminal tab names in OS X and using vim
- Launch terminal program from macOS app
Best Answer
Yes you should be able to set up a key mapping in your .vimrc file so that when you press command - S it maps to :w Also here is something else to go on that you can modify as well Map Ctrl-S to save current or new files
For example, you will want to add in a new Application Short cut for the Terminal app, then map to the Menu title "Export Text As..." to another keyboard command something that you don't use, e.g. control - s or etc. should be fine.
Next stop mac terminal from trying to interpret Cmd-s by ... (still working on this I asked a separate question for a solution Allow the Terminal.app to pass command key based keystrokes to terminal programs )
Set up the mapping in the .vimrc file to map the command or meta and s keys to the :write function.
Something such as this noted below* you can add to you .vimrc:
*This was verified working on the X11 terminal on OS X Lion.