/dotvim

Vim for Ruby on Rails development

Primary LanguageVimL

My Vim for Ruby on Rails development

vim-window

Warning for MacVim users

I've stopped using MacVim(mostly) and started using console Vim in Tmux. The lastest MacVim config extracted to the macvim branch and no longer supported. But still contains most of the features described here.

Features

=====

  • Snippetsvim-snipmate
  • Maximize/unmaximize active splitZoomWin
  • Bulk lines commenting based on syntaxNERDCommenter
  • Auto-closing quotes, brackets etc.DelimitMate
  • Jump around code with keystrokesEasymotion
  • Surround selected text with any symbols and replace surroundings on-the-flySurround
  • Smart text selectionSmartpairs
  • Open scratch buffer which is never savedVimScratch
  • List of recently used filesMRU
  • Solarized themeSolarized

=====

  • Hide everything, except selected text (stay focused!)
  • Toggle straight/relative line numbers to use with movement operations
  • Move code blocks left/right/up/down
  • Open current split in new tab
  • Open tabs by numbers
  • Restore cursor position on file open
  • Remove spaces from the end of each line on save
  • Cyrillic keys mapped to latin to use in normal mode
  • Friendly text/markdown files editing with wrapping and ULTIMATE paragraph formatter
  • Spell checking english and russian(with ё) texts

Installation

$ curl -Lo- https://raw.githubusercontent.com/vrybas/dotvim/master/install.sh | bash

Usage

  1. mvim /path/to/project
  2. :e any_file_in_path
  3. :Rtags

Keymap (above Vim & plugins standard)

  • space - Save file
  • ,e - "Open File" dialog
  • ,f - Show opened files
  • ,d - Open project Tree View
  • Q - Quit Vim and close all windows without saving

Tabs

  • ,t - Open current buffer in new tab
  • ,h/l - Previous/Next tab
  • ,1..9 - Go to 1..9 tab
  • ,g - Open class/function definition in new tab
  • ,W - Close tab

Buffers

  • ,,1..30 - Go to 1..30 buffer
  • ,x - Close current buffer
  • ,,x - Close and delete current buffer
  • ,Tab - Open scratch buffer which is never saved
  • ,h/l - Previous/Next buffer

Splits

  • ,v - Create vertical split
  • ,s - Create horisontal split
  • ,H/J/K/L - Resize split in left/down/up/right directions
  • ,o - Maximize/unmaximize split
  • ,x - Close split
  • Ctrl-h/j/k/l - Switch to left/down/up/right

Fugitive and Flayouts

Fugitive.vim - a complement to command line git

Flayouts.vim - layouts for Fugitive

  • ,gb - Git Blame
  • ,gs - Git Status
Git Commit
  • ,<space> - Open :Glstatus in new tab (current file, unstaged changes, git status window).
  • ,,s - (again) Save entered commit message(if any), make commit, close tab with :Glstatus.
  • ,u - Close tab with :Glstatus without making a commit (keeping staged and unstaged changes as is)
  • ,gm - Read last commit message to the current buffer
  • ,go - Read last 15 commit messages to the current buffer
Git Log View
  • ,gh - Show last 200 commit of all files in new tab

  • ,,gh - Show last 200 commit of current file in new tab

  • ,gp - Show pull-request summary between current branch and base branch

  • ,gc - Show commits log between current branch and base branch

  • ,,gp - Show pull-request summary between current branch and origin

  • ,,gc - Show commits log between current branch and origin

  • ,gw - Open git commit or blob in the browser (:Gbrowse)

  • ,D - Git diff

  • ,C - Git diff --cached

  • ,h - Git log -p of current file (last 100 commits)

  • ,,h - Git log -p (last 200 commits)

  • ,N - Jump to next commit (in diff mode)

  • ,P - Jump to previous commit (in diff mode)

  • ,G - Get diff or patch of PR or Commit, specified by URL (via git-pget)

  • <space> - Open file, containing chunk of code under cursor (works in any diff)

Git Diff View (opens from Commit View)

Fugitive.vim - working with the git index

  • ,,d - Run :Gdiff (current file diff view between staged and unstaged version)
  • ,0 - :diffget
  • ,9 - :diffput
  • ,,do - Close Diff view
Git Conflict Resolution
  • ,,r - Open :GlresolveConflict for current file. Opens current file in new tab, shows HEAD version, conflicted MERGE version, and "both modified" version of the file.

Open Ruby/Rails documentation

  • RR - APIDock open Rails documentation for method under cursor
  • RB - APIDock open Ruby documentation
  • RS - APIDock open Rspec documentation
  • RI - Open Ri documentation with autocompletive search in horisontal split
  • RIV - Open Ri documentation in vertical split
  • RK - Open Ri documentation for keyword under cursor

Folds

  • ,zz - Toggle fold method (manual/indent)
  • ,za - Fold everything, except selected lines (Visual mode, manual fold method)
  • ,zs - Unfold everything
  • ,za - Restore folds

Move selected line(s) around (in visually select mode)

  • ,fh - Move left
  • ,fj - Move down
  • ,fk - Move up
  • ,fl - Move right

Markdown and Text Files

  • ,w4..8 - Set vertical ruler and autowrapping to 40..80 symbols
  • ,wm - Set vertical ruler and autowrapping to 78 symbols (Email standard)
  • ,wg - Set vertical ruler and autowrapping to 72 symbols for writing commit messages (@tpope's post on that)
  • ,y - Format and copy selected text to the clipboard without line breaks
  • t<Tab> - Insert Github Flavored Markdown task - [ ]
  • t - Mark task as current (highlight)
  • T - Complete a task or group of tasks

Other

  • Tab - code completion (including tags and snippets, slow)
  • Ctrl-p - local code completion (opened files, faster)
  • Ctrl-k - expand snipped, selected from dropdown list (single snipped expanded with Tab)
  • fw - Easymotion
  • ,m - Clear search highlighting
  • ,y - Toggle display trailing characters
  • ,,i - Check syntax
  • ,a - Search on current path with Ack
  • F6 - Do not autoindent lines, when paste from OS buffer (when pasting big code block)
  • ,u - Toggle open graphical tree-based undo