Skip to content

Commit

Permalink
Trying pathogen.vim
Browse files Browse the repository at this point in the history
  • Loading branch information
olauzon committed May 14, 2010
1 parent 8cb9af3 commit 973a7ae
Show file tree
Hide file tree
Showing 75 changed files with 28,536 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

File renamed without changes.
7 changes: 2 additions & 5 deletions script/symlink.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
rm -rf ~/.vimrc
ln -s ~/dotvim/current/vimrc ~/.vimrc

#rm -rf ~/.gvimrc
#ln -s ~/dotvim/current/gvimrc ~/.gvimrc
ln -s ~/dotvim/vimrc ~/.vimrc

rm -rf ~/.vim
ln -s ~/dotvim/current/vim ~/.vim
ln -s ~/dotvim/vim ~/.vim
3 changes: 3 additions & 0 deletions script/symlink_gvim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rm -rf ~/.gvimrc
ln -s ~/dotvim/gvimrc ~/.gvimrc

132 changes: 132 additions & 0 deletions vim/autoload/pathogen.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Version: 1.2

" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" API is documented below.

if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1

" Split a path into a list.
function! pathogen#split(path) abort " {{{1
if type(a:path) == type([]) | return a:path | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1

" Convert a list to a path.
function! pathogen#join(...) abort " {{{1
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction " }}}1

" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort " {{{1
return call('pathogen#join',[1] + a:000)
endfunction " }}}1

" Remove duplicates from a list.
function! pathogen#uniq(list) abort " {{{1
let i = 0
let seen = {}
while i < len(a:list)
if has_key(seen,a:list[i])
call remove(a:list,i)
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction " }}}1

" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#separator() abort " {{{1
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction " }}}1

" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort " {{{1
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
endfunction "}}}1

" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort " {{{1
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1

" Prepend all subdirectories of path to the rtp, and append all after
" directories in those subdirectories.
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
let sep = pathogen#separator()
let before = pathogen#glob_directories(a:path.sep."*[^~]")
let after = pathogen#glob_directories(a:path.sep."*[^~]".sep."after")
let rtp = pathogen#split(&rtp)
let path = expand(a:path)
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
return &rtp
endfunction " }}}1

" For each directory in rtp, check for a subdirectory named dir. If it
" exists, add all subdirectories of that subdirectory to the rtp, immediately
" after the original directory. If no argument is given, 'bundle' is used.
" Repeated calls with the same arguments are ignored.
function! pathogen#runtime_append_all_bundles(...) " {{{1
let sep = pathogen#separator()
let name = a:0 ? a:1 : 'bundle'
if "\n".s:done_bundles =~# "\\M\n".name."\n"
return ""
endif
let s:done_bundles .= name . "\n"
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += pathogen#glob_directories(substitute(dir,'after$',name.sep.'*[^~]'.sep.'after','')) + [dir]
else
let list += [dir] + pathogen#glob_directories(dir.sep.name.sep.'*[^~]')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction

let s:done_bundles = ''
" }}}1

" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() " {{{1
for dir in pathogen#split(&rtp)
if dir[0 : strlen($VIM)-1] !=# $VIM && isdirectory(dir.'/doc') && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
helptags `=dir.'/doc'`
endif
endfor
endfunction " }}}1

" vim:set ft=vim ts=8 sw=2 sts=2:
2 changes: 2 additions & 0 deletions vim/bundle/fuzzy_file_finder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.swp
pkg/
4 changes: 4 additions & 0 deletions vim/bundle/fuzzy_file_finder/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
All code, documentation, and other data distributed with this project
is released in the PUBLIC DOMAIN, by the author, Jamis Buck. Anyone,
anywhere, is allowed to use, modify, and/or redistribute any of this
without restriction.
4 changes: 4 additions & 0 deletions vim/bundle/fuzzy_file_finder/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lib/fuzzy_file_finder.rb
LICENSE
Manifest
README.rdoc
36 changes: 36 additions & 0 deletions vim/bundle/fuzzy_file_finder/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
= FuzzyFileFinder

FuzzyFileFinder is a (somewhat improved) implementation of TextMate's "cmd-T" functionality. It allows you to search for a file by specifying a pattern of characters that appear in that file's name. Unlike TextMate, FuzzyFileFinder also lets you match against the file's directory, so you can more easily scope your search.

== FEATURES:

* Quickly search directory trees for files
* Avoids accidentally scanning huge directories by implementing a ceiling (default 10,000 entries)
* Simple highlighting of matches to discover how a pattern matched

== SYNOPSIS:

In a nutshell:

require 'fuzzy_file_finder'

finder = FuzzyFileFinder.new

finder.search "app/blogcon" do |match|
puts "[%5d] %s" % [match[:score] * 10000, match[:highlighted_path]]
end

matches = finder.find("app/blogcon").sort_by { |m| [-m[:score], m[:path] }
matches.each do |match|
puts "[%5d] %s" % [match[:score] * 10000, match[:highlighted_path]]
end

See FuzzyFileFinder for more documentation, and links to further information.

== INSTALL:

* gem install --source=http://gems.github.com jamis-fuzzy_file_finder

== LICENSE:

All code, documentation, and related materials in this project are released into the PUBLIC DOMAIN. Usage, modification, and distribution are allowed without restriction.
19 changes: 19 additions & 0 deletions vim/bundle/fuzzy_file_finder/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
begin
require 'echoe'
rescue LoadError
abort "You'll need to have `echoe' installed to use Net::SSH's Rakefile"
end

require './lib/fuzzy_file_finder'
version = FuzzyFileFinder::Version::STRING.dup
if ENV['SNAPSHOT'].to_i == 1
version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Echoe.new('fuzzy_file_finder', version) do |p|
p.author = "Jamis Buck"
p.email = "jamis@jamisbuck.org"
p.summary = "an implementation of TextMate's cmd-T search functionality"

p.rdoc_pattern = /^(lib|README.rdoc)/
end
56 changes: 56 additions & 0 deletions vim/bundle/fuzzy_file_finder/fuzzy_file_finder.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# Gem::Specification for Fuzzy_file_finder-1.0.4
# Originally generated by Echoe

Gem::Specification.new do |s|
s.name = %q{fuzzy_file_finder}
s.version = "1.0.4"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jamis Buck"]
s.date = %q{2008-10-12}
s.description = %q{an implementation of TextMate's cmd-T search functionality}
s.email = %q{jamis@jamisbuck.org}
s.extra_rdoc_files = ["lib/fuzzy_file_finder.rb", "README.rdoc"]
s.files = ["lib/fuzzy_file_finder.rb", "LICENSE", "Manifest", "README.rdoc", "fuzzy_file_finder.gemspec"]
s.has_rdoc = true
s.homepage = %q{}
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fuzzy_file_finder", "--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{fuzzy_file_finder}
s.rubygems_version = %q{1.2.0}
s.summary = %q{an implementation of TextMate's cmd-T search functionality}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if current_version >= 3 then
else
end
else
end
end


# # Original Rakefile source (requires the Echoe gem):
#
# begin
# require 'echoe'
# rescue LoadError
# abort "You'll need to have `echoe' installed to use Net::SSH's Rakefile"
# end
#
# require './lib/fuzzy_file_finder'
# version = FuzzyFileFinder::Version::STRING.dup
# if ENV['SNAPSHOT'].to_i == 1
# version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
# end
#
# Echoe.new('fuzzy_file_finder', version) do |p|
# p.author = "Jamis Buck"
# p.email = "jamis@jamisbuck.org"
# p.summary = "an implementation of TextMate's cmd-T search functionality"
#
# p.rdoc_pattern = /^(lib|README.rdoc)/
# end
Loading

0 comments on commit 973a7ae

Please sign in to comment.