Skip to content

Instantly share code, notes, and snippets.


Andrew Radev AndrewRadev

View GitHub Profile
AndrewRadev / eruby.vim
Created Jul 1, 2012
My ftplugin/eruby.vim file
View eruby.vim
" This file is supposed to be saved as "~/.vim/ftplugin/eruby.vim". If desired, parts of it can be
" picked and saved into separate files in the same directory as long as they start with "eruby_",
" for example "~/.vim/ftplugin/eruby_surroundings.vim".
" Surround mappings. The character defines the mapping. Most of these are meant for use in visual
" mode to add a wrapping, although they can probably be used otherwise as well.
" These ones let you wrap a piece of text on a line with erb <% %> markers. The last one is
" particularly useful for adding translations in the place of hardcoded strings.
AndrewRadev /
Created Apr 24, 2020
An old Vim guide I wrote in Bulgarian. Originally published at



  • За да излезете от Vim, без да запазвате файл, натиснете Esc, след това напишете :q! и натиснете Enter.
  • За да направите промяна, натиснете i и си редактирайте текста като в нормален редактор.
  • За да запазите направените промени, натиснете Esc и след това напишете :w и натиснете Enter. След това е окей да излезете от редактора с :q.

А ако се чудите къде да инвестирате следващите десет минути от живота си, непременно прочетете това ръководство до края.

AndrewRadev / bookmarks.vim
Created Nov 16, 2011
Simple bookmark management in Vim
View bookmarks.vim
set viminfo+=!
if !exists('g:BOOKMARKS')
let g:BOOKMARKS = {}
" Add the current [filename, cursor position] in g:BOOKMARKS under the given
" name
command! -nargs=1 Bookmark call s:Bookmark(<f-args>)
function! s:Bookmark(name)
AndrewRadev / efactory.vim
Last active Apr 14, 2020
An `:Efactory` command for jumping to factory_bot definitions in rails projects
View efactory.vim
" Extracted from:
" Installation:
" Copy file to ~/.vim/plugin/efactory.vim, or just paste the whole thing in
" your `.vimrc`. No guarantees it'll work well for you, seems to work for me.
" Will extract to a plugin at some point and it'll hopefully be more reliable.
" Usage:
AndrewRadev / qf.vim
Created Dec 2, 2011
Delete lines from the quickfix window (with undo)
View qf.vim
" Place in ftplugin/qf.vim
xnoremap <buffer> d :DeleteLines<cr>
nnoremap <buffer> dd :DeleteLines<cr>
nnoremap <buffer> u :UndoDelete<cr>
if !exists(':DeleteLines')
let b:deletion_stack = []
" Delete by a pattern (with undo placing them all on top):
AndrewRadev / ember-projections.json
Last active Oct 28, 2019
A `.projections.json` file that can be used with vim-projectionist for navigating ember.js projects
View ember-projections.json
"app/initializers/*.js": {
"type": "initializer"
"app/models/*.js": {
"type": "model",
"alternate": "app/adapters/{}.js",
"app/adapters/*.js": {
"type": "adapter",
AndrewRadev / Makefile
Created Jan 8, 2012
Stupidly simple Makefile for working with an Arduino
View Makefile
AndrewRadev /
Last active Nov 13, 2018
Divide successfully or default to zero
trait OrZero {
fn or_zero(self) -> Self;
impl OrZero for f64 {
fn or_zero(self) -> Self {
if self.is_normal() { self } else { 0.0 }
AndrewRadev / README.markdown
Created Aug 11, 2011 — forked from skanev/README.markdown
Convert a <select> with <optgroups> to two <select>s that are interconnected
View README.markdown

If you have a select with option groups:

<select data-nested-select="Select country">
  <option>Select city</option>
  <optgroup label="Bulgaria">
    <option value="sofia">Sofia</option>
    <option value="plovdiv">Plovdiv</option>
  <optgroup label="Sweden">
    <option value="stockholm">Stockholm</option>
AndrewRadev / dsf.vim
Last active Nov 5, 2018
Delete surrounding function call
View dsf.vim
" Delete surrounding function call
" Relies on surround.vim
" function_call(cursor_here) => dsf => cursor_here
" Try `dsf` with more complicated structures:
" nested(function_call(cursor_here))
" nested(cursor_here(chewy_center))
You can’t perform that action at this time.