This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[link(name = "logger")] | |
extern { | |
fn CrystalLog(text: *const u8); | |
} | |
fn log(text: &'static str) { | |
unsafe{ CrystalLog(text.as_bytes().as_ptr()) }; | |
} | |
fn main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
See https://github.com/romainl/idiomatic-vimrc for an up-to-date version.
-
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.
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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
":[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 ) |
NewerOlder