Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Grenfell scrooloose

View GitHub Profile
@scrooloose
scrooloose / startshell_mapping.vim
Created Oct 7, 2009
nerd tree plugin to add a mapping on S that starts a :shell
View startshell_mapping.vim
"put this in ~/.vim/nerdtree_plugin/startshell_mapping.vim
call NERDTreeAddKeyMap({
\ 'key': 'S',
\ 'callback': 'NERDTreeStartShell',
\ 'quickhelpText': 'start a :shell in this dir' })
function! NERDTreeStartShell()
let n = g:NERDTreeDirNode.GetSelected()
@scrooloose
scrooloose / git_menu.vim
Created Oct 9, 2009
An example git menu for nerdtree... very raw
View git_menu.vim
" Put this in ~/.vim/nerdtree_plugin/git_menu.vim
"
" Adds a "g" submenu to the NERD tree menu.
"
" Note: this plugin assumes that the current tree root has a .git dir under
" it, and that the working tree and the .git repo are in the same place
"
if exists("g:loaded_nerdtree_git_menu")
finish
endif
@scrooloose
scrooloose / grep_menuitem.vim
Created Oct 9, 2009
nerdtree plugin to integrate nerdtree with :grep
View grep_menuitem.vim
if exists("g:loaded_nerdtree_grep_menuitem")
finish
endif
let g:loaded_nerdtree_grep_menuitem = 1
if !executable("grep")
finish
endif
call NERDTreeAddMenuItem({
@scrooloose
scrooloose / tagsearch.vim
Created Oct 10, 2009
add a :Tsearch command to open a :cwindow like list of matching tags
View tagsearch.vim
command -nargs=1 -complete=tag Tsearch call <SID>Tsearch(<f-args>)
"search for tags using the given search string, list them in a new window,
"user can hit enter on a tag to jump to it
function! s:Tsearch(str)
botright 10 new
let b:taglist = taglist(a:str)
for i in range(0, len(b:taglist)-1)
let next = b:taglist[i]
View utl_mapping.vim
"Originally -> http://gist.github.com/206863
"YAY gist forking is broken!
" Requires: Utl
if !exists("loaded_utl")
finish
endif
call NERDTreeAddKeyMap({
\ 'key': 'gu',
@scrooloose
scrooloose / irbrc_hax0r.rb
Created Oct 19, 2009
make Foo.methods more awesome
View irbrc_hax0r.rb
require 'rubygems'
require 'looksee/shortcuts'
module Kernel
alias_method :orig_methods, :methods
def methods(*args)
if caller.first =~ /\(irb\):\d+:in `irb_binding'/
lp(self, *args)
else
orig_methods
View rogue.vim
"this is in my ~/.vim/projects/rogue.vim
"in my vimrc i have a :runtime! projects/**/*.vim to source all my project files
"assumes each model class is in ./lib/foo.rb and the related
"spec (i.e. test) file is in ./spec/foo_spec.rb
autocmd bufnewfile,bufreadpost ~/projects/rogue/* call s:setup()
function! s:setup()
command! -nargs=0 -buffer A call s:gotoAltFile('edit')
command! -nargs=0 -buffer AS call s:gotoAltFile('split')
View gist:215453
nmap <silent> <leader>x,
\ :%s/\(\(^\([^"']*\(["'][^"']*["']\)\)*[^"']*\)\@<=\)\+,\ze\S/& /gc<cr>
View gist:215485
setlocal nolist
setlocal wrap
setlocal lbr
View min-height-hack.sass
div.something
min-height: 500px
height: auto !important
height: 500px
You can’t perform that action at this time.