Skip to content

Instantly share code, notes, and snippets.

View mhinz's full-sized avatar

Marco Hinz mhinz

View GitHub Profile
if has_key(g:toplevel, 'cdlist')
let s:cdlist = g:toplevel.cdlist
else
let s:cdlist = [
\ [ '.git', 'finddir' ],
\ [ '.hg', 'finddir' ],
\ [ '.bzr', 'finddir' ],
\ [ 'foo', 'find' ],
\ ]
endif
function! Make() abort
let path = findfile('Makefile', '.;')
if !empty(ret)
execute 'lcd' fnamemodify(path, ':h') . '/Makefile'
make
endif
endfunction
@mhinz
mhinz / gist:6920855
Last active December 25, 2015 04:59
function! Make() abort
let path = findfile('Makefile', '.;')
if !empty(path)
execute 'lcd' fnamemodify(path, ':h')
make
endif
endfunction
fun max_eff (xs : int list) : int option =
if null xs
then NONE
else
let
fun max_nonempty (xs : int list) : int =
if null (tl xs)
then hd xs
else
let
@mhinz
mhinz / gist:7068526
Last active December 26, 2015 00:59
if exists('p')
unlet p
endif
if exists('puts')
unlet puts
endif
redir => p
silent ruby p RUBY_VERSION
function! s:set_cursor() abort
let s:oldline = exists('s:newline') ? s:newline : 5
let s:newline = line('.')
let headoff = s:headoff + 2 + s:secoff
" going down
if s:newline > s:oldline
while index(s:section_header_lines, s:newline) != -1
let s:newline += 1
endwhile
@mhinz
mhinz / gist:7133825
Last active December 26, 2015 09:59
function! s:session_write(spath)
let ssop = &sessionoptions
try
set sessionoptions-=options
execute 'mksession!' a:spath
catch
execute 'echoerr' string(v:exception)
finally
let &sessionoptions = ssop
endtry
IMPLEMENTATION Rabbits
IMPORT Denotation ONLY ++
Nat ONLY nat ! 0 1 2 - + > =
NatConv ONLY `
String ONLY string
StringConv ONLY `
Com ONLY ans:SORT
ComCompose COMPLETELY
Stream ONLY input stdIn readLine
IMPLEMENTATION Queens
IMPORT Void COMPLETELY
Pair COMPLETELY
Option COMPLETELY
Seq COMPLETELY
SeqMap COMPLETELY
SeqFold COMPLETELY
BTUnion COMPLETELY
Bitset COMPLETELY
"
" Works in visual line and visual block mode.
"
" Select one character more in visual block mode...
"
function! Transform(prefix, suffix)
let [startcol, endcol ] = [col("'<"), col("'>") ]
let [startline, endline] = [line("'<"), line("'>")]
let startcol = '%'. (startcol ? startcol : 1) .'c'