• Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    Ruby
  • Created over 13 years ago
  • Updated over 13 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The beauty of TextMate meets the power of Vim.

TextMateVim - The beauty of TextMate meets the power of Vim

TextMateVim is a plugin for TextMate. It lets you define keystrokes to move about and edit your text files with ease, in the spirit of the Vim command-line editor. If a grizzled Vim hacker and a TextMate-using hipster had children, this is the editor their kids would use.

If you've never used Vim before but you've heard that it's a way to type less to get things done, then this is a great chance to try out the elegant editing model that Vim uses while still being able to leverage OSX's normal text-editing shorcuts.

Installation instructions

You can install the latest release of this plugin by downloading and double-clicking it.

Alternatively, you can install it from source:

  1. Clone this git repo
  2. run rake build from within the git repo (you'll need the XCode Developer tools install for this)
  3. Copy or symlink build/Debug/TextMateVim.bundle into ~/Library/Application\ Support/TextMate/PlugIns/

Basic Vim usage

There are three modes: insert, command, and visual. In insert mode, you can type text as you normally would. Hit <esc> to enter command mode (your cursor will change appearance). In command mode, you can use the keybindings described below to quickly move about the document with very few keystrokes. Type "i" to enter insert mode again.

In visual mode, you can use the command mode shortcuts to select text.

Keyboard bindings

Modifier keys are specified as <C-x>, <M-x>, <A-x> for CTRL+x, META+x, and ALT+x respectively. You can customize all of these.

Switching modes Esc enter Command Mode. i enter Insert mode v enter Visual mode. While in Visual mode, you can select text using the various movement keys and cut/copy it.

Movement h move backward l move forward j move down k move up

b     move backward by one word
w     move forward by one word

0     move to the beginning of the line
$     move to the end of the line

gg    move to the beginning of the document
G     move to the end of the document

<C-d> scroll a half page down
<C-u> scroll a half page up

Cutting, copying and pasting x cut forward dd cut the current line D cut to the end of the line dw cut the next whole word ("d" works with any of the movement modifiers, e.g. "d$" cuts to the end of the current line) yy copy line ("y" works with any of the movements modifiers, e.g. "y0" copies to the beginning of the line)

Tabs J previous_tab K next_tab

Other u undo

TextMateVim supports command repetition so, for example, typing "5j" will move the cursor down by 5 lines.

Create your own key mappings

You can define your own custom keybindings by creating a .textmatevimrc file in your home directory. It's a Ruby file which looks like this:

# In command mode, map "n" to be "move down":
mode(:command) do
  map "n", "move_down"
end

See default_config.rb for lots of hints and examples. Note that shifts are automatically detected: <C-F> is understood to be Ctrl+Shift+f.

Tips

  • Prefer using "u" in command mode instead of CMD+Z to undo your edits. This is because when editing in command mode, TextMateVim saves the cursor position prior to the edit and will restore it when you use "u". TextMate's default undo system does not.

Contributing

Your contributions are welcome.

If there is an inconsistency with Vim that troubles you, feel free to file a bug. Before making deep changes to TextMateVim to emulate some behavior of Vim, file a bug and discuss the proposal on the issue tracker.

When you're done hacking, send a pull request on Github. Feel free to include a change to the credits with your patch.

Read DEVELOPERS.markdown for more information about hacking and debugging TextMateVim. There is a list of some bigger projects on the wiki.

Release notes

0.2 (April 2, 2011)

  • TextMateVim now checks automatically for new versions.
  • Added support for systems running Ruby 1.9.
  • Added y0 and y$ (copy to the beginning or end of line).
  • Tab switching (shift+J and shift+K) now works reliably.
  • Bugfixes.

0.1 (March 24, 2011)

  • Initial release.

License

Copyright (c) 2011 Phil Crosby. Licensed under the MIT license.

Credits

Phil Crosby (twitter @philcrosby)
Kevin Fitzpatrick (who wrote VimMate, which inspired TextMateVim).

More Repositories

1

vimium

The hacker's browser.
JavaScript
23,206
star
2

sheetkeys

A browser extension which adds Vim-style shortcuts to Google Sheets
JavaScript
253
star
3

shoulda.js

Concise JavaScript unit testing.
JavaScript
86
star
4

fuzzycd

Glide across your filesystem with ease.
Ruby
40
star
5

terraform

Set up a cold, inhospitable system using Terraform.
Ruby
23
star
6

emacs-config

My Emacs setup.
Emacs Lisp
18
star
7

watchman

A host-your-own HTTP checking and pinging web service, to serve as an alternative to Pingdom.
Clojure
17
star
8

InstallPad

Download the latest versions of software and deploy it to Windows with a click.
C#
16
star
9

gumshoedb

A high performance in-memory OLAP database.
Go
14
star
10

backtrace_shortener

Friendly Ruby backtraces.
Ruby
8
star
11

clj-maxmind-geoip

A thin wrapper around Maxmind's GeoIP Java API.
Clojure
8
star
12

vim-config

My vim config.
Vim Script
5
star
13

hammerspoon-config

Lua
5
star
14

http_resque

Schedule and test Resque jobs using HTTP requests.
Ruby
4
star
15

omnislice

Ruby
3
star
16

graphics-design.com

The contents of my 1999 website, graphics-design.com
HTML
2
star
17

InkForWord

A 2006 tablet PC addin for Microsoft Word
C#
2
star
18

jjot-static-website

Static version of jjot.com, circa 2008.
JavaScript
2
star
19

homebrew-omnislice

Ruby
1
star
20

salamander

Massively multiplayer snake hackathon project for the 2011 Node Knockout
JavaScript
1
star
21

philc.github.com

Personal homepage.
HTML
1
star
22

gnomewotdapplet

A circa-2004 Word of the Day applet for the GNOME desktop
C#
1
star
23

phoenix-config

My configuration for the Phoenix window manager
JavaScript
1
star
24

crumbtrail.net

A web analytics service side-project circa 2007, similar to Google Analytics
JavaScript
1
star