2

I have been using MacVim & have gotten used to it but my main development computers are all Linux(Ubuntu)

I'd like MacVim like shortcuts and behavior

I know you can get windows like behavior like so

source $VIMRUNTIME/mswin.vim behave mswin 

how can I get Mac like behavior in GVIM on ubuntu?

1

1 Answer 1

4

I use MacVim on Mac OS X at work, GVim on Linux at home and CLI Vim everywhere. What do you call "MacVim like shortcuts and behavior"?

Do you mean "standard OS-wide shortcuts" like Cmd+O or Cmd+V or Shift+light/left arrow? I don't know of any features MacVim has that GVim hasn't beside a very elegant and impressive level of OS integration.

Shortcuts that use the Cmd key are obviously not supported because there is no Cmd key on a typical PC keyboard. If you really want to have them you will need to explicitly add them to your ~/.gvimrc with another modifier key. Shift+right/left arrow and other basic Mac OS X text-editing shortcuts must also be explicitly added to your ~/.gvimrc. You'll quickly find limitations in this strategy.

Hell, GVim doesn't even really support Gnome's own default shortcuts anyway.

That's the wrong approach.

Vim's own commands, motions, text-objects and the grammar that ties them are a lot more efficient and portable. You should focus on that instead.

  • Cmd+O = :e <Tab>
  • Cmd+right arrow = $ for positioning the cursor or A to insert text
  • Cmd+left arrow = ^ or 0 (0 is "first column', ^ is "first printable character") for positioning the cursor or I to insert text
  • Alt+right arrow = e or E or w or W
  • Alt+left arrow = b or B
  • Shift+right arrow = v$
  • Shift+left arrow = v^
  • Shift+Alt+right arrow = ve then eee as many times as necessary or v2e

and so on…

Like I've said before, read :help motion.txt, it will blow your mind.

Sign up to request clarification or add additional context in comments.

2 Comments

I meant like the hotkeys, cmd key was my windows key.
What are "hotkeys"? <D-...> works only in MacVim on Mac OS X: it doesn't mean anything to Vim outside of this context and the "Windows/Super" key is not even registered by GVim on Linux. That's two possible modifiers out: time to reconsider your idea.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.