Your First Vim Plugin
These are the notes and samples from my August 2014 Vim talk, 'Your First Vim Plugin'. Their official home is this repo. You can also view a recording of the talk.
Samples
The Simple Path to Your First Plugin
- Know how to edit, save, and source your vimrc
- Capture normal mode actions, repeat with
:normal
- Wrap
:normal
call in a named function 1a. Poke around in the REPL / command line 1b. Add ehcom debug statements, use:messages
to review 1c. Temporarily export to global var - Wrap it up
- script local your function
- create a command
- package it up!
What Can You do with Vim Plugins?
Custom Text Objects
Not mine, but still great!
- text-obj-indent - Indenation text object
- ruby-block - Ruby method, class, and block text objects
Operators
- titlecase - Titlecase based on a motion
- sort-motion - Sort lines or arguments, based on a vim motion
System Integration
- tmux nav - Navigate seamlessly between vim and tmux splits
- tmux runner - Send commands from Vim to adjacent tmux panes
Raw Efficiency
- spec-runner - Efficient spec running from withing vim
- rfactory - Rails.vim inspired navigation commands for FactoryGirl
- conflicted - Powerful git merge/rebase conflict resolution
- quicklink - Insert links
Pro Tips
- Symlink in your local copies
- TDD Vimscript
- ':h functions'
- system()
echom
and:messages
for debugging- learn-vimsript-the-hard-way