This file contains 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
" Requires: Utl | |
call NERDTreeAddKeyMap({ | |
\ 'key': 'gu', | |
\ 'callback': 'OpenCurrentNodeWithUtl', | |
\ 'quickhelpText': 'open current node with the Utl plugin' }) | |
function! OpenCurrentNodeWithUtl() | |
" Get the path of the item under the cursor if possible: | |
let currentDir = g:NERDTreeFileNode.GetSelected() |
This file contains 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
" Remap the 'Enter' key to process the command line before executing | |
cnoremap <cr> <c-r>=<SID>DoSomeChecks()<cr><cr> | |
function! s:DoSomeChecks() | |
let g:debug = getcmdline() | |
" and some more stuff... | |
" :doautocmd with a custom event maybe? | |
return '' | |
endfunction |
This file contains 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
" <space>x -> :X | |
" For easier typing of custom commands | |
noremap <space> :call <SID>SpaceMapping()<cr> | |
function! s:SpaceMapping() | |
echo | |
let c = nr2char(getchar()) | |
call feedkeys(':'.toupper(c)) | |
endfunction |
This file contains 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
require 'pp' | |
class Monad | |
class Wrapper | |
def initialize(monad) | |
@monad = monad | |
@lets = {} | |
end | |
def let(name, value) |
This file contains 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
" Toggle settings: | |
command! -nargs=+ MapToggle call s:MapToggle(<f-args>) | |
function! s:MapToggle(key, opt) | |
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>" | |
exec 'nnoremap '.a:key.' '.cmd | |
endfunction | |
" To toggle search highlighting on and off with <F9>, just do: | |
" | |
" MapToggle <F9> hlsearch |
This file contains 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
if not defined? BasicObject | |
class BasicObject | |
m = %w"__id__ __send__ instance_eval == equal?" | |
(instance_methods - m).each{|m| undef_method(m)} | |
end | |
end | |
class NotDelegator < BasicObject | |
def initialize(obj) | |
@_object = obj |
This file contains 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
# Ruby 1.8.7-p330 | |
# ActiveSupport 3.0.7 | |
require 'rubygems' | |
require 'active_support/ordered_hash' | |
require 'pp' | |
test = ActiveSupport::OrderedHash.new | |
test[:one] = 1 |
This file contains 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
# Ruby 1.8.7 | |
# ActiveSupport 3.0.7 | |
require 'rubygems' | |
require 'active_support/ordered_hash' | |
require 'pp' | |
ordered = ActiveSupport::OrderedHash.new | |
standard = Hash.new |
OlderNewer