Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow "W" to save a file #20

Closed
wants to merge 1 commit into from

2 participants

@jgeiger

...kes me retype "w" to save

@Peeja

How would you feel about making a :W command instead of using an abbreviation?

Also, the commit message got messed up. Please stick to the tpope rules; GitHub works best that way:

http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

@Peeja

(If you're not sure how, see :help command for info on making commands.)

@jgeiger

It should really be changed to cnoreabbrev W w

Based on: http://stackoverflow.com/questions/3878692/aliasing-a-command-in-vim

To leave completion untouched try using cnoreabbrev W w, it will replace W in command line with w but only if it is neither followed nor preceded by word character, so :W will be replaced with :w, but :Write won't.

@Peeja

That replaces the word W with w anywhere on the command line. So, for instance, :!echo W now shows w. That seems like the wrong solution; I'm not sure why it beats the :command solution on SO. Am I missing something?

@jgeiger jgeiger closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 14, 2012
  1. @jgeiger

    Typing quickly, I end up hitting "W" a lot which isn't bound and just…

    jgeiger authored
    … makes me retype "w" to save
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  init/keybindings.vim
View
3  init/keybindings.vim
@@ -4,6 +4,9 @@
let mapleader = ","
let maplocalleader = ";"
+" have W write as well for shift being held too long
+cabbrev W write
+
" Make Y consistent with D and C
map Y y$
Something went wrong with that request. Please try again.