dotman 0.0.3 → 0.0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dot +10 -1
- data/lib/dotman.rb +1 -0
- data/lib/dotman/collect.rb +27 -0
- data/lib/dotman/dotfile_collection.rb +8 -0
- data/lib/dotman/git.rb +0 -1
- data/lib/dotman/version.rb +1 -1
- data/spec/data/Timbinous_dotfiles/.bashrc +121 -0
- data/spec/data/Timbinous_dotfiles/.gitignore +5 -0
- data/spec/data/Timbinous_dotfiles/.tmux.conf +15 -0
- data/spec/data/Timbinous_dotfiles/.vim/autoload/pathogen.vim +245 -0
- data/spec/data/Timbinous_dotfiles/.vim/bundle/.gitkeep +0 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/Black.vim +16 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/Dark.vim +63 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/autumnleaf.vim +154 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/c.vim +32 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/darkzen.vim +25 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grb.vim +13 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grb.vim~ +13 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grb2.vim +59 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grb256.vim +32 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grb3.vim +23 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grb4.vim +17 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grblight.vim +15 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/grblight.vim~ +14 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/ir_black.vim +212 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/moria.vim +227 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/pyte.vim +92 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/redstring.vim +26 -0
- data/spec/data/Timbinous_dotfiles/.vim/colors/xterm16.vim +811 -0
- data/spec/data/Timbinous_dotfiles/.vim/spell/en.utf-8.add +5 -0
- data/spec/data/Timbinous_dotfiles/.vim/spell/en.utf-8.add.spl +0 -0
- data/spec/data/Timbinous_dotfiles/.vimrc +70 -0
- data/spec/data/Timbinous_dotfiles/.zshrc +62 -0
- data/spec/data/Timbinous_dotfiles/symlinkify +58 -0
- data/spec/data/Timbinous_dotfiles/tim.zsh-theme +29 -0
- data/spec/dotman/collect_spec.rb +59 -0
- data/spec/integration/dotfile_collection_integration_spec.rb +18 -4
- data/spec/integration/git_integration_spec.rb +6 -10
- data/spec/integration/user_integration_spec.rb +12 -5
- data/spec/spec_helper.rb +9 -1
- metadata +63 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ef282bbc9b22112fcaabe4c4c0dc89a08e47356
|
4
|
+
data.tar.gz: 9bb36932d204047c7bf959e4223b0a74bc191e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e276c0a2f577bf20cbdd72d8746e607911764db53233f7c7a3e563b88a37a64acb5a6949286bbae51f9cbe347d40840edf7e54dc32aed5031202f52c0bd2eb
|
7
|
+
data.tar.gz: 43922a67d3bf5f21190d965f3b2d5a1c5dcb040f6a56186624681763e13d4e69c238020a38af00710808306ed81e0392a42ae1f3b4925b27921ab4eda5245f11
|
data/bin/dot
CHANGED
@@ -10,6 +10,15 @@ when 'clone'
|
|
10
10
|
Dotman::Git.klone(ARGV[1], ARGV[2])
|
11
11
|
when 'use'
|
12
12
|
Dotman::User.set(ARGV[1])
|
13
|
+
when 'collect'
|
14
|
+
Dotman::Collect.new.create_dotman
|
15
|
+
when 'list'
|
16
|
+
Dotman::DotfileCollection.show_all_aliases
|
13
17
|
else
|
14
|
-
puts "USAGE:\
|
18
|
+
puts "USAGE:\n
|
19
|
+
dot clone git_repository alias : clone the dotfiles repo\n
|
20
|
+
dot use alias : use the dotfiles\n
|
21
|
+
dot use default : switch to the default dot files\n
|
22
|
+
dot collect : collects all dot files within a directory called dotfiles\n
|
23
|
+
dot list : lists all downloaded dotfile aliases"
|
15
24
|
end
|
data/lib/dotman.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Dotman
|
2
|
+
class Collect
|
3
|
+
|
4
|
+
def create_dotman
|
5
|
+
if !File.directory?("#{ENV['HOME']}/dotfiles")
|
6
|
+
FileUtils.mkdir("#{ENV['HOME']}/dotfiles")
|
7
|
+
end
|
8
|
+
collect_dotfiles
|
9
|
+
end
|
10
|
+
|
11
|
+
def collect_dotfiles
|
12
|
+
puts "collecting..."
|
13
|
+
Dir.entries("#{ENV['HOME']}").each do |file|
|
14
|
+
if file =~ /^.{1}[a-zA-Z1-9]+\z/
|
15
|
+
copy_over_dot file
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def copy_over_dot file
|
21
|
+
if !File.directory?("#{ENV['HOME']}/#{file}")
|
22
|
+
puts "copying #{file} to dotfiles"
|
23
|
+
FileUtils.copy "#{ENV['HOME']}/#{file}", "#{ENV['HOME']}/dotfiles"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -26,7 +26,15 @@ DOTFILES_PATH = "#{ENV['HOME']}/.dotman/dotfiles.yml"
|
|
26
26
|
})
|
27
27
|
save_dotfile_yaml
|
28
28
|
end
|
29
|
+
|
30
|
+
def self.all_aliases
|
31
|
+
ensure_default_dotfile_configuration_exists
|
32
|
+
dotfiles_yaml.collect {|dfy| dfy.first }
|
33
|
+
end
|
29
34
|
|
35
|
+
def self.show_all_aliases
|
36
|
+
STDOUT.puts all_aliases.join("\n")
|
37
|
+
end
|
30
38
|
|
31
39
|
def all_dotfiles
|
32
40
|
Dir.entries("#{Dotman::Base.dotman_folder}/#{@yaml['folder_name']}").select{|x| x =~ /\.{1}\w+[^git]/ }
|
data/lib/dotman/git.rb
CHANGED
@@ -3,7 +3,6 @@ module Dotman
|
|
3
3
|
def self.klone(git_location, alias_name = nil)
|
4
4
|
unless git_location.nil?
|
5
5
|
Dotman::Base.ensure_dotman_folder_exists
|
6
|
-
puts "ENSURING DOTMAN FOLDER EXISTS"
|
7
6
|
Dotman::Base.ensure_default_folder_exists
|
8
7
|
Dotman::Base.ensure_current_dotman_file_exists
|
9
8
|
clone_repository(git_location, alias_name)
|
data/lib/dotman/version.rb
CHANGED
@@ -0,0 +1,121 @@
|
|
1
|
+
# ~/.bashrc: executed by bash(1) for non-login shells.
|
2
|
+
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
3
|
+
# for examples
|
4
|
+
|
5
|
+
# If not running interactively, don't do anything
|
6
|
+
[ -z "$PS1" ] && return
|
7
|
+
|
8
|
+
# don't put duplicate lines in the history. See bash(1) for more options
|
9
|
+
# ... or force ignoredups and ignorespace
|
10
|
+
HISTCONTROL=ignoredups:ignorespace
|
11
|
+
|
12
|
+
# append to the history file, don't overwrite it
|
13
|
+
shopt -s histappend
|
14
|
+
|
15
|
+
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
16
|
+
HISTSIZE=1000
|
17
|
+
HISTFILESIZE=2000
|
18
|
+
|
19
|
+
# check the window size after each command and, if necessary,
|
20
|
+
# update the values of LINES and COLUMNS.
|
21
|
+
shopt -s checkwinsize
|
22
|
+
|
23
|
+
# make less more friendly for non-text input files, see lesspipe(1)
|
24
|
+
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
25
|
+
|
26
|
+
# set variable identifying the chroot you work in (used in the prompt below)
|
27
|
+
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
28
|
+
debian_chroot=$(cat /etc/debian_chroot)
|
29
|
+
fi
|
30
|
+
|
31
|
+
# set a fancy prompt (non-color, unless we know we "want" color)
|
32
|
+
case "$TERM" in
|
33
|
+
xterm-color) color_prompt=yes;;
|
34
|
+
esac
|
35
|
+
|
36
|
+
# uncomment for a colored prompt, if the terminal has the capability; turned
|
37
|
+
# off by default to not distract the user: the focus in a terminal window
|
38
|
+
# should be on the output of commands, not on the prompt
|
39
|
+
#force_color_prompt=yes
|
40
|
+
|
41
|
+
if [ -n "$force_color_prompt" ]; then
|
42
|
+
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
43
|
+
# We have color support; assume it's compliant with Ecma-48
|
44
|
+
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
45
|
+
# a case would tend to support setf rather than setaf.)
|
46
|
+
color_prompt=yes
|
47
|
+
else
|
48
|
+
color_prompt=
|
49
|
+
fi
|
50
|
+
fi
|
51
|
+
|
52
|
+
if [ "$color_prompt" = yes ]; then
|
53
|
+
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
54
|
+
else
|
55
|
+
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
56
|
+
fi
|
57
|
+
unset color_prompt force_color_prompt
|
58
|
+
|
59
|
+
# If this is an xterm set the title to user@host:dir
|
60
|
+
case "$TERM" in
|
61
|
+
xterm*|rxvt*)
|
62
|
+
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
63
|
+
;;
|
64
|
+
*)
|
65
|
+
;;
|
66
|
+
esac
|
67
|
+
|
68
|
+
# enable color support of ls and also add handy aliases
|
69
|
+
if [ -x /usr/bin/dircolors ]; then
|
70
|
+
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
71
|
+
alias ls='ls --color=auto'
|
72
|
+
#alias dir='dir --color=auto'
|
73
|
+
#alias vdir='vdir --color=auto'
|
74
|
+
|
75
|
+
alias grep='grep --color=auto'
|
76
|
+
alias fgrep='fgrep --color=auto'
|
77
|
+
alias egrep='egrep --color=auto'
|
78
|
+
fi
|
79
|
+
|
80
|
+
# some more ls aliases
|
81
|
+
alias ll='ls -alF'
|
82
|
+
alias la='ls -A'
|
83
|
+
alias l='ls -CF'
|
84
|
+
|
85
|
+
# Add an "alert" alias for long running commands. Use like so:
|
86
|
+
# sleep 10; alert
|
87
|
+
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
88
|
+
|
89
|
+
# Alias definitions.
|
90
|
+
# You may want to put all your additions into a separate file like
|
91
|
+
# ~/.bash_aliases, instead of adding them here directly.
|
92
|
+
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
93
|
+
|
94
|
+
if [ -f ~/.bash_aliases ]; then
|
95
|
+
. ~/.bash_aliases
|
96
|
+
fi
|
97
|
+
|
98
|
+
# enable programmable completion features (you don't need to enable
|
99
|
+
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
100
|
+
# sources /etc/bash.bashrc).
|
101
|
+
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
102
|
+
. /etc/bash_completion
|
103
|
+
fi
|
104
|
+
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
105
|
+
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
|
106
|
+
|
107
|
+
function tmux-start {
|
108
|
+
tmux -S /tmux/$1 new-session -s $1 -d
|
109
|
+
chmod 777 /tmux/$1
|
110
|
+
tmux -S /tmux/$1 attach -t $1
|
111
|
+
}
|
112
|
+
|
113
|
+
function tmux-join {
|
114
|
+
tmux -S /tmux/$1 new-session -t $1
|
115
|
+
}
|
116
|
+
|
117
|
+
function tmux-list {
|
118
|
+
ps -o ruser,command -ax | grep '[n]ew-session -s' | ruby -ne '$_ =~ /^(\w+).*-s (\w+)/; puts "#{$1} started #{$2}"'
|
119
|
+
}
|
120
|
+
|
121
|
+
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
|
@@ -0,0 +1,15 @@
|
|
1
|
+
set-option -g prefix C-a
|
2
|
+
unbind-key C-b
|
3
|
+
bind-key C-a send-prefix
|
4
|
+
set-window-option -g mode-keys vi
|
5
|
+
unbind-key j
|
6
|
+
bind-key j select-pane -D
|
7
|
+
|
8
|
+
unbind-key k
|
9
|
+
bind-key k select-pane -U
|
10
|
+
|
11
|
+
unbind-key h
|
12
|
+
bind-key h select-pane -L
|
13
|
+
|
14
|
+
unbind-key l
|
15
|
+
bind-key l select-pane -R
|
@@ -0,0 +1,245 @@
|
|
1
|
+
" pathogen.vim - path option manipulation
|
2
|
+
" Maintainer: Tim Pope <http://tpo.pe/>
|
3
|
+
" Version: 2.0
|
4
|
+
|
5
|
+
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
6
|
+
"
|
7
|
+
" For management of individually installed plugins in ~/.vim/bundle (or
|
8
|
+
" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc
|
9
|
+
" prior to `filetype plugin indent on` is the only other setup necessary.
|
10
|
+
"
|
11
|
+
" The API is documented inline below. For maximum ease of reading,
|
12
|
+
" :set foldmethod=marker
|
13
|
+
|
14
|
+
if exists("g:loaded_pathogen") || &cp
|
15
|
+
finish
|
16
|
+
endif
|
17
|
+
let g:loaded_pathogen = 1
|
18
|
+
|
19
|
+
" Point of entry for basic default usage. Give a directory name to invoke
|
20
|
+
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path
|
21
|
+
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards,
|
22
|
+
" pathogen#cycle_filetype() is invoked.
|
23
|
+
function! pathogen#infect(...) abort " {{{1
|
24
|
+
let source_path = a:0 ? a:1 : 'bundle'
|
25
|
+
if source_path =~# '[\\/]'
|
26
|
+
call pathogen#runtime_prepend_subdirectories(source_path)
|
27
|
+
else
|
28
|
+
call pathogen#runtime_append_all_bundles(source_path)
|
29
|
+
endif
|
30
|
+
call pathogen#cycle_filetype()
|
31
|
+
endfunction " }}}1
|
32
|
+
|
33
|
+
" Split a path into a list.
|
34
|
+
function! pathogen#split(path) abort " {{{1
|
35
|
+
if type(a:path) == type([]) | return a:path | endif
|
36
|
+
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
37
|
+
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
38
|
+
endfunction " }}}1
|
39
|
+
|
40
|
+
" Convert a list to a path.
|
41
|
+
function! pathogen#join(...) abort " {{{1
|
42
|
+
if type(a:1) == type(1) && a:1
|
43
|
+
let i = 1
|
44
|
+
let space = ' '
|
45
|
+
else
|
46
|
+
let i = 0
|
47
|
+
let space = ''
|
48
|
+
endif
|
49
|
+
let path = ""
|
50
|
+
while i < a:0
|
51
|
+
if type(a:000[i]) == type([])
|
52
|
+
let list = a:000[i]
|
53
|
+
let j = 0
|
54
|
+
while j < len(list)
|
55
|
+
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
56
|
+
let path .= ',' . escaped
|
57
|
+
let j += 1
|
58
|
+
endwhile
|
59
|
+
else
|
60
|
+
let path .= "," . a:000[i]
|
61
|
+
endif
|
62
|
+
let i += 1
|
63
|
+
endwhile
|
64
|
+
return substitute(path,'^,','','')
|
65
|
+
endfunction " }}}1
|
66
|
+
|
67
|
+
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
68
|
+
function! pathogen#legacyjoin(...) abort " {{{1
|
69
|
+
return call('pathogen#join',[1] + a:000)
|
70
|
+
endfunction " }}}1
|
71
|
+
|
72
|
+
" Remove duplicates from a list.
|
73
|
+
function! pathogen#uniq(list) abort " {{{1
|
74
|
+
let i = 0
|
75
|
+
let seen = {}
|
76
|
+
while i < len(a:list)
|
77
|
+
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
78
|
+
call remove(a:list,i)
|
79
|
+
elseif a:list[i] ==# ''
|
80
|
+
let i += 1
|
81
|
+
let empty = 1
|
82
|
+
else
|
83
|
+
let seen[a:list[i]] = 1
|
84
|
+
let i += 1
|
85
|
+
endif
|
86
|
+
endwhile
|
87
|
+
return a:list
|
88
|
+
endfunction " }}}1
|
89
|
+
|
90
|
+
" \ on Windows unless shellslash is set, / everywhere else.
|
91
|
+
function! pathogen#separator() abort " {{{1
|
92
|
+
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
93
|
+
endfunction " }}}1
|
94
|
+
|
95
|
+
" Convenience wrapper around glob() which returns a list.
|
96
|
+
function! pathogen#glob(pattern) abort " {{{1
|
97
|
+
let files = split(glob(a:pattern),"\n")
|
98
|
+
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
|
99
|
+
endfunction "}}}1
|
100
|
+
|
101
|
+
" Like pathogen#glob(), only limit the results to directories.
|
102
|
+
function! pathogen#glob_directories(pattern) abort " {{{1
|
103
|
+
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
104
|
+
endfunction "}}}1
|
105
|
+
|
106
|
+
" Turn filetype detection off and back on again if it was already enabled.
|
107
|
+
function! pathogen#cycle_filetype() " {{{1
|
108
|
+
if exists('g:did_load_filetypes')
|
109
|
+
filetype off
|
110
|
+
filetype on
|
111
|
+
endif
|
112
|
+
endfunction " }}}1
|
113
|
+
|
114
|
+
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
|
115
|
+
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde.
|
116
|
+
function! pathogen#is_disabled(path) " {{{1
|
117
|
+
if a:path =~# '\~$'
|
118
|
+
return 1
|
119
|
+
elseif !exists("g:pathogen_disabled")
|
120
|
+
return 0
|
121
|
+
endif
|
122
|
+
let sep = pathogen#separator()
|
123
|
+
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
|
124
|
+
endfunction "}}}1
|
125
|
+
|
126
|
+
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
127
|
+
" directories in those subdirectories.
|
128
|
+
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
|
129
|
+
let sep = pathogen#separator()
|
130
|
+
let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)')
|
131
|
+
let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
|
132
|
+
let rtp = pathogen#split(&rtp)
|
133
|
+
let path = expand(a:path)
|
134
|
+
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
|
135
|
+
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
|
136
|
+
return &rtp
|
137
|
+
endfunction " }}}1
|
138
|
+
|
139
|
+
" For each directory in rtp, check for a subdirectory named dir. If it
|
140
|
+
" exists, add all subdirectories of that subdirectory to the rtp, immediately
|
141
|
+
" after the original directory. If no argument is given, 'bundle' is used.
|
142
|
+
" Repeated calls with the same arguments are ignored.
|
143
|
+
function! pathogen#runtime_append_all_bundles(...) " {{{1
|
144
|
+
let sep = pathogen#separator()
|
145
|
+
let name = a:0 ? a:1 : 'bundle'
|
146
|
+
if "\n".s:done_bundles =~# "\\M\n".name."\n"
|
147
|
+
return ""
|
148
|
+
endif
|
149
|
+
let s:done_bundles .= name . "\n"
|
150
|
+
let list = []
|
151
|
+
for dir in pathogen#split(&rtp)
|
152
|
+
if dir =~# '\<after$'
|
153
|
+
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
|
154
|
+
else
|
155
|
+
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
|
156
|
+
endif
|
157
|
+
endfor
|
158
|
+
let &rtp = pathogen#join(pathogen#uniq(list))
|
159
|
+
return 1
|
160
|
+
endfunction
|
161
|
+
|
162
|
+
let s:done_bundles = ''
|
163
|
+
" }}}1
|
164
|
+
|
165
|
+
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
166
|
+
function! pathogen#helptags() " {{{1
|
167
|
+
let sep = pathogen#separator()
|
168
|
+
for dir in pathogen#split(&rtp)
|
169
|
+
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
|
170
|
+
helptags `=dir.'/doc'`
|
171
|
+
endif
|
172
|
+
endfor
|
173
|
+
endfunction " }}}1
|
174
|
+
|
175
|
+
command! -bar Helptags :call pathogen#helptags()
|
176
|
+
|
177
|
+
" Like findfile(), but hardcoded to use the runtimepath.
|
178
|
+
function! pathogen#runtime_findfile(file,count) "{{{1
|
179
|
+
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
180
|
+
return fnamemodify(findfile(a:file,rtp,a:count),':p')
|
181
|
+
endfunction " }}}1
|
182
|
+
|
183
|
+
" Backport of fnameescape().
|
184
|
+
function! pathogen#fnameescape(string) " {{{1
|
185
|
+
if exists('*fnameescape')
|
186
|
+
return fnameescape(a:string)
|
187
|
+
elseif a:string ==# '-'
|
188
|
+
return '\-'
|
189
|
+
else
|
190
|
+
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
191
|
+
endif
|
192
|
+
endfunction " }}}1
|
193
|
+
|
194
|
+
function! s:find(count,cmd,file,lcd) " {{{1
|
195
|
+
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
196
|
+
let file = pathogen#runtime_findfile(a:file,a:count)
|
197
|
+
if file ==# ''
|
198
|
+
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
|
199
|
+
elseif a:lcd
|
200
|
+
let path = file[0:-strlen(a:file)-2]
|
201
|
+
execute 'lcd `=path`'
|
202
|
+
return a:cmd.' '.pathogen#fnameescape(a:file)
|
203
|
+
else
|
204
|
+
return a:cmd.' '.pathogen#fnameescape(file)
|
205
|
+
endif
|
206
|
+
endfunction " }}}1
|
207
|
+
|
208
|
+
function! s:Findcomplete(A,L,P) " {{{1
|
209
|
+
let sep = pathogen#separator()
|
210
|
+
let cheats = {
|
211
|
+
\'a': 'autoload',
|
212
|
+
\'d': 'doc',
|
213
|
+
\'f': 'ftplugin',
|
214
|
+
\'i': 'indent',
|
215
|
+
\'p': 'plugin',
|
216
|
+
\'s': 'syntax'}
|
217
|
+
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
|
218
|
+
let request = cheats[a:A[0]].a:A[1:-1]
|
219
|
+
else
|
220
|
+
let request = a:A
|
221
|
+
endif
|
222
|
+
let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*'
|
223
|
+
let found = {}
|
224
|
+
for path in pathogen#split(&runtimepath)
|
225
|
+
let path = expand(path, ':p')
|
226
|
+
let matches = split(glob(path.sep.pattern),"\n")
|
227
|
+
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
|
228
|
+
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
|
229
|
+
for match in matches
|
230
|
+
let found[match] = 1
|
231
|
+
endfor
|
232
|
+
endfor
|
233
|
+
return sort(keys(found))
|
234
|
+
endfunction " }}}1
|
235
|
+
|
236
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
237
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
238
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
|
239
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
|
240
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
|
241
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
|
242
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
|
243
|
+
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
|
244
|
+
|
245
|
+
" vim:set ft=vim ts=8 sw=2 sts=2:
|