Thursday, May 7, 2015

Edit Vim command lines like an Emacs-using pro

Certain things of the tip type and of the time-saving variety, when applicable to one’s Operating System of Choice, are too useful to forgo in favor of strict allegiance to The Other One True Editor. This I say by way of preface before pointing out how you can make use of (what turn out to be) very helpful Emacs-oriented shortcuts in your own local Vim instance.

It has been pointed out to me—I believe by means of an O’Reilly video series, Mac OS X Productivity Tips for Developers, which features sirs Tim Berglund and Matthew McCullough (I recommend this series, if you are an OS X user)—that certain Emacs-based key bindings involving the moving of cursors are actually built into OS X as it is. The two that I’ve been using most since I realized this are <c-a> (Ctrl+a) and <c-e> (Ctrl+e), which move the cursor to either the beginning (<c-a>) or end (<c-e>) of the text you’ve entered.

You need not be an OS X user to find these useful outside of Emacs, of course. If you’ve switched from The One True Editor to The Other One True Editor, or even if you haven’t but still want to edit command lines in Vim, you may be interested in the following mappings, which are available from :help emacs-keys and which I just discovered recently while perusing tips.txt, as I recommended last time:

" start of line
:cnoremap <c-a>        <home>
" back one character
:cnoremap <c-b>        <left>
" delete character under cursor
:cnoremap <c-d>        <del>
" end of line
:cnoremap <c-e>        <end>
" forward one character
:cnoremap <c-f>        <right>
" recall newer command-line
:cnoremap <c-n>        <down>
" recall previous (older) command-line
:cnoremap <c-p>        <up>
" back one word
:cnoremap <esc><c-b>    <s-left>
" forward one word
:cnoremap <esc><c-f>    <s-right>

That is all taken directly from tips.txt. Quite splendid stuff; I wouldn’t necessarily use all of those, but at least I can now have <c-a> and <c-e> in Vim’s command line, with the others also there in case they should prove useful.


  1. Thanks for sharing this informative blog. Suppose if anyone interested to learn Unix Training in Chennai, Please visit Fita Academy located at Chennai, Velachery. Rated as No.1 Unix Training Institutes in Chennai

  2. thanks for sharing the information.
    Indian Cyber Army’s most awaited internship is live now. Summer Internship 2018 on “ Ethical hacking” and book your seats before it runs out.Candidates have to get themselves registered to be a part of this Internship program. Here internship will give you on-the-job experience, help you learn whether you and Cyber security industry are a good match and can provide you with valuable connections and references. Here interns are usually exposed to a wide variety of tasks and responsibilities which allows the intern to showcase their strengths by working on projects for various managers that work on different parts of Indian Cyber Army. Becoming a high performing intern is a fantastic way to improve your employment prospects. This internship can be a great way to get your foot in the door of success with a prestigious or desirable Organization.As career in ethical hacking is most in demand.

  3. Thanks for the information.It is really nice .Information security is the set of processes that maintain the confidentiality, integrity and availability of business data in its various forms.In this age of Technology advancement, computer and information technology have not only brought convenience to citizens in modern life but also for policemen & various Government officials of the nation to fight cybercrime through various modus operandi. Indian Cyber Army has been dedicated in fighting cyber crime, striving to maintain law and order in cyberspace so as to ensure that everyone remains digitally safe.Read more:- Information Security

  4. thanks for sharing the more valuable information.
    Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses. The training is conducted by subject specialist corporate professionals with wide experience in managing real-time ethical hacking/ cyber security projects. Indian Cyber Army implements a blend of academic learning and practical sessions to give the candidate optimum exposure.Ethical hacking training ,
    Ethical hacking course

  5. Yesterday I came to visit my sister and we decided to have fun and play online casinos, polazili on a bunch of sites and this one caught my eye unforgettable good online casino Here we quickly figured out what was happening and began to think quickly about the strategy. and we found her now we take money out of here every day