I'm trying to make it so I can write a buffer to disk with one keystroke.
(Side note: ideally, I'd like this to work in all modes, but for the moment as a start I'm just trying to get it to work in normal mode.)
On the Vim wiki it says...
Vim supports representing control characters using symbolic notation like
<F1>
,<C-W>
,<C-S-F1>
, etc.
And also...
A key with the
Ctrl
key modifier is represented using the<C-key>
notation. For exampleCtrl-R
is represented using<C-R>
. A key with the Shift key modifier is represented using the<S-key>
notation. For exampleShift-F2
is represented using<S-F2>
. A key with theAlt
key modifier is represented using<A-key>
or<M-key>
notation. You can combine one or more key modifiers. For example, to representCtrl+Shift+F3
you can use<C-S-F3>
.
That seems to be saying that if I put this in my .vimrc
it should work...
nnoremap <S-C-k> :w<CR>
But it has no effect. When I reload .vimrc
and press shift+control+K no [File] written
message appears in the bottom area.
I also tried this one but then option+K had no effect either...
nnoremap <M-k> :w<CR>
No error messages.
I'm on OS X.
UPDATE
Ok I just tried this...
inoremap <M-s> Hey whats up
Then when I go into insert mode and press option+S, Vim outputs...
ß
Is OS X intercepting my keystrokes before Vim even receives them? Is that why this isn't working?
If so, is there a way to make it stop doing that other than buying a different computer?
<M>
instead of<S-C>
. I'm not using MacVim. I'm using regular Vim 7.4.1129 installed via MacPorts.:inoremap ß Hey whats up
.<S-C-k>
is three keystrokes. Just sayin'.