• Stars
    star
    266
  • Rank 154,103 (Top 4 %)
  • Language
    Vim Script
  • Created about 13 years ago
  • Updated over 5 years ago

Reviews

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

Repository Details

vim configuration – Ruby, Rails, Markdown, SCSS, CoffeeScript

Mislav's vim configuration

Thanks to these guys:

My configuration uses Pathogen and git submodules. (But you don't need to care about any of that.)

Installation:

Prerequisites: ruby, git.

  1. Move your existing configuration somewhere else:
    mv ~/.vim* ~/.gvim* my_backup
  2. Clone this repo into ".vim":
    git clone https://github.com/mislav/vimfiles ~/.vim
  3. Go into ".vim" and run "rake":
    cd ~/.vim && rake

This will install "/.vimrc" and "/.gvimrc" symlinks that point to files inside the ".vim" directory.

Features:

vimrc

  • 2 spaces, no tabs

  • incremental, case-insensitive search

  • vertical split goes right, horizontal split goes below

  • cursor keys for movement are disabled!

  • <CR> - remove highlighting after search

  • <Space> - toggle current fold

  • <C-j/k/h/l> - switch between splits (no need to prepend <C-w>)

  • Q - format lines

  • :KillWhitespace - strip trailing whitespace

File switching (Command-T)

  • ,, alternates between two most recent buffers
  • ,f - jump to file:
    • ,F - search in directory of current buffer
    • ,b - search buffer list
    • ,gl - search in lib/
    • ,gt - search tags
    • <C-s>,<C-CR> - open the selected file in a new split window
    • <C-v> - open the selected file in a new vertical split window
    • <C-t> - open the selected file in a new tab
    • <C-j> - select next file in the file listing
    • <C-k> - select previous file in the file listing
    • <C-f> - flush file cache

Ack

  • :Ack -w foo_bar
  • :Ack! - search, but don't jump to first match
  • :AckFromSearch
  • :AckAdd - append to existing quickfix list

In the quickfix window:

  • o - open file
  • go - preview file, i.e. keep focus in quickfix window
  • t (T) - open in a new tab (silently)
  • h (H) - open in horizontal split (silently)
  • v (gv) - open in vertical split (silently)

In the normal buffer:

  • :cn[ext]/:cN/:cp[revious] - jump to the next/previous match
  • ]q/[q - same as above, with Unimpaired
  • :ccl - close the quickfix window
  • :col[der]/:cnew[er] - show results of previous/next search

Surround

  • cs"' - change string from double to single quotes
  • ds( - delete surrounding parentheses
  • ysiW] - surround current WORD with square brackets
  • ysst - surround current line in a HTML tag
  • ysip<c-t> - nest current paragraph in a HTML tag

Visual mode: S. Insert mode: <c-s>.

Surround + rails.vim:

  • - β†’ <% -%>
  • = β†’ <%= %>
  • # β†’ <%# %>
  • e - nest block and append end keyword
  • E - like e, but prompt for text to prepend before block

Argumentative

  • [,/], - go to previous/next argument boundary
  • <,/>, - shift current argument left/right
  • a,/i, - "an argument"/"inner argument" text object

Commentary

  • gc{motion} - comment/uncomment lines that {motion} moves over
  • gcc - comment/uncomment [count] lines
  • {Visual}gc - comment/uncomment the highlighted lines
  • gcu - uncomment the current and adjacent commented lines

ruby.vim

Motions:

  • ]m / [m - next / previous method
  • ]M / [M - end of method definition
  • ]] / [[ - next / previous class/module
  • ][ / [] - end of class/module

Text objects:

  • am - a method
  • im - inner method
  • aM - a class
  • iM - inner class

CoffeeScript

  • :[range]CoffeeCompile [vert] - compile JavaScript into new buffer
  • :CoffeeCompile watch [vert] - open auto-updating JavaScript buffer
  • :[range]CoffeeLint (needs coffeelint)
  • :[range]CoffeeRun - run the resulting JavaScript

matchit.vim

% alternates between matching HTML tags, class/control flow statements and matching end in Ruby, and more. Also works in visual mode.

Tabular

In visual mode:

  • :Tabularize assignment
  • :Tabularize argument_list
  • :Tabularize /=>

Fugitive

  • :Gcommit

  • :Gstatus

    • jump between lines that represent files with <c-n>, <c-p>
    • - - add/reset file (also in visual mode)
    • <Enter> - open current file in the window below
    • o/S - :Gsplit/:Gvsplit
    • p - add/reset current file with --patch
    • D - :Gdiff
    • c[v]c - :Gcommit [--verbose]
    • ca/cA - --append / reuse message
  • :[range]Gbrowse! - - copy GitHub URL for code that's currently selected

  • :[range]Gblame

    • q/gq - close blame and return to blamed window / work tree version
    • <CR> - q, then open commit
    • o/O - open commit in horizontal split / new tab
    • - - reblame at commit
    • P - reblame at parent commit
  • :Gedit feature:% - version of the current file in the "feature" branch

  • :Gwrite - add %

  • :Gread - checkout % (also the bailout command after browsing git objects)

  • :Gremove - rm %

  • :Gmove <dest> - mv % <dest>

  • :Glog - load past versions of current file into the quickfix list

  • :Glog -- - load all commits into the quickfix list

  • :Glog -- % - load only commits that touch the current file

  • :Glog --grep={text} -- - only commits that have "text" in the message

  • :Glog -S{text} -- - only commits that have "text" in the diff

  • :Ggrep {pattern} [branch]

In git objects:

  • <Enter> - jump to revision under cursor
  • o/S/O - jump to revision in a new split / vertical split / tab

In vimdiff view:

  • [c/]c - previous/next changeset
  • :dp/:do - :diffput/:diffget - stage/checkout hunk
  • :Gwrite/:Gread - stage/checkout file
  • :do //2/:do //3 - resolve conflict using the version from target/merge branch
  • :diffu[pdate] - refresh diff highlighting
  • :on[ly],<C-w>o - close windows other than the current one

Unimpaired

  • [a/]a - :previous/:next

  • [A/]A - :first/:last

  • [q/]q - :cprev/:cnext

  • [Q/]Q - :cfirst/:clast

  • [n/]n - previous/next conflict marker

  • [<Space>/]<Space> - add blank lines above/below the cursor

  • [o{opt}/]o{opt}/co{opt} - turn on/turn off/toggle option:

    • h - "hlsearch"
    • i - "ignorecase"
    • s - "spell"
    • w - "wrap"
  • yp/P/o/O/I/A enters insert mode as with a/i/o/O/I/A and sets paste. Leaving insert mode sets 'nopaste' automatically.

Eunuch

  • :Rename[!]
  • :SudoWrite
  • :Remove[!]
  • :Find[!] {args} - run find and load results into quickfix
  • when you create a file that starts with a shebang, it gets chmod +x automatically on first save!

Scriptease

  • :Vedit - quickly open a Vim runtime file
    • :Vsplit
    • :Vvsplit
    • :Vtabedit
    • :Vpedit
    • :Vread
  • :Runtime - reload runtime files
  • g! - eval a motion or selection as VimL and replace it with the result

Example:

:Vsp s/pd<Tab>

Tbone

  • :Tmux [args] - execute a tmux command
  • :[range]Tyank/:Tput [buffer] - access to tmux buffer
  • :[range]Twrite [pane] - tmux send-keys to another pane

Examples how to specify a pane: windowtitle.2, top-right, or last; or let it default to the previously given argument.

More Repositories

1

hub

A command-line tool that makes git easier to use with GitHub.
Go
22,524
star
2

will_paginate

Pagination library for Rails and other Ruby applications
Ruby
5,706
star
3

git-deploy

git deployment made easy
Ruby
2,098
star
4

dotfiles

bash, zsh, git, tmux, personal toolbox
Shell
1,208
star
5

rfc

Pretty RFC indexes and reformats RFC documents for easier discovery and viewing.
JavaScript
935
star
6

poignant-guide

Why's Poignant Guide to Ruby
HTML
732
star
7

instagram

The first Instagram website and lightweight API HTTP client
Ruby
586
star
8

ssl-tools

Ruby tools to help with debugging certificates for SSL connections
Ruby
339
star
9

contacts

Ruby library for consuming Google, Yahoo!, Flickr and Windows Live contact APIs
Ruby
294
star
10

anyenv

rbenv-inspired version manager that can be configured to manage versions of ANYTHING
Go
273
star
11

hanna

More than just a new RDoc template
Ruby
234
star
12

gh-branch

GitHub CLI extension for fuzzy finding, quickly switching between and deleting branches.
Shell
210
star
13

nibbler

A cute HTML scraper / data extraction tool in under 70 lines of code
Ruby
141
star
14

bump-homebrew-formula-action

Automatically bump Homebrew formula after a release
TypeScript
126
star
15

coral

Hacker's toolbelt for Ruby, gems, Bundler, git, and more
Shell
108
star
16

choices

Easy external settings for your app
Ruby
95
star
17

gorgeous

Convert between different data formats: JSON, XML, YAML, Ruby, email, URL-encoded
Ruby
94
star
18

movieapp

Mark movies you watched, liked, or plan to watch, and share with your friends.
Ruby
79
star
19

diveintohtml5

[STALE] Copy of Mark Pilgrim's book "Dive Into HTML5"
HTML
75
star
20

gh-cp

GitHub CLI extension to copy a file from a GitHub repository locally without cloning the repository.
Shell
72
star
21

issuesync

Downloads all issues for the current project to individual `issues/*.md` files
Ruby
67
star
22

twitter-login

Login through Twitter; DEPRECATED in favor of omniauth-twitter.
Ruby
63
star
23

rspec-rails-mocha

Ports functionality of mock_model and stub_model from rspec-rails for developers using Mocha.
Ruby
57
star
24

hub-api-utils

A collection of `hub api` examples
Shell
57
star
25

bluecloth

Markdown processor in Ruby; foked from official SVN repo to fix bugs
Ruby
49
star
26

faraday-stack

[deprecated] Über Faraday stack for consuming APIs (JSON, XML decoding & more)
Ruby
47
star
27

sinatra-boilerplate

Sinatra + Haml Sass Compass Bourbon CoffeeScript
JavaScript
41
star
28

gh-contrib

GitHub CLI extension to render your contribution graph in the terminal
Shell
39
star
29

explain-ruby

Explains Ruby syntax
Ruby
32
star
30

twin

Twitter's twin; a Rack middleware to expose a Twitter-like API from your app
Ruby
30
star
31

gh-repo-collab

GitHub CLI extension to manage repository collaborators
Shell
28
star
32

user-scripts

User scripts for Greasemonkey/Safari/Fluid; home of Endless Tweets
JavaScript
28
star
33

standardista

A nicotine patch for Rails users who want to stop pretending they're writing XHTML
Ruby
23
star
34

tapas-bar

Tiny webapp that I use for watching RubyTapas from my iPad across home network.
Ruby
20
star
35

polyamory

A tool that knows how to run your tests regardless of framework
Ruby
19
star
36

remark

HTML to Markdown converter
Ruby
18
star
37

gh-delete-repo

[Deprecated] GitHub CLI extension for deleting GitHub repositories
Shell
17
star
38

rbenv-user-gems

[DEPRECATED] rbenv plugin for $GEM_HOME and user gems install location
Shell
15
star
39

go-travis

Go-based CLI tool for Travis CI
Go
15
star
40

shrubbery

Nested lists unlike you've ever seen
JavaScript
14
star
41

thor-tasks

GitHub tasks for Thor
14
star
42

gh-license

GitHub CLI extension to add a license to the current project
Shell
14
star
43

blog

The blog
HTML
14
star
44

itunes

Access iTunes with MacRuby through Scripting Bridge
C
13
star
45

facebook

Facebook login; DEPRECATED in favor of omniauth-facebook.
Ruby
13
star
46

textmate-bundles

My fork of a repo that once was "textmate/bundles"
11
star
47

curly

Easier than Curl::Easy
Ruby
10
star
48

async-upload

Example app for asynchronous file upload via hidden iframe with Prototype and PHP
PHP
9
star
49

rbenv-charles-ssl

rbenv plugin to help installing Charles Proxy SSL certificate into all rubies
Shell
9
star
50

cstags

ctags generator for CoffeeScript files
CoffeeScript
9
star
51

puppet-personal

I'm learning Puppet. WIP
Ruby
8
star
52

mingo

Ruby
8
star
53

asbestos

Render JSON from your XML Builder templates
Ruby
7
star
54

twitter-followers

Mini app that processes new followers notifications from Twitter
JavaScript
7
star
55

svg2png

Convert SVGs to PNG using headless Chrome
JavaScript
6
star
56

gh-repo-topic

[Deprecated] GitHub CLI extension to list or add repository topics
Shell
6
star
57

never-forget

The stupid exception tracker. Saves to MongoDB.
Ruby
6
star
58

Lyndon.tmbundle

Execute JavaScript expressions with a single keystroke inside TextMate
6
star
59

gh-lint-workflow

A GitHub CLI extension to lint GitHub Actions workflow files [EXPERIMENTAL]
Shell
6
star
60

railsgirls-movieapp

Example application for Rails Girls workshop
Ruby
5
star
61

stylish.vim

vim plugin to cycle through available color schemes and fonts on your system
Ruby
4
star
62

goreleaser-test

Shell
3
star
63

gh-notifications

Ruby
3
star
64

go-utils

Go
3
star
65

tweets

Grailbird site that powers an individual Twitter Archive, edited for my needs
JavaScript
3
star
66

gh-label

1
star
67

pages-cname-instructions

How to host GitHub Pages site on your own domain
JavaScript
1
star