Skip to content

Instantly share code, notes, and snippets.

function! BrightHome()
let s:col = col(".")
normal! 0
if s:col == col(".")
normal! ^
endif
endfunction
nnoremap <silent> <Home> :call BrightHome()<CR>
@smosher
smosher / normals.pl6
Created September 20, 2011 12:15
basic normal calculation
sub vector-to-unit( @vec ) { @vec >>/>> sqrt( [+] @vec >>**>> 2 ) }
sub cross-product( @v1, @v2 ) {
( @v1[1,2,0] >>*<< @v2[2,0,1] )
>>-<<
( @v1[2,0,1] >>*<< @v2[1,2,0] )
}
sub surface-to-normal( @a, @b, @c ) {
my @b2 = @b >>-<< @a;
my @c2 = @c >>-<< @a;
my @normal = cross-product( @b2, @c2 );