aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2013-04-28 15:08:19 +0200
committerPeter Odding <peter@peterodding.com>2013-04-28 15:08:19 +0200
commita7ed49ed589cfe5f84bfeda317d03a874002e1a9 (patch)
treead03ea51d3b2d9154e630c19f3dc2d68f1ddfbd7
parenta744d4c5f0c6086251aab66ec68cb9299869b1e9 (diff)
downloadvim-easytags-a7ed49ed589cfe5f84bfeda317d03a874002e1a9.tar.gz
Change the repository layout to that of a proper Vim plug-in
-rw-r--r--README.md39
-rw-r--r--autoload/xolox/misc/buffer.vim (renamed from buffer.vim)0
-rw-r--r--autoload/xolox/misc/compat.vim (renamed from compat.vim)0
-rw-r--r--autoload/xolox/misc/complete.vim (renamed from complete.vim)0
-rw-r--r--autoload/xolox/misc/escape.vim (renamed from escape.vim)0
-rw-r--r--autoload/xolox/misc/list.vim (renamed from list.vim)0
-rw-r--r--autoload/xolox/misc/msg.vim (renamed from msg.vim)0
-rw-r--r--autoload/xolox/misc/open.vim (renamed from open.vim)0
-rw-r--r--autoload/xolox/misc/option.vim (renamed from option.vim)0
-rw-r--r--autoload/xolox/misc/os.vim (renamed from os.vim)0
-rw-r--r--autoload/xolox/misc/path.vim (renamed from path.vim)56
-rw-r--r--autoload/xolox/misc/str.vim (renamed from str.vim)0
-rw-r--r--autoload/xolox/misc/timer.vim (renamed from timer.vim)0
13 files changed, 55 insertions, 40 deletions
diff --git a/README.md b/README.md
index f375fe6..685d9c6 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,41 @@
# Miscellaneous auto-load Vim scripts
-The git repository at [github.com/xolox/vim-misc] [repository] contains Vim scripts that are used by most of the [Vim plug-ins I've written] [plugins] yet don't really belong with any single one. I include this repository as a subdirectory of my plug-in repositories using the following commands:
+The git repository at [github.com/xolox/vim-misc] [repository] contains Vim scripts that are used by most of the [Vim plug-ins I've written] [plugins] yet don't really belong with any single one of the plug-ins. Basically it's an extended standard library of Vim script functions that I wrote during the development of my Vim plug-ins.
- $ git remote add -f vim-misc https://github.com/xolox/vim-misc.git
- $ git merge -s ours --no-commit vim-misc/master
- $ git read-tree --prefix=autoload/xolox/misc/ -u vim-misc/master
- $ git commit -m "Merge vim-misc repository as subdirectory"
+The miscellaneous scripts are bundled with each of my plug-ins using git merges, so that a repository checkout of a plug-in contains everything that's needed to get started. This means the git repository of the miscellaneous scripts is only used to track changes in a central, public place.
-The above trick is called the [subtree merge strategy] [merge-strategy]. To update a plug-in repository to the latest version of the miscellaneous auto-load scripts I execute the following command:
+## How does it work?
- $ git pull -s subtree vim-misc master
+Here's how I merge the miscellaneous scripts into a Vim plug-in repository:
+
+1. Let git know about the `vim-misc` repository by adding the remote GitHub repository:
+
+ git remote add -f vim-misc https://github.com/xolox/vim-misc.git
+
+2. Merge the two directory trees without clobbering the `README.md` and/or `.gitignore` files, thanks to the selected merge strategy and options:
+
+ git checkout master
+ git merge --no-commit -s recursive -X ours vim-misc/master
+ git commit -m "Merge vim-misc repository as overlay"
+
+3. While steps 1 and 2 need to be done only once for a given repository, the following commands are needed every time I want to pull and merge the latest changes:
+
+ git checkout master
+ git fetch vim-misc master
+ git merge --no-commit -s recursive -X ours vim-misc/master
+ git commit -m "Merged changes to miscellaneous scripts"
## Why make things so complex?
I came up with this solution after multiple years of back and forth between Vim Online users, the GitHub crowd and my own sanity:
-1. When I started publishing my first Vim plug-ins I would prepare ZIP archives for Vim Online using makefiles. The makefiles would make sure the miscellaneous scripts were included in the uploaded distributions. This had two disadvantages: It lost git history and the repositories on GitHub were not usable out of the box, so [I got complaints from GitHub (Pathogen) users] [github-complaints].
+1. When I started publishing my first Vim plug-ins (in June 2010) I would prepare ZIP archives for Vim Online using makefiles. The makefiles would make sure the miscellaneous scripts were included in the uploaded distributions. This had two disadvantages: It lost git history and the repositories on GitHub were not usable out of the box, so [I got complaints from GitHub (Pathogen) users] [github-complaints].
+
+2. My second attempt to solve the problem used git submodules which seemed like the ideal solution until I actually started using them in March 2011: Submodules are not initialized during a normal `git clone`, you need to use `git clone --recursive` instead but Vim plug-in managers like [Pathogen] [pathogen] and [Vundle] [vundle] don't do this (at least [they didn't when I tried] [vundle-discussion]) so people would end up with broken checkouts.
-2. My second attempt to solve the problem used git submodules which seemed like the ideal solution until I actually started doing it. Submodules are not initialized during a normal `git clone`, you need to use `git clone --recursive` instead but Vim plug-in managers like [Pathogen] [pathogen] and [Vundle] [vundle] don't do this (at least [they didn't when I tried] [vundle-discussion]) so people would end up with broken checkouts.
+3. After finding out that git submodules were not going to solve my problems I searched for other inclusion strategies supported by git. After a while I came upon the [subtree merge strategy] [merge-strategy] which I started using in May 2011 and stuck with for more than two years (because it generally worked fine and seemed quite robust).
-3. After finding out that git submodules were not going to solve my problems I searched for other inclusion strategies supported by git. After a while I came upon the [subtree merge strategy] [merge-strategy] which I have been using for more than two years now.
+4. In April 2013 the flat layout of the repository started bothering me because it broke my personal workflow, so I changed it to the proper directory layout of a Vim plug-in. Why did it break my workflow? Because I couldn't get my [vim-reload] [reload] plug-in to properly reload miscellaneous scripts without nasty hacks. Note to self: [Dropbox does not respect symbolic links] [dropbox-vote-350] and Vim doesn't like them either ([E746] [E746]).
## Compatibility issues
@@ -39,11 +55,14 @@ This software is licensed under the [MIT license] [mit].
© 2013 Peter Odding &lt;<peter@peterodding.com>&gt;.
+[dropbox-vote-350]: https://www.dropbox.com/votebox/350/preserve-implement-symlink-behaviour
+[E746]: http://vimdoc.sourceforge.net/htmldoc/eval.html#E746
[github-complaints]: https://github.com/xolox/vim-easytags/issues/1
[merge-strategy]: http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
[mit]: http://en.wikipedia.org/wiki/MIT_License
[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332
[plugins]: http://peterodding.com/code/vim/
+[reload]: http://peterodding.com/code/vim/reload
[repository]: https://github.com/xolox/vim-misc
[vundle-discussion]: https://github.com/gmarik/vundle/pull/41
[vundle]: https://github.com/gmarik/vundle
diff --git a/buffer.vim b/autoload/xolox/misc/buffer.vim
index 3597cc2..3597cc2 100644
--- a/buffer.vim
+++ b/autoload/xolox/misc/buffer.vim
diff --git a/compat.vim b/autoload/xolox/misc/compat.vim
index 83d00a0..83d00a0 100644
--- a/compat.vim
+++ b/autoload/xolox/misc/compat.vim
diff --git a/complete.vim b/autoload/xolox/misc/complete.vim
index 2ada676..2ada676 100644
--- a/complete.vim
+++ b/autoload/xolox/misc/complete.vim
diff --git a/escape.vim b/autoload/xolox/misc/escape.vim
index 1dd1838..1dd1838 100644
--- a/escape.vim
+++ b/autoload/xolox/misc/escape.vim
diff --git a/list.vim b/autoload/xolox/misc/list.vim
index ee243d4..ee243d4 100644
--- a/list.vim
+++ b/autoload/xolox/misc/list.vim
diff --git a/msg.vim b/autoload/xolox/misc/msg.vim
index 9ba2b7c..9ba2b7c 100644
--- a/msg.vim
+++ b/autoload/xolox/misc/msg.vim
diff --git a/open.vim b/autoload/xolox/misc/open.vim
index 1fb24e0..1fb24e0 100644
--- a/open.vim
+++ b/autoload/xolox/misc/open.vim
diff --git a/option.vim b/autoload/xolox/misc/option.vim
index efaf1bc..efaf1bc 100644
--- a/option.vim
+++ b/autoload/xolox/misc/option.vim
diff --git a/os.vim b/autoload/xolox/misc/os.vim
index 451ca57..451ca57 100644
--- a/os.vim
+++ b/autoload/xolox/misc/os.vim
diff --git a/path.vim b/autoload/xolox/misc/path.vim
index 6f8fe44..67ef8d8 100644
--- a/path.vim
+++ b/autoload/xolox/misc/path.vim
@@ -1,12 +1,13 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: April 18, 2013
+" Last Change: April 22, 2013
" URL: http://peterodding.com/code/vim/misc/
let s:windows_compatible = has('win32') || has('win64')
let s:mac_os_x_compatible = has('macunix')
-function! xolox#misc#path#which(...)
+function! xolox#misc#path#which(...) " {{{1
+ " Scan the executable search path for programs.
let extensions = s:windows_compatible ? split($PATHEXT, ';') : ['']
let matches = []
let checked = {}
@@ -29,9 +30,8 @@ function! xolox#misc#path#which(...)
return matches
endfunction
-" Split a pathname into a list of path components.
-
-function! xolox#misc#path#split(path)
+function! xolox#misc#path#split(path) " {{{1
+ " Split a pathname into a list of path components.
if type(a:path) == type('')
if s:windows_compatible
return split(a:path, '[\/]\+')
@@ -44,9 +44,8 @@ function! xolox#misc#path#split(path)
return []
endfunction
-" Join a list of path components into a pathname.
-
-function! xolox#misc#path#join(parts)
+function! xolox#misc#path#join(parts) " {{{1
+ " Join a list of path components into a pathname.
if type(a:parts) == type([])
if !s:windows_compatible && a:parts[0] == '/'
return join(a:parts, '/')[1 : -1]
@@ -57,9 +56,10 @@ function! xolox#misc#path#join(parts)
return ''
endfunction
-" Canonicalize and resolve a pathname.
-
-function! xolox#misc#path#absolute(path)
+function! xolox#misc#path#absolute(path) " {{{1
+ " Canonicalize and resolve a pathname, regardless of whether it exists. This
+ " is intended to support string comparison to determine whether two pathnames
+ " point to the same directory or file.
if type(a:path) == type('')
let path = fnamemodify(a:path, ':p')
" resolve() doesn't work when there's a trailing path separator.
@@ -77,9 +77,8 @@ function! xolox#misc#path#absolute(path)
return ''
endfunction
-" Make an absolute pathname relative.
-
-function! xolox#misc#path#relative(path, base)
+function! xolox#misc#path#relative(path, base) " {{{1
+ " Make an absolute pathname relative.
let path = xolox#misc#path#split(a:path)
let base = xolox#misc#path#split(a:base)
while path != [] && base != [] && path[0] == base[0]
@@ -90,9 +89,9 @@ function! xolox#misc#path#relative(path, base)
return xolox#misc#path#join(distance + path)
endfunction
-" Join a directory and filename into a single pathname.
-function! xolox#misc#path#merge(parent, child, ...)
+function! xolox#misc#path#merge(parent, child, ...) " {{{1
+ " Join a directory and filename into a single pathname.
" TODO Use isabs()!
if type(a:parent) == type('') && type(a:child) == type('')
if s:windows_compatible
@@ -108,9 +107,8 @@ function! xolox#misc#path#merge(parent, child, ...)
return ''
endfunction
-" Find the common prefix of path components in a list of pathnames.
-
-function! xolox#misc#path#commonprefix(paths)
+function! xolox#misc#path#commonprefix(paths) " {{{1
+ " Find the common prefix of path components in a list of pathnames.
let common = xolox#misc#path#split(a:paths[0])
for path in a:paths
let index = 0
@@ -127,9 +125,8 @@ function! xolox#misc#path#commonprefix(paths)
return xolox#misc#path#join(common)
endfunction
-" Encode a pathname so it can be used as a filename.
-
-function! xolox#misc#path#encode(path)
+function! xolox#misc#path#encode(path) " {{{1
+ " Encode a pathname so it can be used as a filename.
if s:windows_compatible
let mask = '[*|\\/:"<>?%]'
elseif s:mac_os_x_compatible
@@ -140,12 +137,13 @@ function! xolox#misc#path#encode(path)
return substitute(a:path, mask, '\=printf("%%%x", char2nr(submatch(0)))', 'g')
endfunction
-" Decode a pathname previously encoded with xolox#misc#path#encode().
-function! xolox#misc#path#decode(encoded_path)
+function! xolox#misc#path#decode(encoded_path) " {{{1
+ " Decode a pathname previously encoded with xolox#misc#path#encode().
return substitute(a:encoded_path, '%\(\x\x\?\)', '\=nr2char("0x" . submatch(1))', 'g')
endfunction
+" xolox#misc#path#equals(a, b) {{{1
" Check whether two pathnames point to the same file.
if s:windows_compatible
@@ -158,9 +156,8 @@ else
endfunction
endif
-" Check whether a path is relative.
-
-function! xolox#misc#path#is_relative(path)
+function! xolox#misc#path#is_relative(path) " {{{1
+ " Check whether a path is relative.
if a:path =~ '^\w\+://'
return 0
elseif s:windows_compatible
@@ -170,9 +167,8 @@ function! xolox#misc#path#is_relative(path)
endif
endfunction
-" Create a temporary directory and return the path.
-
-function! xolox#misc#path#tempdir()
+function! xolox#misc#path#tempdir() " {{{1
+ " Create a temporary directory and return the path.
if !exists('s:tempdir_counter')
let s:tempdir_counter = 1
endif
diff --git a/str.vim b/autoload/xolox/misc/str.vim
index 74a05aa..74a05aa 100644
--- a/str.vim
+++ b/autoload/xolox/misc/str.vim
diff --git a/timer.vim b/autoload/xolox/misc/timer.vim
index 151972d..151972d 100644
--- a/timer.vim
+++ b/autoload/xolox/misc/timer.vim