changeset 299:8959592285b9

Merge changes.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 20 May 2015 16:15:19 -0700
parents ffa5a9102d22 (diff) 27447ad19df6 (current diff)
children 65165c2de85e
files
diffstat 10 files changed, 311 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sat Mar 07 11:09:04 2015 -0800
+++ b/.hgignore	Wed May 20 16:15:19 2015 -0700
@@ -8,6 +8,8 @@
 .netrwhist
 hgrc/hgrc-local
 vim/vimrc-local
+vim/local/
 weechat/logs
 weechat/*.log
+mutt/*.gpg
 
--- a/.hgsub	Sat Mar 07 11:09:04 2015 -0800
+++ b/.hgsub	Wed May 20 16:15:19 2015 -0700
@@ -40,6 +40,10 @@
 lib/hg/mercurial-cli-templates = https://bitbucket.org/sjl/mercurial-cli-templates
 lib/hg/hg-prompt = https://bitbucket.org/sjl/hg-prompt
 lib/hg/mutable-history = https://bitbucket.org/marmoute/mutable-history
+lib/hg/terse-status = https://bitbucket.org/durin42/terse-status
+lib/hg/hgremotenames = https://bitbucket.org/seanfarley/hgremotenames
 
 lib/fish/virtualfish = [git]https://github.com/adambrenecki/virtualfish.git
 
+pentadactyl/plugins/pintaboard = [git]https://github.com/bnbeckwith/pintaboard.git
+
--- a/.hgsubstate	Sat Mar 07 11:09:04 2015 -0800
+++ b/.hgsubstate	Wed May 20 16:15:19 2015 -0700
@@ -1,38 +1,41 @@
-17a51b56d88bd1f1826945413790c482032bb8d3 lib/fish/virtualfish
+ce7fac3bbdf0e530c06e6dc23856b2282ca02200 lib/fish/virtualfish
 f8703c9e2fb951ebb193b268faf7f0457abf8334 lib/hg/allpaths
-d40de32ec5b1380ed20888c744d4f8f468fbf226 lib/hg/hg-git
+93689e8f27ac657feed5332b71e66210c3a81cbf lib/hg/hg-git
 1cb3af183d2f692622f84da88d5ca18bd4f91b1f lib/hg/hg-prompt
+214cd3c6ab6f76b7aaed0b3f8f4300d09f7cb560 lib/hg/hgremotenames
 66e2a34005b447d321a96838d7fe2b161e78b7a9 lib/hg/mercurial-cli-templates
-1df0bf41016cc640eec03bfbd5938f5639b2f387 lib/hg/mutable-history
+792998917ece57f303faefec01ad5b1fafb9036f lib/hg/mutable-history
 d920e3425db554497a2cfaf1a2548eafbdc8b0e7 lib/hg/onsub
+2d9820cf595263bc7c651295b83f02525a23ca4a lib/hg/terse-status
 3b23c55eb43849975656dd89e3f35dacd2b93e69 mutt/mutt-colors-solarized
+14897c793e0978e88967afbcd2d8e85041febceb pentadactyl/plugins/pintaboard
 db3707cbd8706f4bb054959ecc5cee82ac45687b vim/bundle/badwolf
 81c6dd7ce3169e5ad9ba92422ba6e1ce5b074e36 vim/bundle/colorschemes
 9c685131a5facfa0d643feca3a61b41c007d8170 vim/bundle/commentary
-faafe125db65c4a3b9537a60a968e723b88a6c8f vim/bundle/ctrlp
-0b311aa53a49be0c74aa784274a70441dd40b2e7 vim/bundle/ctrlp-autoignore
-9ceebf91fc137644cf0693561a386ef4071dbf87 vim/bundle/easymotion
-2c8461db084d205903a792a23163faa546f143c9 vim/bundle/fugitive
+f2effdc86abf172d6562ec589fa1aa2c8f136a08 vim/bundle/ctrlp
+634d881b6ac6b1283e24229af3fc736faaa899ec vim/bundle/ctrlp-autoignore
+8acdfc60e58bb0600ded42a4f752bec6e3b6d882 vim/bundle/easymotion
+4cc201cbe3a0c3faa4cde1b82ba941d410e5e81c vim/bundle/fugitive
 eb9fc8676b8959c3c2c95bf6b6e8f0f44317c5c0 vim/bundle/gundo
-8b3c611a4d3b0f9ea62091925cc9b8137ddd5054 vim/bundle/gutentags
+50d2a7cbf7c8743e022377a87326d2e1d69f7a0e vim/bundle/gutentags
 204e32721154766e03e99ff857bc798aa5b741dc vim/bundle/haml
 6e0ac033107bd12c1390cbdf49398393930f3fb6 vim/bundle/interestingwords
 8a8f0ed97c1751d304cf5b7241f2fe27b0e61f81 vim/bundle/jinja
-7da11e02977391513169d166f5ebbe9c1d030627 vim/bundle/lawrencium
-940a8defa0576385dee1ad177bab0b34738540aa vim/bundle/less
-b69e54f4bf0a0ee26f6582ee8764b25529610c88 vim/bundle/linediff
+7cfe9ba2c7dd99c25bbf2992fe928447e0b3de4a vim/bundle/lawrencium
+902870b38df5f22803532141f11a82c74bed5ab5 vim/bundle/less
+d51993ebc0227114443379b72ed2a8667731d17f vim/bundle/linediff
 409c37b205afa2f9d590e23de8171482d66770e2 vim/bundle/markdown
 3b98a7fcae8f9fff356907171f0406ff8cd28921 vim/bundle/nerdtree
 af8514b79c046a6bb447021b81351edb050ac69f vim/bundle/piecrust
 114f8e5c204f1cac9b2443065910fa182de39fb8 vim/bundle/powerline
 c6a872a64530979f4aac46d765c577581cb7fc36 vim/bundle/pythonmode
-07115a6dee0ae01b7c9c3d92e9ee3219b6780b77 vim/bundle/ragtag
-5eba0f19c87402643eb8a7e7d20d9d5338fd6d71 vim/bundle/repeat
+bef689a4d5ceb10bbe1b5aa216394bc3197a1258 vim/bundle/ragtag
+c4f9f159e66a00e148b05d3c97c20072777d559f vim/bundle/repeat
 528a59f26d12278698bb946f8fb82a63711eec21 vim/bundle/solarized
-b0ca47f4570385043f270f9278ba6d50d1d2fa00 vim/bundle/supertab
-fa433e0b7330753688f715f3be5d10dc480f20e5 vim/bundle/surround
-0da7a1e476ef03be22718e813fbc729f9dc163b4 vim/bundle/syntastic
-bfc121dc38271ab3f050609bb2ca377de07d8bd6 vim/bundle/tagbar
+c8bfeceb1fc92ad58f2ae6967cbfcd6fbcb0d6e7 vim/bundle/supertab
+772ab9587b7d1e2c3bae75395c9123803059ba8a vim/bundle/surround
+48090a19f21a3c602b85e59605c0f2a41e5fc69d vim/bundle/syntastic
+c6b473f5593a1cb9e567bb1a9a897f196f1f720a vim/bundle/tagbar
 869c05195086dd1af9fe39e49621f9f880b6f07c vim/bundle/twig
 b9d1fa7d460dac878cbc8c945a45439d92ce0cb2 vim/bundle/vimroom
 a884f3a161fa3cd8c996eb53a3d1c68631f60c21 vim/bundle/yankring
--- a/git/gitconfig	Sat Mar 07 11:09:04 2015 -0800
+++ b/git/gitconfig	Wed May 20 16:15:19 2015 -0700
@@ -5,3 +5,8 @@
 [push]
 default = simple
 
+[alias]
+lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
+lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
+lg = !"git lg1"
+
--- a/install.cmd	Sat Mar 07 11:09:04 2015 -0800
+++ b/install.cmd	Wed May 20 16:15:19 2015 -0700
@@ -29,20 +29,26 @@
 echo onsub = %CWD:\=/%lib/hg/onsub/onsub.py >> "%userprofile%\mercurial.ini"
 echo allpaths = %CWD:\=/%lib/hg/allpaths/allpaths.py >> "%userprofile%\mercurial.ini"
 echo prompt = %CWD:\=/%lib/hg/hg-prompt/prompt.py >> "%userprofile%\mercurial.ini"
+echo changelog = %CWD:\=/%lib/hg/changelog/changelog.py >> "%userprofile%\mercurial.ini"
+echo evolve = %CWD:\=/%lib/hg/mutable-history/hgext/evolve.py >> "%userprofile%\mercurial.ini"
+echo terse-status = %CWD:\=/%lib/hg/terse-status/terse-status.py >> "%userprofile%\mercurial.ini"
+echo remotenames = %CWD:\=/%lib/hg/hgremotenames/remotenames.py >> "%userprofile%\mercurial.ini"
 
 :: Git Files
 if exist "%userprofile%\.gitconfig" (
     set /P confirm=Will delete existing "%userprofile%\.gitconfig". OK with that? Press CTRL-C to abort.
     del /Q "%userprofile%\.gitconfig"
 )
-copy "%CWD%git\gitconfig" "%userprofile%\.gitconfig"
+echo [include] > "%userprofile%\.gitconfig"
+echo path = %CWD:\=/%git/gitconfig >> "%userprofile%\.gitconfig"
 
 :: Web Browser
 if exist "%userprofile%\_pentadactylrc" (
     set /P confirm=Will delete existing "%userprofile%\_pentadactylrc". OK with that? Press CTRL-C to abort.
     del /Q "%userprofile%\_pentadactylrc"
 )
-echo source %CWD:\=/%pentadactylrc > "%userprofile%\_pentadactylrc"
+echo set runtimepath=~/.pentadactyl,%CWD:\=/%pentadactyl > "%userprofile%\_pentadactylrc"
+echo source %CWD:\=/%pentadactyl/pentadactylrc >> "%userprofile%\_pentadactylrc"
 
 :: Console 2
 if exist "%appdata%\Console\console.xml" (
--- a/install.sh	Sat Mar 07 11:09:04 2015 -0800
+++ b/install.sh	Wed May 20 16:15:19 2015 -0700
@@ -29,14 +29,17 @@
 echo prompt = $CWD/lib/hg/hg-prompt/prompt.py >> "$HOME/.hgrc"
 echo changelog = $CWD/lib/hg/changelog/changelog.py >> "$HOME/.hgrc"
 echo evolve = $CWD/lib/hg/mutable-history/hgext/evolve.py >> "$HOME/.hgrc"
+echo terse-status = $CWD/lib/hg/terse-status/terse-status.py >> "$HOME/.hgrc"
+echo remotenames = $CWD/lib/hg/hgremotenames/remotenames.py >> "$HOME/.hgrc"
 
 # GIT
 # ---
-cp "$CWD/git/gitconfig" "$HOME/.gitconfig"
+ln -s "$CWD/git/gitconfig" "$HOME/.gitconfig"
 
 # WEB BROWSER
 # -----------
-ln -s "$CWD/pentadactylrc" "$HOME/.pentadactylrc"
+echo set runtimepath=~/.pentadactyl,$CWD/pentadactyl > "$HOME/.pentadactylrc"
+echo source "$CWD/pentadactyl/pentadactylrc" >> "$HOME/.pentadactylrc"
 
 # TMUX
 # ----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/hg/hggit_sync.py	Wed May 20 16:15:19 2015 -0700
@@ -0,0 +1,94 @@
+import os
+import os.path
+import sys
+import subprocess
+
+
+class CommitInfo(object):
+    def __init__(self):
+        self.nodeid = None
+        self.timestamp = None
+        self.description = None
+
+
+def parse_commits(text):
+    commits = []
+    cur_commit = None
+    for line in text.split('\n'):
+        if line == '':
+            if cur_commit:
+                commits.append(cur_commit)
+                cur_commit = None
+            continue
+        if cur_commit is None:
+            cur_commit = CommitInfo()
+        if cur_commit.nodeid is None:
+            id_and_date = line.split(' ', 1)
+            cur_commit.nodeid = id_and_date[0]
+            cur_commit.timestamp = int(id_and_date[1].split('.')[0])
+        else:
+            cur_commit.description = line
+    return commits
+
+
+def build_commit_map(commits1, commits2):
+    commits1 = sorted(commits1, key=lambda c: c.timestamp)
+    commits2 = sorted(commits2, key=lambda c: c.timestamp)
+    commit_map = dict(map(lambda c: (c.timestamp, (c, None)), commits1))
+    for c in commits2:
+        entry = commit_map.get(c.timestamp, (None, None))
+        entry = (entry[0], c)
+        commit_map[c.timestamp] = entry
+    return commit_map
+
+
+def main():
+    hg_repo = os.getcwd()
+    if not os.path.exists(os.path.join(hg_repo, '.hg')):
+        print "You must run this in the root of a Mercurial repository."
+        return 1
+
+    git_repo = os.path.join(hg_repo, '.hg', 'git')
+    if not os.path.exists(git_repo):
+        print ("This Mercurial repository doesn't seem to have any Git mirror "
+               "to sync with.")
+        return 1
+
+    hg_output = subprocess.check_output([
+        'hg', 'log',
+        '--template', "{node} {date}\n{firstline(desc)}\n\n"])
+    hg_commits = parse_commits(hg_output)
+
+    os.chdir(git_repo)
+    git_output = subprocess.check_output([
+        'git', 'log', '--format=%H %ct%n%s%n%n'])
+    git_commits = parse_commits(git_output)
+    os.chdir(hg_repo)
+
+    commit_map = build_commit_map(git_commits, hg_commits)
+    for key, val in commit_map.iteritems():
+        if val[0] is None:
+            print ("Mercurial commit '%s' (%s) has no Git mirror yet: %s" %
+                   (val[1].nodeid, val[1].timestamp, val[1].description))
+        if val[1] is None:
+            print ("Git commit '%s' (%s) is new: %s" %
+                   (val[0].nodeid, val[0].timestamp, val[0].description))
+
+    map_file = os.path.join(hg_repo, '.hg', 'git-mapfile')
+    if len(sys.argv) > 1:
+        map_file = sys.argv[1]
+    print "Saving map file: %s" % map_file
+    with open(map_file, 'w') as fp:
+        for key, val in commit_map.iteritems():
+            if val[0] is None or val[1] is None:
+                continue
+            fp.write(val[0].nodeid)
+            fp.write(' ')
+            fp.write(val[1].nodeid)
+            fp.write('\n')
+
+
+if __name__ == '__main__':
+    res = main()
+    sys.exit(res)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pentadactyl/pentadactylrc	Wed May 20 16:15:19 2015 -0700
@@ -0,0 +1,103 @@
+" Config for Pentadactyl
+
+" Scroll faster
+nmap -builtin h 3h
+nmap -builtin j 3j
+nmap -builtin k 3k
+nmap -builtin l 3l
+
+" Scroll easier
+nmap -builtin d <C-d>
+nmap -builtin e <C-u>
+
+" Close tab with `x` since `d` is for scrolling down now
+nmap -builtin x :bd<cr>
+
+" Don't close the window with the last tab.
+set! browser.tabs.closeWindowWithLastTab=false
+
+" Change tabs without awkward `CTRL` combinations
+nmap -builtin J :tabprevious<cr>
+nmap -builtin K :tabnext<cr>
+
+" Reorder tabs
+nmap -builtin > :tabmove! +1<cr>
+nmap -builtin < :tabmove! -1<cr>
+
+"New tab using the old classic way
+nmap -builtin <C-t> :tabnew<cr>
+
+" Use `i` to get into pass-through mode,
+" `I` for temporary pass-through mode,
+" and `c` for the 'caret' mode.
+nmap -builtin i <C-z>
+nmap -builtin I <C-v>
+nmap -builtin c i
+
+" Shortcuts for common extensions
+nmap -builtin ,f i<D-\>
+nmap -builtin ,p <S-Esc><A-D-\>
+nmap -builtin ,b I<A-b>
+
+" Use and quickly hide search highlighting
+set hlfind
+nmap -builtin ,<Space> :noh<cr>
+
+" Aw come on, copy/pasting is ridiculous by default.
+map -builtin -modes=i,c,v <C-c> <C-v><C-c>
+map -builtin -modes=i,c   <C-x> <C-v><C-x>
+map -builtin -modes=i,c   <C-v> <C-v><C-v>
+
+" Quickly open some dialogs
+nmap -builtin ,b :downloads<cr>
+
+" On keyboards like the Leopold FC660C, for some obscure reason, the
+" <Insert> key sends the <Help> ID. WTF.
+noremap <Help> <Insert>
+
+" DDG FTW
+set defsearch=duckduckgo
+
+" Super minimal UI
+"set toolbars=noaddons,nobookmarks,nomenu,nonavigation,notabs
+
+" Websites with useful keyboard shortcuts already
+set passkeys+=fastmail.com:jkomxeyga#.rupn,/,<S-g>m,<S-g>c,<S-g>a
+set passkeys+=feedly.com:jkgvnpm
+set passkeys+=feedbin.com:hjklesmvVFcf123456789rgAa?<Space><Esc>,/
+set passkeys+=groups.google.com:jkuonp
+
+" Plugins
+loadplugins '\.(js|penta)$'
+set pintaboardToken="ludovicchabant:04A05605C553E70CDA2A"
+
+javascript <<EOF
+function saveToPocket(){var%20e=function(t,n,r,i,s){var%20o=[5581053,5370545,3939863,5030563,6022735,2412811,4059305,6072550,4240340,2597059];var%20i=i||0,u=0,n=n||[],r=r||0,s=s||0;var%20a={'a':97,'b':98,'c':99,'d':100,'e':101,'f':102,'g':103,'h':104,'i':105,'j':106,'k':107,'l':108,'m':109,'n':110,'o':111,'p':112,'q':113,'r':114,'s':115,'t':116,'u':117,'v':118,'w':119,'x':120,'y':121,'z':122,'A':65,'B':66,'C':67,'D':68,'E':69,'F':70,'G':71,'H':72,'I':73,'J':74,'K':75,'L':76,'M':77,'N':78,'O':79,'P':80,'Q':81,'R':82,'S':83,'T':84,'U':85,'V':86,'W':87,'X':88,'Y':89,'Z':90,'0':48,'1':49,'2':50,'3':51,'4':52,'5':53,'6':54,'7':55,'8':56,'9':57,'\/':47,':':58,'?':63,'=':61,'-':45,'_':95,'&':38,'$':36,'!':33,'.':46};if(!s||s==0){t=o[0]+t}for(var%20f=0;f<t.length;f++){var%20l=function(e,t){return%20a[e[t]]?a[e[t]]:e.charCodeAt(t)}(t,f);if(!l*1)l=3;var%20c=l*(o[i]+l*o[u%o.length]);n[r]=(n[r]?n[r]+c:c)+s+u;var%20p=c%(50*1);if(n[p]){var%20d=n[r];n[r]=n[p];n[p]=d}u+=c;r=r==50?0:r+1;i=i==o.length-1?0:i+1}if(s==318){var%20v='';for(var%20f=0;f<n.length;f++){v+=String.fromCharCode(n[f]%(25*1)+97)}o=function(){};return%20v+'2018d4349a'}else{return%20e(u+'',n,r,i,s+1)}};var%20t=document,n=t.location.href,r=t.title;var%20i=e(n);var%20s=t.createElement('script');s.type='text/javascript';s.src='https://getpocket.com/b/r4.js?h='+i+'&u='+encodeURIComponent(n)+'&t='+encodeURIComponent(r);e=i=function(){};var%20o=t.getElementsByTagName('head')[0]||t.documentElement;o.appendChild(s)}
+EOF
+command -js pocket saveToPocket()
+
+" Website-specific groups
+" Feedbin
+group! feedbin -loc feedbin.com
+javascript <<EOF
+function feedbinScrollUp() {
+    el = content.document.getElementsByClassName('entries');
+    if (el != undefined && el.length > 0) {
+        el[0].scrollTop -= el[0].clientHeight/2;
+    } else {
+        content.console.error("Can't find the entries list. Got: ", el);
+    }
+}
+function feedbinScrollDown() {
+    el = content.document.getElementsByClassName('entries');
+    if (el != undefined && el.length > 0) {
+        el[0].scrollTop += el[0].clientHeight/2;
+    } else {
+        content.console.error("Can't find the entries list. Got: ", el);
+    }
+}
+EOF
+nmap -builtin -js <PageUp> feedbinScrollUp()
+nmap -builtin -js <PageDown> feedbinScrollDown()
+
+" vim: ft=vim
--- a/pentadactylrc	Sat Mar 07 11:09:04 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-" Config for Pentadactyl
-
-" Scroll faster
-nmap -builtin h 3h
-nmap -builtin j 3j
-nmap -builtin k 3k
-nmap -builtin l 3l
-
-" Scroll easier
-nmap -builtin d <C-d>
-nmap -builtin e <C-u>
-
-" Close tab with `x` since `d` is for scrolling down now
-nmap -builtin x :bd<cr>
-
-" Don't close the window with the last tab.
-set! browser.tabs.closeWindowWithLastTab=false
-
-" Change tabs without awkward `CTRL` combinations
-nmap -builtin J :tabprevious<cr>
-nmap -builtin K :tabnext<cr>
-
-" Reorder tabs
-nmap -builtin > :tabmove! +1<cr>
-nmap -builtin < :tabmove! -1<cr>
-
-"New tab using the old classic way
-nmap -builtin <C-t> :tabnew<cr>
-
-" Use `i` to get into pass-through mode,
-" `I` for temporary pass-through mode,
-" and `c` for the 'caret' mode.
-nmap -builtin i <C-z>
-nmap -builtin I <C-v>
-nmap -builtin c i
-
-" Shortcuts for common extensions
-nmap -builtin ,f i<D-\>
-nmap -builtin ,p <S-Esc><A-D-\>
-nmap -builtin ,b I<A-b>
-
-" Use and quickly hide search highlighting
-set hlfind
-nmap -builtin ,<Space> :noh<cr>
-
-" Aw come on, copy/pasting is ridiculous by default.
-map -builtin -modes=i,c,v <C-c> <C-v><C-c>
-map -builtin -modes=i,c   <C-x> <C-v><C-x>
-map -builtin -modes=i,c   <C-v> <C-v><C-v>
-
-" Quickly open some dialogs
-nmap -builtin ,b :downloads<cr>
-
-" On keyboards like the Leopold FC660C, for some obscure reason, the
-" <Insert> key sends the <Help> ID. WTF.
-noremap <Help> <Insert>
-
-" DDG FTW
-set defsearch=duckduckgo
-
-" Super minimal UI
-"set toolbars=noaddons,nobookmarks,nomenu,nonavigation,notabs
-
-" Websites with useful keyboard shortcuts already
-set passkeys+=fastmail.com:jkomxeyga#.rupn,/,<S-g>m,<S-g>c,<S-g>a
-set passkeys+=feedly.com:jkgvnpm
-set passkeys+=feedbin.com:hjklesmvVFcf123456789rgAa?<Space><Esc>,/
-set passkeys+=groups.google.com:jkuonp
-
-" Website-specific groups
-" Feedbin
-group! feedbin -loc feedbin.com
-javascript <<EOF
-function feedbinScrollUp() {
-    el = content.document.getElementsByClassName('entries');
-    if (el != undefined && el.length > 0) {
-        el[0].scrollTop -= el[0].clientHeight/2;
-    } else {
-        content.console.error("Can't find the entries list. Got: ", el);
-    }
-}
-function feedbinScrollDown() {
-    el = content.document.getElementsByClassName('entries');
-    if (el != undefined && el.length > 0) {
-        el[0].scrollTop += el[0].clientHeight/2;
-    } else {
-        content.console.error("Can't find the entries list. Got: ", el);
-    }
-}
-EOF
-nmap -builtin -js <PageUp> feedbinScrollUp()
-nmap -builtin -js <PageDown> feedbinScrollDown()
-
-" vim: ft=vim
--- a/vim/vimrc	Sat Mar 07 11:09:04 2015 -0800
+++ b/vim/vimrc	Wed May 20 16:15:19 2015 -0700
@@ -22,8 +22,10 @@
 " Get the platform we're running on.
 if has("win32") || has("win64") || has("dos32")
     let s:vim_platform = "windows"
+    let s:path_sep = "\\"
 else
     let s:vim_platform = "unix"
+    let s:path_sep = '/'
 endif
 
 " Get our vim directory. 
@@ -39,8 +41,14 @@
 call add(g:pathogen_disabled, 'minibufexpl')
 call add(g:pathogen_disabled, 'ragtag')
 
+" Potentially add the local bundle directory.
+if isdirectory(s:vim_home.s:path_sep.'local')
+    execute 'set runtimepath+='.s:vim_home.s:path_sep.'local'
+endif
+
 " Load pathogen.
-call pathogen#infect()
+"call pathogen#infect()
+call pathogen#runtime_append_all_bundles()
 
 " Hide the toolbar in MacVim/gVIM, and set a nice window size.
 if has("gui_running") && !exists('g:resourcing_vimrc')
@@ -161,9 +169,6 @@
 " How to show invisible characters
 set listchars=eol:$,tab:>-,trail:-,extends:>,precedes:<,nbsp:%,conceal:.
 
-" Folds are defined by markers in the text.
-set foldmethod=marker
-
 " Nice auto-complete menu.
 set completeopt=longest,menuone,preview
 
@@ -191,8 +196,8 @@
     set background=dark
 else
     set background=dark
-    let g:solarized_termcolors = 256
-    let g:solarized_termtrans = 1
+    "let g:solarized_termcolors = 256
+    "let g:solarized_termtrans = 1
 endif
 colorscheme solarized
 
@@ -236,7 +241,7 @@
 " Enable some cool extensions.
 let g:ctrlp_extensions = [
             \'tag', 'buffertag', 'quickfix', 'mixed', 'bookmarkdir',
-            \'autoignore', 'projectjump'
+            \'autoignore'
             \]
 
 " }}}
@@ -319,7 +324,8 @@
 " I'm in.
 augroup VimRCAutoCWD
     au!
-    autocmd BufEnter * call s:SetProjectRootCwd()
+    autocmd BufReadPost * call s:SetProjectRootCwd(1)
+    autocmd BufEnter * call s:SetProjectRootCwd(0)
 augroup END
 
 augroup VimRCFileType_markdown
@@ -342,7 +348,7 @@
 
 augroup VimRCFileType_c
     au!
-    autocmd FileType c,c++ setlocal foldmethod=marker foldmarker={,}
+    autocmd FileType c,c++,cpp setlocal foldmethod=syntax
 augroup END
 
 augroup VimRCFileType_css
@@ -362,7 +368,7 @@
 
 augroup VimRCTrailingWhitespaces
     au!
-    autocmd FileType c,cpp,java,php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
+    autocmd FileType php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
 augroup END       
 
 " }}}
@@ -443,27 +449,41 @@
 " Simple way to close a buffer without closing the window.
 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr>
 
-" File-type switching.
-nnoremap <leader>ftmd :set ft=markdown<cr>
-
 " Use sane regexes.
 nnoremap / /\v
 vnoremap / /\v
 
+" Next/previous quickfix and location messages.
+nnoremap ]q :cnext<cr>zvzz
+nnoremap [q :cprevious<cr>zvzz
+nnoremap ]l :lnext<cr>zvzz
+nnoremap [l :lprevious<cr>zvzz
+
+" Same with change list.
+nnoremap ]] g,zz
+nnoremap [[ g;zz
+
+" Same with diff list.
+nnoremap ]c ]czvzz
+nnoremap [c [czvzz
+
 " Quick search and replace.
 function! s:VSetSearch()
-  let temp = @@
-  norm! gvy
-  let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
-  let @@ = temp
+    let temp = @@
+    norm! gvy
+    let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
+    let @@ = temp
 endfunction
 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o>
 vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o>
 
+nnoremap <leader>fa :vimgrep /<C-R><C-W>/ 
+vnoremap <leader>fa "zy:vimgrep /<C-R>z/ 
+
 " Jump to tags by keeping things better in view. Option for jumping to a tag
 " in a split window where everything is folded except what you need to see.
 function! JumpToTag()
-    execute "normal! \<c-]>zz"
+    execute "normal! \<c-]>zvzz"
 endfunction
 function! JumpToTagInSplit()
     execute "normal! \<c-w>v\<c-]>zMzvzz"
@@ -472,19 +492,15 @@
 nnoremap <c-\> :silent! call JumpToTagInSplit()<cr>
 
 " Keep search matches in the middle of the window.
-nnoremap n nzzzv
-nnoremap N Nzzzv
-
-" Same when jumping around
-nnoremap g; g;zz
-nnoremap g, g,zz
+nnoremap n nzvzz
+nnoremap N Nzvzz
 
 " }}}
 
 " Folding {{{
 
-" Always start with all folds closed.
-set foldlevelstart=0
+" Folds are defined by markers in the text.
+set foldmethod=marker
 
 " Toggle folds with <space>.
 nnoremap <space> za
@@ -535,7 +551,7 @@
 set statusline+=)
 
 " Line and column position and counts.
-set statusline+=\ (line\ %l\/%L,\ col\ %03c)
+set statusline+=\ (%l\/%L,%03c)
 
 " }}}
 
@@ -566,7 +582,7 @@
     let l:previous_cur = ''
     let l:slash = '/'
     if has('win32')
-        let l:slash = '\\'
+        let l:slash = '\'
     endif
     while l:cur != l:previous_cur
         let l:marker_path = l:cur . l:slash . a:marker
@@ -579,25 +595,42 @@
     return ''
 endfunction
 
-function! s:SetProjectRootCwd() abort
-    let l:cur_file_dir = expand('%:p:h', 1)
-    if l:cur_file_dir =~ '\v^.+:(//|\\\\)'
+function! s:SetProjectRootCwd(recompute) abort
+    if a:recompute != 1 && exists('b:ludo_workdir')
+        execute 'lcd!' fnameescape(b:ludo_workdir)
         return
     endif
-    let l:root = l:cur_file_dir
+
+    let l:cur_file_dir = expand('%:p:h', 1)
+    if l:cur_file_dir =~ '\v^(\w+:)?(//|\\\\)'
+        " Don't do shit on filenames coming from the network or something.
+        return
+    endif
+    let l:found_root = 0
+    let l:root = ''
     let l:markers = []
     if exists('g:ctrlp_root_markers')
         let l:markers += g:ctrlp_root_markers
     endif
     let l:markers += ['.git', '.hg', '.svn', '.bzr', '_darcs']
+    let l:unique_markers = []
     for marker in l:markers
-        let l:proj_root = s:FindProjectRoot(l:cur_file_dir, marker)
-        if l:proj_root != ''
-            let l:root = l:proj_root
-            break
+        if index(l:unique_markers, marker) < 0
+            call add(l:unique_markers, marker)
         endif
     endfor
-    execute 'lcd!' fnameescape(l:root)
+    " Find the project root closest to the current file.
+    for marker in l:unique_markers
+        let l:proj_root = s:FindProjectRoot(l:cur_file_dir, marker)
+        if l:proj_root != '' && len(l:proj_root) > len(l:root)
+            let l:root = l:proj_root
+            let l:found_root = 1
+        endif
+    endfor
+    if l:found_root
+        let b:ludo_workdir = l:root
+        execute 'lcd!' fnameescape(l:root)
+    endif
 endfunction
 
 function! s:ToggleNERDTree() abort