惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
G
Google Developers Blog
A
About on SuperTechFans
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
博客园 - 聂微东
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
V
Visual Studio Blog
美团技术团队
The Cloudflare Blog
量子位
T
The Blog of Author Tim Ferriss
罗磊的独立博客
V
V2EX
S
SegmentFault 最新的问题
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MyScale Blog
MyScale Blog
博客园 - Franky

Stonecharioteer on Tech

I Traced My Traffic Through a Home Tailscale Exit Node What Was I Reading Last? In Three Not-So-Easy Pieces Dogfooding Is Hard Code blocks in your books, finally GoForGo v0.9.0 Merrilin - We built an app to read books I use a Macbook now Data Structures & Algorithms - Preparing for Interviews Using a local DNS namespace for local service discovery Direction KOllector - Publishing KOReader Highlights gbt: branches touched in the last 24 hours A Soiree into Symbols in Ruby Some Smalltalk about Ruby Loops Ruby Blocks Returning from Ruby Blocks, Procs and Lambdas My Linux Laptop Finally Works: How Claude Helped Me Fix Years of Annoyances TIL: Watchexec - Modern File Watching for Development Workflows A Less Busy Mind GoForGo - Learn Go through live examples Migrating My Old Blog to Hugo with Claude The Qtile Window Manager: A Python-Powered Tiling Experience Read the RFCs that Built the Internet Py-x-Protobuf - Or How I Learned to Stop Worrying and Love Protocol Buffers Python Reverse a List New Beginnings Leaving ChainSafe Systems Screen Lock for Cinnamon Desktop using Zenity and Terminal Commands Crews Not Teams A System for Getting Better at LeetCode
TIL: Most Productive Vim Shortcuts and Techniques
2021-01-21 · via Stonecharioteer on Tech

Vim Productivity Techniques

Most Productive Vim Shortcuts Discussion

Essential Vim Productivity Shortcuts

Text Objects and Motion

  • ci" (Change Inside Quotes): Change text within quotes
  • da{ (Delete Around Braces): Delete including surrounding braces
  • yiw (Yank Inner Word): Copy current word
  • vip (Visual Inner Paragraph): Select entire paragraph
  • gqip (Format Inner Paragraph): Format paragraph text

Advanced Navigation

  • * and #: Search for word under cursor (forward/backward)
  • %: Jump between matching brackets/parentheses
  • gd: Go to definition of variable under cursor
  • Ctrl-o / Ctrl-i: Navigate back/forward through jump history
  • m{a-z}: Set marks, '{a-z} to jump to marks

Powerful Editing Commands

  • =: Auto-indent selected text or motion
  • gU / gu: Convert to uppercase/lowercase
  • > / <: Indent/unindent selected text
  • .: Repeat last command (extremely powerful)
  • q{a-z} / @{a-z}: Record and replay macros

Search and Replace

  • / and ?: Forward and backward search
  • n / N: Next/previous search result
  • :s/old/new/g: Substitute in current line
  • :%s/old/new/gc: Global search and replace with confirmation
  • :g/pattern/command: Execute command on lines matching pattern

Advanced Techniques

Buffer and Window Management

  • :ls: List all buffers
  • Ctrl-w commands: Window management (split, resize, navigate)
  • :b{number} or :b{name}: Switch to specific buffer
  • Ctrl-^: Switch between current and previous buffer

Command Line Efficiency

  • q:: Open command history in editable buffer
  • Ctrl-r: Insert register contents in command mode
  • !!: Repeat last shell command
  • :r !command: Insert output of shell command

Visual Mode Power

  • gv: Reselect last visual selection
  • o: Move to other end of visual selection
  • Ctrl-v: Column/block visual mode
  • I / A in visual block: Insert at beginning/end of each line

Vim Philosophy and Mindset

Composability

  • Operators + Text Objects: Commands combine (d + iw = delete inner word)
  • Counts: Numbers multiply actions (3dd = delete 3 lines)
  • Ranges: Apply commands to line ranges (10,20s/old/new/g)

Efficiency Principles

  • Minimize Keystrokes: Learn the shortest path to accomplish tasks
  • Muscle Memory: Practice common operations until they’re automatic
  • Modal Editing: Leverage different modes for different tasks
  • Text Objects: Think in terms of words, sentences, paragraphs, not characters

Learning Progression

  • Basic Navigation: Start with hjkl, basic editing
  • Text Objects: Learn word, sentence, paragraph operations
  • Advanced Motion: Search, marks, jumps
  • Customization: Adapt Vim to your specific workflow

Key Takeaways

  • Community Knowledge: Stack Overflow discussions provide real-world expertise
  • Incremental Learning: Master a few shortcuts at a time rather than trying to learn everything
  • Practice: Consistent use builds muscle memory and efficiency
  • Composability: Understanding how Vim commands combine multiplies productivity
  • Personal Optimization: Different workflows benefit from different shortcut priorities
  • Long-term Investment: Time spent learning Vim pays dividends over years of use

Vim’s power comes not from memorizing hundreds of shortcuts, but from understanding its compositional nature and developing muscle memory for the most common operations in your specific workflow.