• Stars
    star
    182
  • Rank 211,154 (Top 5 %)
  • Language
    Vim Script
  • Created about 13 years ago
  • Updated almost 11 years ago

Reviews

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

Repository Details

Ruby/Rails centric vimfiles with support for Git, RVM and more.

Ruby/Rails centric vimfiles and installer

With a great colour scheme and support for auto-complete, git, rvm and sparkup.

Requirements

Vim 7.3 or better Tested on MacOS and Linux

Introduction to Vim: http://blog.interlinked.org/tutorials/vim_tutorial.html

Quick Install

curl https://raw.github.com/krisleech/vimfiles/master/bootstrap.sh -o - | sh

Basic Mappings

The leader is mapped to ,

In Normal mode (Esc or jj)

,p - File browser (NerdTree)

,f - Find in Files (Command-t)

Space - Search in buffer

,a - Search in files (Ack)

,b - Search open buffers (Fuzzy Finder)

,d - close buffer

,D - close all buffers

,Space - Remove search highlighting

,t - Show tags

// - Toggle comments (T-Comment)

F5 - Undo history (GUndo)

F6 - Auto format

Tab - Next buffer

Shift + Tab - Previous buffer

,, - Toggle between last two buffers

,m - Jump to model

,v - Jump to view

,gm - Find in app/models

,gc - Find in app/controller

,gv - Find in app/views

,gr - Open routes in split

,gg - Open Gemfile in split

,vir - Visual select inner Ruby block

,var - Visual select around Ruby block

In Insert mode (i)

jj - Back to normal mode

<tab> - auto complete or expand snippet

See .vimrc for more.

Plugins

rails

Lots of stuff - get to know this plugin!

:Rmodel - jump to model

:Rview - jump to view

:help rails

coffee-script

CoffeeScript support

:CoffeeCompile watch show compiled js in split

https://github.com/kchmck/vim-coffee-script

ruby-block

Provides text-objects for Ruby blocks

var (visual around Ruby)

vir (visual inner Ruby)

ar / ir (expand/contract selection)

cir (change inner Ruby)

dar (delete around Ruby)

http://vimcasts.org/blog/2010/12/a-text-object-for-ruby-blocks/

sparkup (ctrl+e)

Expand CSS selectors div.event in to markup <div class='event'></div>

http://net.tutsplus.com/articles/general/quick-tip-even-quicker-markup-with-sparkup/

fugitive

Git integration

Lots of stuff

:Gstatus and press - to stage file

http://vimcasts.org/episodes/fugitive-vim---a-complement-to-command-line-git/

:help fugitive

rvm

Add RVM integration

command-t (,f)

Find files in your project with minimal keypresses

For example conadus would find controllers/admin/users

,f path_or_filename

,gf path_or_filename - restrict to files in current directory

Ctrl + n - next result

Ctrl + p - previous result

Ctrl + c - cancel

snipmate (TAB)

Snippets, press TAB to expand

Examples (in a Ruby file):

def<tab>

.each<tab>

.eado<tab>

ife<tab>

gist (:Gist)

Gist current file/selection

Requires setting GITHUB_TOKEN and GITHUB_USER Env's

gundo (F5)

Navigate changes history tree

http://vimcasts.org/episodes/undo-branching-and-gundo-vim/

tabular

Align stuff

http://vimcasts.org/episodes/aligning-text-with-tabular-vim/

conque

Terminal/Interactive programs

:Conque zsh

:Conque ls

Note you can also drop back to the terminal using Ctrl+Z, to get back to Vim with %1. This is not a feature of Conque.

tcomment (//)

Comment/Uncomment stuff out

yankring

Shows history of yanked (copied) text

Pressing ctrl + p will also cycle through paste history

ack (,a)

Search project for text (aka find in files)

,a word

,a "some words"

nerdtree (,p)

Project file browser

,p opens file browser

o / x open and close files/folders

m menu to move/delete/copy files/folders

? Help

I use nerdtree for creating or moving files, but find command-t quicker for opening files.

surround (ys/cs/ds)

Allows adding/removing/changing of surroundings

I would highly recommend getting to know this plugin, it is very useful. Especially when you grok text objects.

Characters

ysiw) - surround inner word with ()

ysiw( - surround inner word with ( )

In the above example iw can be replaced with any text object or motion.

If you find yourself manually adding surroundings, stop and work out the correct text object or motion.

cs"' - change surrounding from " to '

ds - delete surrounding

Tags

yss<p> - surround line in <p> tags

cst<div> - change surround tag to <div>

solarized

A colour scheme, both light and dark version

:set background=dark

:set background=light

fuzzyfinder (,b)

Find open buffer by path/filename

taglist (,l)

Lists method names, provide auto complete

,rt Generates Ruby tags, this will include tags for your code and gems if using RVM.

If you are not using RVM you can run ctags -R in project root to generate tags.

Or to run directly from within vim :!ctags -R.

Ctrl+] - skips to the tag under the cursor

preview (,P)

Preview markup files such as Markdown and RDoc

Each format requires the relevant gem to be installed such as bluecloth for Markdown and github-markup for RDoc.

syntastic

Syntax checking

When a file is saved the syntax is automatically checked and any errors reported.

vundle

Plugin manager and part of the reason why my vimfiles as so compact

INSTALLATION

Note: If you are using RVM make sure you use system ruby before installation.

rvm use system

Note: If you already have Vim installed ensure it has support for Ruby:

vim --version | grep ruby

You should see +ruby, if you see -ruby you need to reinstall Vim with Ruby support

Install Vim (if not already installed)

MacOS: MacVim / Vim

brew install macvim --override-system-vim --enable-clipboard

Add /usr/local/bin before /usr/bin in your $PATH so you use the version of vim installed by Homebrew, not the one that comes with MacOS.

By installing Vim in this way MacVim and regular Vim are exactly the same.

Ubuntu: gVim / Vim

Server

apt-get install vim-nox

Desktop

apt-get install vim-gnome

GNU/Linux from source

If you have an old GNU/Linux distro which does not have Vim 7.3 or better in its repos then install from source.

The configure options below leave out any GUI related features as I have only compiled Vim on a server.

Vim source is in a hg (Mercurial) repository so you need to install the hg client first, e.g. sudo apt-get install mercurial.

hg clone https://vim.googlecode.com/hg/ vim
cd vim/vim73
./configure
./configure --with-features=huge --enable-cscope --enable-pythoninterp --enable-rubyinterp --enable-perlinterp --enable-multibyte
make
sudo make install

This installs Vim to /usr/local/bin, check this is in your $PATH before /usr/bin which may contain an older system version of Vim.

If you get an error no terminal library found install libncurses5-dev.

Install these vimfiles

Note: You will already have a ~/.vim folder, either delete or move it.

mv ~/.vim ~/.vim.old
git clone https://github.com/krisleech/vimfiles ~/.vim
cd ~/.vim
rake install

or run:

curl https://raw.github.com/krisleech/vimfiles/master/bootstrap.sh -o - | sh

To update to the latest vimfiles

cd ~/.vim
rake update

Install Dependacies

MacOS

brew install ack
brew install ctags

Note: MacOS comes with the BSD version of ctags which is not compatible.

Ubuntu

sudo apt-get install exuberant-ctags
sudo apt-get install ack-grep
sudo ln -s /usr/bin/ack-grep /usr/local/bin/ack

Helpful Stuff

Acknowledgments

More Repositories

1

wisper

A micro library providing Ruby objects with Publish-Subscribe capabilities
Ruby
3,266
star
2

wisper-activerecord

Transparently publish all model changes to subscribers
Ruby
100
star
3

wisper-sidekiq

Asynchronous event publishing for Wisper using Sidekiq
Ruby
82
star
4

wisper-rspec

RSpec matchers and stubbing for Wisper
Ruby
61
star
5

not_found

Allows you to rescue ActiveRecord::RecordNotFound for a specific model
Ruby
60
star
6

chalk_dust

Subscriptions connect models, events build activity feeds.
Ruby
47
star
7

wisper-activejob

Provides asynchronous event publishing to Wisper using ActiveJob
Ruby
36
star
8

evented

Publish and Subscribe for Crystal objects
Crystal
34
star
9

wisper-async

Async broadcasting for Wisper
Ruby
34
star
10

wisper-celluloid

Provides async event broadcasting to Wisper using Celluloid
Ruby
17
star
11

turbo-vim

Vim with support for Tmux, Ruby/Rails, Rspec, Git and RVM.
Vim Script
12
star
12

tmuxinator

Generate tmux configurations for your projects
Ruby
11
star
13

medicine

Simple dependency injection for Ruby objects
Ruby
7
star
14

jQuery-Character-Counter

Count and Limit the number of characters in a <textarea>
JavaScript
6
star
15

neovim-config

My NeoVIM configuration
Vim Script
5
star
16

Git-Web

A web interface for Git Repositories
Ruby
4
star
17

wisper-message_bus

Relay Wisper events as JSON to other processes via MessageBus
Ruby
4
star
18

axe

A small stream processing framework for routing Kafka topics to parallelised Ruby objects.
Ruby
4
star
19

seeds

Generate seeds.rb file from existing database tables
Ruby
4
star
20

wisper-attributes

Transparently publish attribute changes to subscribers
Ruby
4
star
21

wisper-testing

Helpers for testing Wisper publisher/subscribers.
Ruby
4
star
22

Install-Gems

Install gems listed in a text file generated by 'gem list'. Useful after doing a clean OS install.
3
star
23

conduit

An event store for Ruby
Ruby
3
star
24

vim_switcher

Switch between multiple vimfiles
Ruby
3
star
25

ma

Event Driven Ruby [MIRROR]
Ruby
3
star
26

Reinstall-Gems

Reinstall all your gems which have C extensions, useful for upgrading to 64 bit, ie. Mac 10.6 Snow Leopard
3
star
27

wisper-visualize

Visualizations for Wisper events
Ruby
3
star
28

wisper-rabbitmq

Relay Wisper events to RabbitMQ
Ruby
2
star
29

spec_requirer

Explicitly require files and manage LOAD_PATH in tests which do not boot a framework
Ruby
2
star
30

wisper_next

The next version of Wisper [MIRROR]
Ruby
2
star
31

backup_data

Engine style plugin which offers backup of database and files
Ruby
2
star
32

harbour

Terminate process listening on a port
Ruby
2
star
33

skeletor

A starting point for a Rails app which uses qcore and qcms gems
JavaScript
2
star
34

Persistent-Hash

Simple example used to teach several Ruby coding techniques
Ruby
2
star
35

wisper-relay

Relay wisper events to the outside world, for example a message queue.
Ruby
2
star
36

pipes

Toy app using pipes to communicate between two processes.
Shell
2
star
37

qwerty

This is a work in progress
Ruby
2
star
38

rake-deploy

Automated deploy and backup for Rails Application
1
star
39

qcms

Qwerty CMS (Rails Engine distributed as a Gem)
Ruby
1
star
40

Pushy

Demonstrates the use of long lived HTTP connections to allow the server (Sinatra) to *push* data to the client (JQuery)
JavaScript
1
star
41

wisper-presentation

Presentation about Wisper gem using Vim
Vim Script
1
star
42

qcore

Qwerty Core - authorisation and authentication in a Rails engine in a Gem
Ruby
1
star
43

detachment

Transparent Sub / Pub broker for Ruby objects
Ruby
1
star
44

s_and_c

One letter aliases for Rails Server and Console
Ruby
1
star
45

domain3

Service, Form and Validator objects.
Ruby
1
star
46

polymorphia

Associate any ActiveRecord object to another
Ruby
1
star
47

wisper-bubble

Event bubbling for Wisper
Ruby
1
star
48

Git-By-Proxy

Simple rake tasks to rope in a graphic designer who doesn't want to use version control and (S)FTP's stuff up to the server instead.
1
star
49

pomodoro

Promodoro timer in your shell
Ruby
1
star
50

WebbyGen

Generate skeleton directory structure plus files for a Webby site
1
star
51

scnsht

Take screenshot (selection), copy to Dropbox public folder, copy URL to clipboard
Shell
1
star
52

rails-stack

Rails stack for solo server using Sprinkle
Ruby
1
star
53

jukebox

Jukebox service
Ruby
1
star
54

QwertyChef

Chef Solo Provisioning for Rails
Ruby
1
star
55

Path-Finder

A Rails plugin which extends ActiveRecord to allow self-referential models (eg. acts_as_tree) to maintain a textual path representing itself and its ancestors.
Ruby
1
star