You are previewing Hacking Vim 7.2.

Hacking Vim 7.2

Cover of Hacking Vim 7.2 by Kim Schulz Published by Packt Publishing
  1. Hacking Vim 7.2
    1. Table of Contents
    2. Hacking Vim 7.2
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. New to Vim?
      5. Conventions
      6. Reader feedback
      7. Customer support
    7. 1. Getting Started with Vim
      1. Getting Vim
      2. vi, Vim, and friends
      3. Vim is charityware
      4. Common terminology
      5. Summary
    8. 2. Personalizing Vim
      1. Where are the configuration files?
      2. Changing the fonts
      3. Changing color scheme
      4. A more informative status line
      5. Toggle menu and toolbar
      6. Adding your own menu and toolbar buttons
      7. Modifying tabs
      8. Work area personalization
      9. Summary
    9. 3. Better Navigation
      1. Faster navigation in a file
      2. Faster navigation in Vim help
      3. Search and you will find
      4. X marks the spot
      5. Summary
    10. 4. Production Boosters
      1. Using templates
      2. Using tag lists
      3. Using autocompletion
      4. Using macro recording
      5. Using sessions
      6. Registers and undo branching
      7. Using undo branching
      8. Folding
      9. Open files anywhere
      10. Summary
    11. 5. Advanced Formatting
      1. Formatting text
      2. Formatting code
      3. Using external formatting tools
      4. Summary
    12. 6. Basic Vim Scripting
      1. Syntax-color schemes
      2. Syntax regions
      3. Using scripts
      4. Script development
      5. Summary
    13. 7. Extended Vim Scripting
      1. Script structure
      2. Scripting tips
      3. Debugging Vim scripts
      4. Distributing Vim scripts
      5. Remember the documentation
      6. Using external interpreters
      7. Summary
    14. A. Vim Can Do Everything
      1. Vim games
      2. Programmers IDE
      3. Mail program
      4. Chat with Vim
      5. Using Vim as a Twitter client
    15. B. Vim Configuration Alternatives
      1. Tips for keeping your vimrc file clean
      2. A vimrc setup system
      3. Storing vimrc online
    16. Index
O'Reilly logo

Adding your own menu and toolbar buttons

If you are in Gvim, you can make a handy menu with all the functionality you use the most. You might not always need to use it from the menu, but whenever you forget how to use it, you can always just find it there. If you need to get to the functionality really fast, you can even add it directly in the toolbar of Gvim.

In this recipe, we look at both how to make your own menu and, later, how to add extra buttons to the toolbar in Gvim. Let's start with the menu construction.

Adding a menu

Building a menu is basically just executing a command for each item you want in the menu. As long as you follow the right naming convention, you will see a nice little menu with all your items in it.

Let's start with a simple ...

The best content for your career. Discover unlimited learning on demand for around $1/day.