Skip to content

Instantly share code, notes, and snippets.

Andrew Radev AndrewRadev

Block or report user

Report or block AndrewRadev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
AndrewRadev / Makefile
Created Jan 8, 2012
Stupidly simple Makefile for working with an Arduino
View Makefile
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 /
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))
AndrewRadev /
Last active Oct 21, 2018
Keep track of a long-running process
# Given a long-running process in the terminal:
# - Ctrl+Z to suspend it
# - Run `keep-track`
# - Output resumes, when done will show a notification with the time it took for the process to run
# Can be customized with an `--icon` to `notify-send`,
# maybe a sound effect added in the `&&` list.
function keep-track() {
AndrewRadev / Coffeescript ctags
Created Feb 28, 2012 — forked from wereHamster/Coffeescript ctags
ctags definitions for coffeescript
View Coffeescript ctags
# Detects classes, static/class methods, plain functions and variables.
# To use, place it in a ~/.ctags file.
--regex-coffee=/(^|=[ \t])*class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\2/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?([A-Za-z.]+):.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
AndrewRadev / qf.vim
Created Mar 5, 2012
Mapping to toggle the quickfix window on and off
View qf.vim
nnoremap <Plug>ToggleQf :call <SID>ToggleQf()<cr>
function! s:ToggleQf()
for buffer in tabpagebuflist()
if bufname(buffer) == ''
" then it should be the quickfix window
AndrewRadev / ember-projections.json
Last active Jun 20, 2018
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 / LICENSE
Last active Jun 18, 2018
Execute a vim motion on the "next" text object
MIT License
Copyright (c) 2017 Andrew Radev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
You can’t perform that action at this time.