Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Vimscript foreword


May 24, 2021 Vim



Where this book came from: http://learnvimscriptthehardway.onefloweroneworld.com/

Stupid Methodological Vimscript is intended for users who want to learn how to customize the Vim editor.

This is not a Vim use tutorial. Before reading this book, you should adapt to editing text with Vim and know the meaning of terms such as "buffer," "window" and "insert mode."

The book is roughly divided into three parts:

  • The first part describes some of Vim's basic commands, which allow you to quickly and easily customize your Vim environment by modifying your ~/.vimrc
  • The second part provides insight into Vimscript as a programming language, including variables, comparisons, and functions.
  • The third part of the instance creates a plug-in.

Copyright 2013 Is owned by Steve Losh and may not be published or changed without consent. You can share this book without making any changes and making a profit from it.

This book will always be read online for free.

You can buy an electronic version (PDF, epub, mobi) for $8.

You can buy a paper version for $20.

You can buy a hardcive version for $40.

The source code for this book is available from BitBucket and GitHub. If you make any mistakes or feel that something can be improved, I'm free to submit questions, but I keep the copyright to this book, so I can understand if you're upset.
Program apes prefer to implement their idea.

Idea forms an algorithm, which in turn develops into an algorithm and makes idea come true

As a program ape, we use the text editor to record our idea and implement it for the write program. Full-time program apes spend ten thousandths of their lives dealing with his text editor, and what they do during this time includes:

  • Record their inspiration on your computer
  • Reconsider and modify the mistakes in the inspiration
  • Use code to implement their inspiration
  • Write a document documenting how and why a function is implemented
  • Share this experience with other program apes

Vim is a pretty powerful editor, of course, provided you customize it to your work, preferences, and habits. T his book will introduce you to Vimscript, a scripting language for customizing Vim. After reading this book, you will be able to customize Vim to make it more adaptable to your text editing needs, and you will have a better experience with Vim later.

I'll also mention some points that don't have much to do with Vimscript, but those things usually enhance your understanding of Vimscript. If you use Vim only a little time a day, learning Vimscript doesn't mean much to you, so think carefully and balance your time.

This book is written in a slightly different style than most other programming books. This book will lead you to write commands and see the mysteries behind them, rather than simply telling you how Vimscript works.

Sometimes this book will take you into a dead end before it explains the "right way" to solve the problem. O ther books don't usually do this, or simply mention the techniques after solving the problem. Y et this is not the order in which things are going in the real world. Y ou'll often quickly write some Vimscript snippy code, but you'll run into an unexplained failure. S tudy this book carefully, don't limit it to browsing, after reading again encountered the above problems you will be able to solve smoothly. It's a coincidence!

Each chapter of the book deals with only one subject. E ach chapter is short and informative, so don't skip any chapters. I f you really want to learn from this book, you have to write all the commands. M aybe you're already an experienced program ape, able to quickly read and understand the meaning of the code. But don't take it lightly, learning Vim/Vimscript has a much different experience than other common program languages.

You need to write all the commands

You need to complete all the exercises

Two reasons to explain the importance of the above! F irst, the Vimscript language is an ancient language, and its design inevitably has some shortcomings. A simple configuration item can affect the functionality of the entire script. Write each command encountered in each chapter, complete each exercise, and you'll find it easy to find and fix the problem you're experiencing.

Second, Vimscript is actually the Vim command. I n Vim, save a file using the command :write (or abbreviation :w and return to confirm. I n Vimscript, use write implement file saving. Many of the commands in Vimscript can be used for daily file editing and must be practiced diligently to remember those commands to be useful, but it is not easy to read.

I hope this book will help you. T his book is not a comprehensive guide to Vimscript. This book tries to get you to master Vimscript, to customize your Vim environment, to write simple plug-ins for other users, to be able to read :help to be able to distinguish some common syntax traps.

Good luck!