I'm trying to get it to be like default text editing in Mac. I tried
map! <D-Left> 0
map! <D-Right> $
in ~/.vimrc, but of course it didn't work. How can i do this?
As far as I know, the Command key modifier syntax (
The Vim instance must be GUI-based because most terminal emulators (Terminal, iTerm, etc.) do not generate control sequences for Command key combinations, so a tty-only instance of Vim has no way to know that a Command key combination was ever pressed (the terminal emulator never sends anything across the tty interface). In fact, Terminal binds ⌘← and ⌘→ (Command-Left and -Right) to cycling through its open windows, so those keys are “already taken” when you are typing in the context of Terminal.
MacVim (when run in GUI mode) does come with functional mappings for (among other Mac-style keystrokes)
I think there have been other GUI-based versions of Vim for Mac OS X, but MacVim seems like the only modern one.
† Roughly, the startup files are processed in this order: