1. Trang chủ
  2. » Công Nghệ Thông Tin

Practical vim edit text at the speed of throught

329 115 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 329
Dung lượng 8,06 MB

Nội dung

www.it-ebooks.info www.it-ebooks.info What readers are saying about Practical Vim I’ve learned more about Vim by reading this book than I have from any other resource ➤ Robert Evans Software Engineer, Code Wranglers After reading a couple of chapters of Practical Vim, I realized how little I knew From intermediate to beginner in thirty minutes! ➤ Henrik Nyh Software Engineer Practical Vim continues to change what I believe a text editor can ➤ John P Daigle Developer, ThoughtWorks, Inc Drew has continued the wonderful work he has done with Vimcasts in this book, a must-read for anyone serious about Vim ➤ Anders Janmyr Developer, Jayway Practical Vim bridges the gap between the official documentation and how to really use Vim After reading a few chapters, I switched to using Vim as my default editor I’ve never looked back ➤ Javier Collado QA Automation Engineer, Canonical Ltd www.it-ebooks.info Drew Neil does more than show the right tool for the job He paces the narrative, laying out the philosophy behind each decision Instead of expecting you to memorize everything, Practical Vim teaches you to think with Vim under your fingertips ➤ Mislav Marohnic Consultant I’ve been using Vim for server maintenance for more than fifteen years now, but I’ve only recently started using it for software development I thought I knew Vim, but Practical Vim has massively improved my code-wrangling productivity ➤ Graeme Mathieson Software Engineer, Rubaidh Ltd Practical Vim made me realize how much there is still to learn about Vim Every single tip can be easily and immediately applied to your workflow and will improve your productivity manifold ➤ Mathias Meyer Author, Riak Handbook Practical Vim is the ultimate treasure chest when it comes to Vim knowledge I’ve used Vim daily for over two years now, and this book has been nothing short of a revelation for me ➤ Felix Geisendörfer Cofounder, Transloadit www.it-ebooks.info Practical Vim Edit Text at the Speed of Thought Drew Neil The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina www.it-ebooks.info Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trademarks of The Pragmatic Programmers, LLC Every precaution was taken in the preparation of this book However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com The team that produced this book includes: Kay Keppler (editor) Potomac Indexing, LLC (indexer) Molly McBeath (copyeditor) David J Kelly (typesetter) Janet Furlow (producer) Juliet Benda (rights) Ellie Callahan (support) Copyright © 2012 The Pragmatic Bookshelf All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher Printed in the United States of America ISBN-13: 978-1-934356-98-2 Encoded using the finest acid-free high-entropy binary digits Book version: P1.0—September 2012 www.it-ebooks.info Contents Acknowledgments Foreword Read Me Read the Forgotten Manual xv xi xiii The Vim Way Tip Meet the Dot Command Tip Don’t Repeat Yourself Tip Take One Step Back, Then Three Forward Tip Act, Repeat, Reverse Tip Find and Replace by Hand Tip Meet the Dot Formula xvii 1 11 Part I — Modes Normal Mode Tip Pause with Your Brush Off the Page Tip Chunk Your Undos Tip Compose Repeatable Changes Tip 10 Use Counts to Do Simple Arithmetic Tip 11 Don’t Count If You Can Repeat Tip 12 Combine and Conquer 15 15 16 17 20 22 24 Insert Mode Tip 13 Make Corrections Instantly from Insert Mode Tip 14 Get Back to Normal Mode Tip 15 Paste from a Register Without Leaving Insert Mode Tip 16 Do Back-of-the-Envelope Calculations in Place Tip 17 Insert Unusual Characters by Character Code 27 27 28 29 31 32 www.it-ebooks.info Contents • vi Tip 18 Insert Unusual Characters by Digraph Tip 19 Overwrite Existing Text with Replace Mode 33 34 Visual Mode Tip 20 Grok Visual Mode Tip 21 Define a Visual Selection Tip 22 Repeat Line-Wise Visual Commands Tip 23 Prefer Operators to Visual Commands Where Possible Tip 24 Edit Tabular Data with Visual-Block Mode Tip 25 Change Columns of Text Tip 26 Append After a Ragged Visual Block 37 37 39 41 43 45 47 48 Command-Line Mode Tip 27 Meet Vim’s Command Line Tip 28 Execute a Command on One or More Consecutive Lines Tip 29 Duplicate or Move Lines Using ‘:t’ and ‘:m’ Commands Tip 30 Run Normal Mode Commands Across a Range Tip 31 Repeat the Last Ex Command Tip 32 Tab-Complete Your Ex Commands Tip 33 Insert the Current Word at the Command Prompt Tip 34 Recall Commands from History Tip 35 Run Commands in the Shell 51 51 54 59 61 63 65 66 68 71 Part II — Files Manage Multiple Files Tip 36 Track Open Files with the Buffer List Tip 37 Group Buffers into a Collection with the Argument List Tip 38 Manage Hidden Files Tip 39 Divide Your Workspace into Split Windows Tip 40 Organize Your Window Layouts with Tab Pages Open Files and Save Them to Disk Tip 41 Open a File by Its Filepath Using ‘:edit’ Tip 42 Open a File by Its Filename Using ‘:find’ Tip 43 Explore the File System with netrw Tip 44 Save Files to Nonexistent Directories Tip 45 Save a File as the Super User www.it-ebooks.info 77 77 80 83 85 89 93 93 96 98 101 102 Contents • vii Part III — Getting Around Faster Navigate Inside Files with Motions Tip 46 Keep Your Fingers on the Home Row Tip 47 Distinguish Between Real Lines and Display Lines Tip 48 Move Word-Wise Tip 49 Find by Character Tip 50 Search to Navigate Tip 51 Trace Your Selection with Precision Text Objects Tip 52 Delete Around, or Change Inside Tip 53 Mark Your Place and Snap Back to It Tip 54 Jump Between Matching Parentheses 107 108 110 112 114 118 120 124 126 127 Navigate Between Files with Jumps Tip 55 Traverse the Jump List Tip 56 Traverse the Change List Tip 57 Jump to the Filename Under the Cursor Tip 58 Snap Between Files Using Global Marks 131 131 133 134 137 10 Copy and Paste Tip 59 Delete, Yank, and Put with Vim’s Unnamed Register Tip 60 Grok Vim’s Registers Tip 61 Replace a Visual Selection with a Register Tip 62 Paste from a Register Tip 63 Interact with the System Clipboard 141 141 144 149 151 154 11 Macros Tip 64 Record and Execute a Macro Tip 65 Normalize, Strike, Abort Tip 66 Play Back with a Count Tip 67 Repeat a Change on Contiguous Lines Tip 68 Append Commands to a Macro Tip 69 Act Upon a Collection of Files Tip 70 Evaluate an Iterator to Number Items in a List Tip 71 Edit the Contents of a Macro 157 158 161 163 164 168 169 174 176 Part IV — Registers www.it-ebooks.info Contents • viii Part V — Patterns 12 Matching Patterns and Literals Tip 72 Tune the Case Sensitivity of Search Patterns Tip 73 Use the \v Pattern Switch for Regex Searches Tip 74 Use the \V Literal Switch for Verbatim Searches Tip 75 Use Parentheses to Capture Submatches Tip 76 Stake the Boundaries of a Word Tip 77 Stake the Boundaries of a Match Tip 78 Escape Problem Characters 183 183 184 187 189 190 192 193 13 Search Tip 79 Meet the Search Command Tip 80 Highlight Search Matches Tip 81 Preview the First Match Before Execution Tip 82 Count the Matches for the Current Pattern Tip 83 Offset the Cursor to the End of a Search Match Tip 84 Operate on a Complete Search Match Tip 85 Create Complex Patterns by Iterating upon Search History Tip 86 Search for the Current Visual Selection 199 199 201 202 204 204 206 14 Substitution Tip 87 Meet the Substitute Command Tip 88 Find and Replace Every Match in a File Tip 89 Eyeball Each Substitution Tip 90 Reuse the Last Search Pattern Tip 91 Replace with the Contents of a Register Tip 92 Repeat the Previous Substitute Command Tip 93 Rearrange CSV Fields Using Submatches Tip 94 Perform Arithmetic on the Replacement Tip 95 Swap Two or More Words Tip 96 Find and Replace Across Multiple Files 215 216 217 219 220 222 224 228 229 230 233 15 Global Commands Tip 97 Meet the Global Command Tip 98 Delete Lines Containing a Pattern Tip 99 Collect TODO Items in a Register Tip 100 Alphabetize the Properties of Each Rule in a CSS File 237 237 238 240 242 www.it-ebooks.info 209 212 ... Cofounder, Transloadit www.it-ebooks.info Practical Vim Edit Text at the Speed of Thought Drew Neil The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina www.it-ebooks.info Many of the. .. for this reason that I am excited about the publication of Practical Vim Because now when Vim novices ask me what’s the next step, I know what to tell them After all, Practical Vim even taught... Meet the Search Command Tip 80 Highlight Search Matches Tip 81 Preview the First Match Before Execution Tip 82 Count the Matches for the Current Pattern Tip 83 Offset the Cursor to the End of a

Ngày đăng: 19/04/2019, 14:43

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN