Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1008873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:50:17+00:00 2026-05-16T08:50:17+00:00

I have these Vim mappings for Git. Most of the commands below work, but

  • 0

I have these Vim mappings for Git. Most of the commands below work, but the last one, gm, doesn’t work at all. I want to open a new Vim (preferrably with my git commit message template already loaded, as per the default terminal behavior), edit and save my message, then commit.

Any ideas for another way to approach this?

" git shortcuts
"" show diff in new window
if has("gui_running")
  noremap gd :!git diff <BAR> gvim -<CR><CR>
else
  noremap gd :!git diff <BAR> vim -<CR><CR>
endif
noremap gs :!git status<CR>
noremap ga :!git add %<CR>
"" edit commit message in new window
if has("gui_running")
  noremap gm :!gvim __vim_gitcommitmessage && git commit -F __vim_gitcommitmessage && rm __vim_gitcommitmessage<CR>
else
  noremap gm :!vim __vim_gitcommitmessage && git commit -F __vim_gitcommitmessage && rm __vim_gitcommitmessage<CR>
endif

Update:

As per VonC’s suggestion, I am now using fugitive.vim. I replaced my previous Vim bindings, and would recommend this plugin to anyone who uses Vim and Git.

" fugitive shortcuts
noremap ggs :Gstatus<cr>
noremap ggc :Gcommit<cr>
noremap gga :Gwrite<cr>
noremap ggl :Glog<cr>
noremap ggd :Gdiff<cr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:50:17+00:00Added an answer on May 16, 2026 at 8:50 am

    Vim has some Git wrapper scripts which encapsulates common Git commands, and allows committing through a temporary buffer:

    One that could fit the bill would be fugitive.vim: see its doc:

    :MinSCMCommitTracked[!]         (Default mapping: \s<C-c>)
    

    Opens temporary buffer for you to enter commit message. Write the commit buffer and all tracked files are committed.

                Used SCM commands ~
                hg  : commit
                git : commit -a
                bzr : commit
    
    :MinSCMCommitAll[!]             (Default mapping: \sc)
    

    Opens temporary buffer for you to enter commit message. Write the commit buffer and all files in a working directory of a current repository are committed.

    This command is different from |:MinSCMCommitTracked| in adding untracked files to the current repository.

                Used SCM commands ~
                hg  : commit -A
                git : add -a && commit -a
                bzr : add && commit
    

    The source being available, you could reuse the part you need in your own Vim script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple vim script that takes a visual block of text and
I have visited Vim website , script section and found several synthax checkers for
I have a bunch of files that I need to look at. All lines
I use Vim and GIT to develop my project on a Linux/Ubuntu machine. In
I'm planning to send emails from inside of VIM via SendEmail , but I
So, I've just installed the zen-coding.vim plugin and expansions aren't happening. The plugin is
Is there a way to unmap mappings set by plugins? I'm currently calling exe
If you are editing a file in Vim and then you need to open
Considering that I'll be using Vim as my text editor of choice, what tools
I usually edit my files in gVim when developing. Sometimes I need to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.