Skip to content

Instantly share code, notes, and snippets.

@scrooloose
scrooloose / startshell_mapping.vim
Created October 7, 2009 09:59
nerd tree plugin to add a mapping on S that starts a :shell
"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 October 9, 2009 06:21
An example git menu for nerdtree... very raw
" 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 October 9, 2009 06:58
nerdtree plugin to integrate nerdtree with :grep
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 October 10, 2009 02:03
add a :Tsearch command to open a :cwindow like list of matching tags
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]
"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 October 19, 2009 22:20
make Foo.methods more awesome
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
"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')
nmap <silent> <leader>x,
\ :%s/\(\(^\([^"']*\(["'][^"']*["']\)\)*[^"']*\)\@<=\)\+,\ze\S/& /gc<cr>
setlocal nolist
setlocal wrap
setlocal lbr
div.something
min-height: 500px
height: auto !important
height: 500px