Skip to content

Instantly share code, notes, and snippets.

View Raimondi's full-sized avatar

Israel Chauca Fuentes Raimondi

View GitHub Profile
@keplersj
keplersj / logged.rs
Created July 25, 2015 21:00
Gist demonstrating the ability to run Crystal code from Rust.
#[link(name = "logger")]
extern {
fn CrystalLog(text: *const u8);
}
fn log(text: &'static str) {
unsafe{ CrystalLog(text.as_bytes().as_ptr()) };
}
fn main() {
@Raimondi
Raimondi / op_on_visual_block.vim
Last active August 29, 2015 14:11
Do stuff to visual blocks.
function! OperateOnVisualBlock(expr)
let save_reg = getreg('x')
let save_reg_type = getregtype('x')
normal! gv"xy
let list = split(@x, '\n')
let list = eval(printf(a:expr, 'list'))
let @x = join(list, "\n")
call setreg('X', '', 'b')
normal! gv"xp
call setreg('x', save_reg, save_reg_type)
@dahu
dahu / gist:fc26f96219bea83cdac5
Last active August 29, 2015 14:10
Vomit -- a synesthesia syntax highlighting script for Vim
function! Vomit()
let data = uniq(sort(split(join(getline(1, '$')), '\zs')))
hi clear
let fg = 16
for d in data
exe 'syn match vom_' . fg . ' "' . escape(d, '"\\') . '"'
exe 'hi vom_' . fg . ' ctermfg=' . fg
let fg = ((fg + 11) % 230) + 1
endfor
endfunction
@Raimondi
Raimondi / .bashrc
Last active August 29, 2015 14:07 — forked from danopia/.bashrc
Use clippy for shell errors.
function command_not_found_handle {
{echo "It looks like you're trying to run a UNIX command.";echo "Would you like some help with that?"; echo; /usr/lib/command-not-found $1 2>&1|fold -sw 55}|cowsay -f$HOME/.clippy -n
}
@romainl
romainl / deprecation.md
Last active February 24, 2022 02:42
Idiomatic vimrc
@dahu
dahu / finding-vim-help.md
Last active January 3, 2016 10:19
Vim's Ladder

Take the following steps to get the Vim help you need:

  • If you're having trouble with a plugin, read its README first to make sure you have installed any dependencies and configured it correctly.

  • :help topic <= will jump to topic within the manual.

  • :helpgrep pattern <= will search for all occurrences of pattern throughout the manual.

Use :cope to open the quickfix window of search results.

@ZyX-I
ZyX-I / RFC.rst
Last active December 17, 2015 05:58

New python objects

vim.mappings/{buffer}.mappings:
Mapping-like object mapping mode constants to vim.modemappings objects below. Unlike vim.buffers iteration is being done for keys. Mode constants are described below in vim.current.mode object description, but for convenience additional constants are defined:
func! Inc(...)
if a:0
let g:inc = 0
else
let g:inc += 1
endif
return g:inc
endf
call Inc(1)
%s/regex/\=Inc()/
@inkarkat
inkarkat / SortUnfolded.vim
Created November 25, 2012 21:39
A sort function for Vim that keeps folded lines intact.
":[range]SortUnfolded[!] [i][u][r][n][x][o] [/{pattern}/]
" Sort visible lines in [range]. Lines inside closed folds
" are kept intact; sorting is done only on the first line
" of the fold; the other lines inside the fold move with
" it as a unit.
" Copyright: (C) 2012 Ingo Karkat
" The VIM LICENSE applies to this scriptlet; see ':help copyright'.
" Inspiration:
" http://stackoverflow.com/questions/13554191/sorting-vim-folds
function! s:ErrorMsg( text )