# HG changeset patch # User Ludovic Chabant # Date 1515571536 28800 # Node ID 63463782d1cd1bf567edde2a7612e328ec640ecb # Parent 1da269c50dca3828612234c05da60d857a139526# Parent c32b9b17231452e233c40757578378e330c3820f Merge changes. diff -r c32b9b172314 -r 63463782d1cd .hgignore --- a/.hgignore Wed Sep 13 10:58:17 2017 -0700 +++ b/.hgignore Wed Jan 10 00:05:36 2018 -0800 @@ -8,8 +8,10 @@ .netrwhist git/gitconfig-local hgrc/hgrc-local +lib/ vim/vimrc-local vim/vimrc-local-pre +vim/bundle/ vim/local/ weechat/logs weechat/*.log diff -r c32b9b172314 -r 63463782d1cd .hgsub --- a/.hgsub Wed Sep 13 10:58:17 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ - -vim/bundle/gundo = https://bitbucket.org/sjl/gundo.vim -vim/bundle/badwolf = https://bitbucket.org/sjl/badwolf - -vim/bundle/ag = [git]https://github.com/rking/ag.vim.git -vim/bundle/commentary = [git]https://github.com/tpope/vim-commentary.git -vim/bundle/easymotion = [git]https://github.com/Lokaltog/vim-easymotion.git -vim/bundle/fugitive = [git]https://github.com/tpope/vim-fugitive.git -vim/bundle/haml = [git]https://github.com/tpope/vim-haml.git -vim/bundle/interestingwords = [git]https://github.com/vasconcelloslf/vim-interestingwords.git -vim/bundle/jinja = [git]https://github.com/mitsuhiko/vim-jinja.git -vim/bundle/less = [git]https://github.com/groenewege/vim-less.git -vim/bundle/lightline = [git]https://github.com/itchyny/lightline.vim.git -vim/bundle/linediff = [git]https://github.com/AndrewRadev/linediff.vim.git -vim/bundle/markdown = [git]https://github.com/tpope/vim-markdown.git -vim/bundle/nerdtree = [git]https://github.com/scrooloose/nerdtree.git -vim/bundle/pathogen = [git]https://github.com/tpope/vim-pathogen.git -vim/bundle/powerline = [git]https://github.com/Lokaltog/vim-powerline.git -vim/bundle/projectroot = [git]https://github.com/dbakker/vim-projectroot.git -vim/bundle/python-pep8-indent = [git]https://github.com/hynek/vim-python-pep8-indent.git -vim/bundle/pythonmode = [git]https://github.com/klen/python-mode.git -vim/bundle/ragtag = [git]https://github.com/tpope/vim-ragtag.git -vim/bundle/repeat = [git]https://github.com/tpope/vim-repeat.git -vim/bundle/scratch = [git]https://github.com/mtth/scratch.vim.git -vim/bundle/sleuth = [git]https://github.com/tpope/vim-sleuth.git -vim/bundle/solarized = [git]https://github.com/altercation/vim-colors-solarized.git -vim/bundle/supertab = [git]https://github.com/ervandew/supertab.git -vim/bundle/surround = [git]https://github.com/tpope/vim-surround.git -vim/bundle/syntastic = [git]https://github.com/scrooloose/syntastic.git -vim/bundle/tagbar = [git]https://github.com/majutsushi/tagbar.git -vim/bundle/todo.txt = [git]https://github.com/freitass/todo.txt-vim.git -vim/bundle/twig = [git]https://github.com/beyondwords/vim-twig.git -vim/bundle/vimroom = [git]https://github.com/mikewest/vimroom.git -vim/bundle/yankring = [git]https://github.com/vim-scripts/YankRing.vim.git - -vim/bundle/colorschemes = [git]https://github.com/ludovicchabant/vim-colorschemes.git -vim/bundle/ctrlp = [git]https://github.com/ludovicchabant/ctrlp.vim.git -vim/bundle/ctrlp-py-matcher = [git]https://github.com/ludovicchabant/ctrlp-py-matcher.git - -vim/bundle/gutentags = https://bitbucket.org/ludovicchabant/vim-gutentags -vim/bundle/lawrencium = https://bitbucket.org/ludovicchabant/vim-lawrencium -vim/bundle/piecrust = https://bitbucket.org/ludovicchabant/vim-piecrust - -mutt/mutt-colors-solarized = [git]https://github.com/altercation/mutt-colors-solarized - -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://www.mercurial-scm.org/repo/evolve -lib/hg/terse-status = https://bitbucket.org/durin42/terse-status -lib/hg/path-pattern = https://bitbucket.org/Mekk/mercurial-path_pattern - -lib/hg/hg-git = https://bitbucket.org/ludovicchabant/hg-git -lib/hg/hg-git-sync = https://bitbucket.org/ludovicchabant/hg-git-sync -lib/hg/onsub = https://bitbucket.org/ludovicchabant/onsub -lib/hg/allpaths = https://bitbucket.org/ludovicchabant/allpaths -lib/hg/fast-hg-prompt = https://bitbucket.org/ludovicchabant/fast-hg-prompt - -lib/fish/virtualfish = [git]https://github.com/adambrenecki/virtualfish.git - -lib/iterm2/color-schemes = [git]https://github.com/mbadolato/iTerm2-Color-Schemes.git - -pentadactyl/plugins/pintaboard = [git]https://github.com/bnbeckwith/pintaboard.git - diff -r c32b9b172314 -r 63463782d1cd .hgsubstate --- a/.hgsubstate Wed Sep 13 10:58:17 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -5c5203cc2a62a65eea3bce3931a8e41938341bcd lib/fish/virtualfish -772d75b1a0309b89b96c4ad1c0b2f284104de974 lib/hg/allpaths -871944d0db5cc714bfee2bd6087c380d3ef6a96f lib/hg/fast-hg-prompt -4d63f2eb60fd6399d5f50d4703d8ced8132ce359 lib/hg/hg-git -7d99080f276f49e3638ba13b4f5c1cd2dc4cc21f lib/hg/hg-git-sync -5334581e231a5167d03689ff47b3a6fdf082011c lib/hg/hg-prompt -1fc4a9fbead7e0acc4c828b346f3be2658ec3df9 lib/hg/mercurial-cli-templates -21f06d9322316c9cc17eaebf5d4f40b9f24304f6 lib/hg/mutable-history -003eee5497e078abd14b3785ab1ff817e585ae8a lib/hg/onsub -300b427e177be816ab923e8c21efdc0fa3fdcee4 lib/hg/path-pattern -2d9820cf595263bc7c651295b83f02525a23ca4a lib/hg/terse-status -518f474f8414e3553fab0e909e5087bc06cc5279 lib/iterm2/color-schemes -3b23c55eb43849975656dd89e3f35dacd2b93e69 mutt/mutt-colors-solarized -47ee7952433b327724bac20ef720ec22e0e0782b pentadactyl/plugins/pintaboard -4a0dd6e190f446e5a016b44fdaa2feafc582918e vim/bundle/ag -451b8111344a3a8117996f4e32b6a255b629f87b vim/bundle/badwolf -567ee4a3657d8e732f67abf228e51c220ea81ec4 vim/bundle/colorschemes -be79030b3e8c0ee3c5f45b4333919e4830531e80 vim/bundle/commentary -7fa89fec125ce60a341f7c37dd769a8a31c49359 vim/bundle/ctrlp -2f6947480203b734b069e5d9f69ba440db6b4698 vim/bundle/ctrlp-py-matcher -e4d71c7ba45baf860fdaaf8c06cd9faebdccbd50 vim/bundle/easymotion -913fff1cea3aa1a08a360a494fa05555e59147f5 vim/bundle/fugitive -1d84591fff04caebab75cba2294fc3843f0a4a29 vim/bundle/gundo -f7a417234deadb6283bfb2c437d4f11cd2f7ab55 vim/bundle/gutentags -d580aa3a3f8b576425188be64381047c7b993112 vim/bundle/haml -0278ab2ede1ea94f2523c53d6d694a84479b2124 vim/bundle/interestingwords -8a8f0ed97c1751d304cf5b7241f2fe27b0e61f81 vim/bundle/jinja -c9169233d45ae2f0fefa0feb9ee816a87c6b05c8 vim/bundle/lawrencium -6e818d5614d5fc18d95a48c92b89e6db39f9e3d6 vim/bundle/less -96d6d108bf6cd7bfdaa9872add4bb47d6ddbf7fd vim/bundle/lightline -84165cad088402ef04906dfc9cd2eb4b2bf071fa vim/bundle/linediff -a7dbc314569aa85db80c106d73b1664e385b6ae7 vim/bundle/markdown -5782b228e495c733af4ba2e547e5dc44ebc8bc25 vim/bundle/nerdtree -e7857bed4e0705f91f781dbe99706f07d08d104b vim/bundle/pathogen -af8514b79c046a6bb447021b81351edb050ac69f vim/bundle/piecrust -114f8e5c204f1cac9b2443065910fa182de39fb8 vim/bundle/powerline -68787126ebbbe50e120e497ff63696b22f636840 vim/bundle/projectroot -e0be8bfc4ff68e6eb26662fe3a1881cba225a44e vim/bundle/python-pep8-indent -ed80fdebb5eb5e0e7e404484371221633a3926f6 vim/bundle/pythonmode -5762a937f39d165b9773376960539f8c32788325 vim/bundle/ragtag -070ee903245999b2b79f7386631ffd29ce9b8e9f vim/bundle/repeat -1644a567c103c71e2f91bc9a362e906c515d6e4a vim/bundle/scratch -dfe0a33253c61dd8fac455baea4ec492e6cf0fe3 vim/bundle/sleuth -528a59f26d12278698bb946f8fb82a63711eec21 vim/bundle/solarized -22aac5c2cb6a8ebe906bf1495eb727717390e62e vim/bundle/supertab -e49d6c2459e0f5569ff2d533b4df995dd7f98313 vim/bundle/surround -5e1b26c1724448c9d870b08dc93ce71528489333 vim/bundle/syntastic -59ea6d656a0b5190f6f8f3fff44197d752782cc6 vim/bundle/tagbar -6845221d45bd62e604c2024bc511a56e79d1118b vim/bundle/todo.txt -869c05195086dd1af9fe39e49621f9f880b6f07c vim/bundle/twig -b9d1fa7d460dac878cbc8c945a45439d92ce0cb2 vim/bundle/vimroom -28854abef8fa4ebd3cb219aefcf22566997d8f65 vim/bundle/yankring diff -r c32b9b172314 -r 63463782d1cd fish/config.fish --- a/fish/config.fish Wed Sep 13 10:58:17 2017 -0700 +++ b/fish/config.fish Wed Jan 10 00:05:36 2018 -0800 @@ -4,15 +4,20 @@ set -g -x fish_greeting 'Hello.' # Homebrew. -set -g -x PATH /usr/local/sbin $PATH -set -g -x PATH /usr/local/bin $PATH +#set -g -x PATH /usr/local/sbin $PATH +#set -g -x PATH /usr/local/bin $PATH # My own stuff. -set -g -x PATH $HOME/.local/bin $PATH -set -g -x PATH $HOME/bin $PATH +if test -d $HOME/.local/bin + set -g -x PATH $HOME/.local/bin $PATH +end +if test -d $HOME/bin + set -g -x PATH $HOME/bin $PATH +end set -g -x OS MacOSX set -g -x EDITOR vim set -g -x SHELL fish +set -g -x TERM screen-256color-bce # Python. set -g -x VIRTUAL_ENV_DISABLE_PROMPT 1 @@ -20,10 +25,21 @@ # Go. set -g -x GOPATH /usr/local/Cellar/go/1.4/gocode +if type -q git + set -g -x __local_has_git +end +if type -q hg + set -g -x __local_has_hg +end +if test -e $HOME/.local/bin/fast-hg-bookmark + set -g -x __local_has_fast_hg_bookmark +end + # }}} # Aliases {{{ +# Run Tmux in UTF8 and 256 colours always. alias tm 'tmux -u2' # }}} @@ -46,30 +62,37 @@ end function prompt_char - if git branch >/dev/null 2>/dev/null - printf '±' ; return + if set -q __local_has_git + if git branch >/dev/null 2>/dev/null + printf '±' ; return + end + if hg root >/dev/null 2>/dev/null + printf '☿' ; return + end + echo '○' end - if hg root >/dev/null 2>/dev/null - printf '☿' ; return - end - echo '○' end function hg_prompt - set_color magenta - printf '%s' (fast-hg-bookmark 2>/dev/null) - set_color normal + if set -q __local_has_hg + and set -q __local_has_fast_hg_bookmark + set_color magenta + printf '%s' (fast-hg-bookmark 2>/dev/null) + set_color normal + end end function git_prompt - if git root >/dev/null 2>&1 - set_color normal - printf ' on ' - set_color magenta - printf '%s' (git currentbranch ^/dev/null) - set_color green - git_prompt_status - set_color normal + if set -q __local_has_git + if git root >/dev/null 2>&1 + set_color normal + printf ' on ' + set_color magenta + printf '%s' (git currentbranch ^/dev/null) + set_color green + git_prompt_status + set_color normal + end end end @@ -126,24 +149,12 @@ # }}} -# Virtualenv wrapper for Fish {{{ - -eval (/usr/local/bin/python2.7 -m virtualfish) - -#set -g VIRTUALFISH_COMPAT_ALIASES # uncomment for virtualenvwrapper-style commands -#. $HOME/.config/fish/virtualfish/virtual.fish -# optional plugins -#. path/to/auto_activation.fish -#. path/to/global_requirements.fish -#. path/to/projects.fish - -# }}} - # Local Settings {{{ if test -s $HOME/.config/fish/local.fish . $HOME/.config/fish/local.fish end +#eval (/usr/local/bin/python -m virtualfish) # }}} diff -r c32b9b172314 -r 63463782d1cd git/gitconfig --- a/git/gitconfig Wed Sep 13 10:58:17 2017 -0700 +++ b/git/gitconfig Wed Jan 10 00:05:36 2018 -0800 @@ -1,6 +1,6 @@ [user] -name = Ludovic Chabant -email = ludovic@chabant.com + name = Ludovic Chabant + email = ludovic@chabant.com [push] default = simple @@ -18,3 +18,7 @@ [mergetool "sourcetree"] cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" trustExitCode = true +[core] + excludesfile = /Users/abdul/.gitignore_global +[commit] + template = /Users/abdul/.stCommitMsg diff -r c32b9b172314 -r 63463782d1cd hgrc/hgignore --- a/hgrc/hgignore Wed Sep 13 10:58:17 2017 -0700 +++ b/hgrc/hgignore Wed Jan 10 00:05:36 2018 -0800 @@ -2,6 +2,7 @@ *~ *.pyo +*.orig .DS_Store Thumbs.db diff -r c32b9b172314 -r 63463782d1cd install.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install.cfg Wed Jan 10 00:05:36 2018 -0800 @@ -0,0 +1,58 @@ +[subrepos] +vim/bundle/ag = [git]https://github.com/rking/ag.vim.git +vim/bundle/badwolf = https://bitbucket.org/sjl/badwolf +vim/bundle/colorschemes = [git]https://github.com/ludovicchabant/vim-colorschemes.git +vim/bundle/commentary = [git]https://github.com/tpope/vim-commentary.git +vim/bundle/ctrlp = [git]https://github.com/ludovicchabant/ctrlp.vim.git +vim/bundle/ctrlp-py-matcher = [git]https://github.com/ludovicchabant/ctrlp-py-matcher.git +vim/bundle/easymotion = [git]https://github.com/Lokaltog/vim-easymotion.git +vim/bundle/fish = [git]https://github.com/dag/vim-fish.git +vim/bundle/fugitive = [git]https://github.com/tpope/vim-fugitive.git +vim/bundle/gundo = https://bitbucket.org/sjl/gundo.vim +vim/bundle/gutentags = https://bitbucket.org/ludovicchabant/vim-gutentags +vim/bundle/haml = [git]https://github.com/tpope/vim-haml.git +vim/bundle/interestingwords = [git]https://github.com/vasconcelloslf/vim-interestingwords.git +vim/bundle/jinja = [git]https://github.com/mitsuhiko/vim-jinja.git +vim/bundle/lawrencium = https://bitbucket.org/ludovicchabant/vim-lawrencium +vim/bundle/less = [git]https://github.com/groenewege/vim-less.git +vim/bundle/lightline = [git]https://github.com/itchyny/lightline.vim.git +vim/bundle/linediff = [git]https://github.com/AndrewRadev/linediff.vim.git +vim/bundle/markdown = [git]https://github.com/tpope/vim-markdown.git +vim/bundle/nerdtree = [git]https://github.com/scrooloose/nerdtree.git +vim/bundle/pathogen = [git]https://github.com/tpope/vim-pathogen.git +vim/bundle/piecrust = https://bitbucket.org/ludovicchabant/vim-piecrust +vim/bundle/powerline = [git]https://github.com/Lokaltog/vim-powerline.git +vim/bundle/projectroot = [git]https://github.com/dbakker/vim-projectroot.git +vim/bundle/python-pep8-indent = [git]https://github.com/hynek/vim-python-pep8-indent.git +vim/bundle/pythonmode = [git]https://github.com/klen/python-mode.git +vim/bundle/ragtag = [git]https://github.com/tpope/vim-ragtag.git +vim/bundle/repeat = [git]https://github.com/tpope/vim-repeat.git +vim/bundle/scratch = [git]https://github.com/mtth/scratch.vim.git +vim/bundle/sleuth = [git]https://github.com/tpope/vim-sleuth.git +vim/bundle/solarized = [git]https://github.com/altercation/vim-colors-solarized.git +vim/bundle/supertab = [git]https://github.com/ervandew/supertab.git +vim/bundle/surround = [git]https://github.com/tpope/vim-surround.git +vim/bundle/syntastic = [git]https://github.com/scrooloose/syntastic.git +vim/bundle/tagbar = [git]https://github.com/majutsushi/tagbar.git +vim/bundle/todo.txt = [git]https://github.com/freitass/todo.txt-vim.git +vim/bundle/twig = [git]https://github.com/beyondwords/vim-twig.git +vim/bundle/vimroom = [git]https://github.com/mikewest/vimroom.git +vim/bundle/yankring = [git]https://github.com/vim-scripts/YankRing.vim.git + +lib/fish/virtualfish = [git]https://github.com/adambrenecki/virtualfish.git + +lib/hg/allpaths = https://bitbucket.org/ludovicchabant/allpaths +lib/hg/fast-hg-prompt = https://bitbucket.org/ludovicchabant/fast-hg-prompt +lib/hg/hg-git = https://bitbucket.org/ludovicchabant/hg-git +lib/hg/hg-git-sync = https://bitbucket.org/ludovicchabant/hg-git-sync +lib/hg/hg-prompt = https://bitbucket.org/sjl/hg-prompt +lib/hg/mercurial-cli-templates = https://bitbucket.org/sjl/mercurial-cli-templates +lib/hg/mutable-history = https://www.mercurial-scm.org/repo/evolve +lib/hg/onsub = https://bitbucket.org/ludovicchabant/onsub +lib/hg/path-pattern = https://bitbucket.org/Mekk/mercurial-path_pattern +lib/hg/terse-status = https://bitbucket.org/durin42/terse-status + +lib/iterm2/color-schemes = [git]https://github.com/mbadolato/iTerm2-Color-Schemes.git + +lib/mutt/mutt-colors-solarized = [git]https://github.com/altercation/mutt-colors-solarized + diff -r c32b9b172314 -r 63463782d1cd install.cmd --- a/install.cmd Wed Sep 13 10:58:17 2017 -0700 +++ b/install.cmd Wed Jan 10 00:05:36 2018 -0800 @@ -2,68 +2,5 @@ setlocal set CWD=%~dp0 - -:: VIM Files -if exist "%userprofile%\vimfiles" ( - set /P confirm=Will delete existing "%userprofile%\vimfiles". OK with that? Press CTRL-C to abort. - rmdir /Q /S "%userprofile%\vimfiles" -) - -if exist "%userprofile%\_vimrc" ( - set /P confirm=Will delete existing "%userprofile%\_vimrc". OK with that? Press CTRL-C to abort. - del /Q "%userprofile%\_vimrc" -) -echo set runtimepath+=%CWD:\=/%vim > "%userprofile%\_vimrc" -echo source %CWD:\=/%vim/vimrc >> "%userprofile%\_vimrc" - -:: Mercurial Files -if exist "%userprofile%\mercurial.ini" ( - set /P confirm=Will delete existing "%userprofile%\mercurial.ini". OK with that? Press CTRL-C to abort. - del /Q "%userprofile%\mercurial.ini" -) -echo %%include %CWD%hgrc\hgrc > "%userprofile%\mercurial.ini" -echo [ui] >> "%userprofile%\mercurial.ini" -echo ignore = %CWD:\=/%hgrc/hgignore >> "%userprofile%\mercurial.ini" -echo [extensions] >> "%userprofile%\mercurial.ini" -echo hggit = %CWD:\=/%lib/hg/hg-git/hggit/ >> "%userprofile%\mercurial.ini" -echo onsub = %CWD:\=/%lib/hg/onsub/onsub.py >> "%userprofile%\mercurial.ini" -echo allpaths = %CWD:\=/%lib/hg/allpaths/mercurial_all_paths.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 path-pattern = %CWD:\=/%lib/hg/path-pattern/mercurial_path_pattern.py >> "%userprofile%\mercurial.ini" +python %CWD%install.py -:: 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" -) -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 set runtimepath=~/.pentadactyl,%CWD:\=/%pentadactyl > "%userprofile%\_pentadactylrc" -echo source %CWD:\=/%pentadactyl/pentadactylrc >> "%userprofile%\_pentadactylrc" - -if exist "%userprofile%\_vimperatorrc" ( - set /P confirm=Will delete existing "%userprofile%\_vimperatorrc". OK with that? Press CTRL-C to abort. - del /Q "%userprofile%\_vimperatorrc" -) -echo set runtimepath=~/.vimperator,%CWD:\=/%vimperator > "%userprofile%\_vimperatorrc" -echo source %CWD:\=/%vimperator/vimperatorrc >> "%userprofile%\_vimperatorrc" - -:: Console 2 -if exist "%appdata%\Console\console.xml" ( - set /P confirm=Will delete existing Console2 settings. OK with that? Press CTRL-C to abort. - del /Q "%appdata%\Console\console.xml" -) -if not exist "%appdata%\Console" mkdir "%appdata%\Console" -copy "%CWD%console.xml" "%appdata%\Console\console.xml" - -setx GIT_SSH %USERPROFILE%\Dropbox\Utilities\plink.exe - diff -r c32b9b172314 -r 63463782d1cd install.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install.py Wed Jan 10 00:05:36 2018 -0800 @@ -0,0 +1,260 @@ +import os +import os.path +import sys +import stat +import argparse +import functools +import subprocess +import configparser + + +dotfiles_dir = os.path.abspath(os.path.dirname(__file__)) + +is_nix = True +is_windows = False +if sys.platform == "win32": + is_nix = False + is_windows = True + + +def _p(*paths): + return os.path.join(dotfiles_dir, *paths).replace('/', os.sep) + + +def nixslash(path): + return path.replace('\\', '/') + + +def ensure_dir(path): + full_path = os.path.abspath(os.path.expanduser(path)) + if not os.path.isdir(full_path): + os.makedirs(full_path, mode=0o700) + + +def mklink(orig_rel_path, link_path, mode=None): + orig_full_path = os.path.join(dotfiles_dir, orig_rel_path) + link_full_path = os.path.abspath(os.path.expanduser(link_path)) + if os.path.islink(link_full_path): + print("Unlinking %s" % link_full_path) + os.unlink(link_full_path) + elif os.path.exists(link_full_path): + print("Removing %s" % link_full_path) + os.remove(link_full_path) + + print("%s -> %s" % (link_full_path, orig_full_path)) + os.symlink(orig_full_path, link_full_path) + if mode is not None: + os.chmod(link_full_path, mode) + + +def writelines(path, lines): + full_path = os.path.abspath(os.path.expanduser(path)) + print("%d lines to %s" % (len(lines), full_path)) + with open(full_path, 'w') as fp: + for l in lines: + fp.write(l) + fp.write('\n') + + +def only_on_nix(f): + @functools.wraps(f) + def decorator(*args, **kwargs): + if is_nix: + return f(*args, **kwargs) + return decorator + + +def only_on_win(f): + @functools.wraps(f) + def decorator(*args, **kwargs): + if is_windows: + return f(*args, **kwargs) + return decorator + + +def needs_config(f): + f.__dotfiles_needs_config__ = True + return f + + +def run_priority(prio): + def wrapper(f): + f.__dotfiles_priority__ = prio + return f + return wrapper + + +@only_on_nix +def install_bash(): + mklink('bashrc/bashrc', '.bashrc') + mklink('bashrc/bash_profile', '.bash_profile') + + +@only_on_nix +def install_fish(): + ensure_dir('~/.config') + mklink('fish', '~/.config/fish') + + +def install_vim(): + vimrc_path = '~/.vimrc' + if is_windows: + vimrc_path = '~/_vimrc' + writelines(vimrc_path, [ + 'set runtimepath+=%s' % nixslash(_p('vim')), + 'source %s' % nixslash(_p('vim', 'vimrc')) + ]) + + +@run_priority(2) # Needs to run before `fish`. +def install_mercurial(): + hgrc_path = '~/.hgrc' + if is_windows: + hgrc_path = '~/mercurial.ini' + writelines(hgrc_path, [ + '%%include %s' % _p('hgrc/hgrc'), + '[ui]', + 'ignore = %s' % _p('hgrc/hgignore'), + '[subrepos]', + 'git:allowed = true', + '[extensions]', + 'hggit = %s' % _p('lib/hg/hg-git/hggit/'), + 'onsub = %s' % _p('lib/hg/onsub/onsub.py'), + 'allpaths = %s' % _p('lib/hg/allpaths/mercurial_all_paths.py'), + 'prompt = %s' % _p('lib/hg/hg-prompt/prompt.py'), + 'evolve = %s' % _p('lib/hg/mutable-history/hgext3rd/evolve'), + 'terse-status = %s' % _p('lib/hg/terse-status/terse-status.py') + ]) + if is_nix: + print("Building fast-hg-prompt...") + compile_ok = True + try: + subprocess.check_call(['make'], cwd=_p('lib/hg/fast-hg-prompt')) + except subprocess.CalledProcessError: + compile_ok = False + + for n in ['bookmark', 'remote', 'status']: + link_path = os.path.expanduser('~/.local/bin/fast-hg-%s' % n) + if compile_ok: + mklink('lib/hg/fast-hg-prompt/fast-hg-%s' % n, link_path, + mode=(stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)) + elif os.path.islink(link_path): + os.unlink(link_path) + elif os.path.exists(link_path): + os.remove(link_path) + + +def install_git(): + writelines('~/.gitconfig', [ + '[include]', + 'path = %s' % _p('git/gitconfig') + ]) + if is_windows: + subprocess.check_call( + ['setx', 'GIT_SSH', + '%USERPROFILE%\\Dropbox\\Utilities\\plink.exe'], + shell=True) + + +@only_on_nix +def install_tmux(): + mklink('tmux/tmux.conf', '~/.tmux.conf') + + +@only_on_nix +def install_weechat(): + mklink('weechat', '~/.weechat') + + +@only_on_nix +def install_mutt(): + writelines('~/.muttrc', [ + 'source "gpg2 -dq %s |"' % _p('mutt/variables.gpg'), + 'source "%s"' % _p('mutt/muttrc'), + 'source "%s"' % _p('lib/mutt/mutt-colors-solarized/' + 'mutt-colors-solarized-dark-256.muttrc') + ]) + + +def clone_git(url, path): + if os.path.isdir(path): + print("Skipping git clone of %s -- directory exists" % path) + print("git clone %s %s" % (url, path)) + ensure_dir(os.path.dirname(path)) + subprocess.check_call(['git', 'clone', url, path]) + + +def clone_hg(url, path): + if os.path.isdir(path): + print("Skipping hg clone of %s -- directory exists" % path) + print("hg clone %s %s" % (url, path)) + ensure_dir(os.path.dirname(path)) + env = dict(os.environ) + env.update({'HGPLAIN': '1'}) + subprocess.check_call(['hg', 'clone', url, path], env=env) + + +@needs_config +@run_priority(100) +def install_subrepos(cfg): + if not cfg.has_section('subrepos'): + return + + for path, url in cfg.items('subrepos'): + full_path = _p(path) + if url.startswith('[git]'): + clone_git(url[len('[git]'):], full_path) + else: + clone_hg(url, full_path) + + +def main(): + print("dotfiles installer") + print("python %s" % sys.version) + print("on %s" % sys.platform) + print('') + + cfg = configparser.ConfigParser() + cfg.read(_p('install.cfg')) + + mod_names = ['all'] + this_mod = sys.modules[__name__] + for an in dir(this_mod): + if not an.startswith('install_'): + continue + + name = an[len('install_'):] + mod_names.append(name) + + parser = argparse.ArgumentParser() + parser.add_argument( + 'module', nargs='*', + choices=mod_names, + help="Which module(s) to install. Defaults to all modules.") + args = parser.parse_args() + + funcs = [] + selected_mods = set(args.module) + if 'all' in selected_mods: + selected_mods = set(mod_names) + selected_mods.remove('all') + for mn in selected_mods: + func = getattr(this_mod, 'install_%s' % mn) + funcs.append((mn, func)) + + funcs = sorted(funcs, key=_get_install_func_priority, reverse=True) + for name, func in funcs: + print("Installing %s" % name) + if hasattr(func, '__dotfiles_needs_config__'): + func(cfg) + else: + func() + + +def _get_install_func_priority(func_info): + func = func_info[1] + return getattr(func, '__dotfiles_priority__', 0) + + +if __name__ == '__main__': + main() diff -r c32b9b172314 -r 63463782d1cd install.sh --- a/install.sh Wed Sep 13 10:58:17 2017 -0700 +++ b/install.sh Wed Jan 10 00:05:36 2018 -0800 @@ -1,61 +1,5 @@ #!/bin/sh CWD="$( cd "$( dirname "$0" )" && pwd )" - -# BASH -# ---- -ln -s "$CWD/bashrc/bashrc" "$HOME/.bashrc" -ln -s "$CWD/bashrc/bash_profile" "$HOME/.bash_profile" - -# FISH -# ---- -mkdir -p $HOME/.config/fish/ -ln -s "$CWD/fish/config.fish" "$HOME/.config/fish/config.fish" - -# VIM -# --- -echo set runtimepath+=$CWD/vim > "$HOME/.vimrc" -echo source $CWD/vim/vimrc >> "$HOME/.vimrc" +python $CWD/install.py -# MERCURIAL -# --------- -echo %include $CWD/hgrc/hgrc > "$HOME/.hgrc" -echo [ui] >> "$HOME/.hgrc" -echo ignore = $CWD/hgrc/hgignore >> "$HOME/.hgrc" -echo [extensions] >> "$HOME/.hgrc" -echo hggit = $CWD/lib/hg/hg-git/hggit/ >> "$HOME/.hgrc" -echo onsub = $CWD/lib/hg/onsub/onsub.py >> "$HOME/.hgrc" -echo allpaths = $CWD/lib/hg/allpaths/mercurial_all_paths.py >> "$HOME/.hgrc" -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 path-pattern = $CWD/lib/hg/path-pattern/mercurial_path_pattern.py >> "$HOME/.hgrc" - -# GIT -# --- -ln -s "$CWD/git/gitconfig" "$HOME/.gitconfig" - -# WEB BROWSER -# ----------- -echo set runtimepath=~/.pentadactyl,$CWD/pentadactyl > "$HOME/.pentadactylrc" -echo source "$CWD/pentadactyl/pentadactylrc" >> "$HOME/.pentadactylrc" - -echo set runtimepath=~/.vimperator,$CWD/vimperator > "$HOME/.vimperatorrc" -echo source "$CWD/vimperator/vimperatorrc" >> "$HOME/.vimperatorrc" - -# TMUX -# ---- -ln -s "$CWD/tmux/tmux.conf" "$HOME/.tmux.conf" - -# WEECHAT -# ------ -ln -s "$CWD/weechat" "$HOME/.weechat" - -# MUTT -# ---- - -echo source \"gpg2 -dq $CWD/mutt/variables.gpg \|\" > "$HOME/.muttrc" -echo source "$CWD/mutt/muttrc" >> "$HOME/.muttrc" -echo source "$CWD/mutt/mutt-colors-solarized/mutt-colors-solarized-dark-256.muttrc" >> "$HOME/.muttrc" - diff -r c32b9b172314 -r 63463782d1cd tmux/tmux.conf --- a/tmux/tmux.conf Wed Sep 13 10:58:17 2017 -0700 +++ b/tmux/tmux.conf Wed Jan 10 00:05:36 2018 -0800 @@ -14,3 +14,5 @@ # Default to fish set -g default-command "fish" +set -g default-terminal "xterm" + diff -r c32b9b172314 -r 63463782d1cd vim/bundle/minibufexpl/plugin/minibufexpl.vim --- a/vim/bundle/minibufexpl/plugin/minibufexpl.vim Wed Sep 13 10:58:17 2017 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1838 +0,0 @@ -" Mini Buffer Explorer -" -" HINT: Type zR if you don't know how to use folds -" -" Script Info and Documentation {{{ -"============================================================================= -" Copyright: Copyright (C) 2002 & 2003 Bindu Wavell -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" minibufexplorer.vim is provided *as is* and comes with no -" warranty of any kind, either expressed or implied. In no -" event will the copyright holder be liable for any damamges -" resulting from the use of this software. -" -" Name Of File: minibufexpl.vim -" Description: Mini Buffer Explorer Vim Plugin -" Maintainer: Bindu Wavell -" URL: http://vim.sourceforge.net/scripts/script.php?script_id=159 -" Last Change: Sunday, June 21, 2004 -" Version: 6.3.2 -" Derived from Jeff Lanzarotta's bufexplorer.vim version 6.0.7 -" Jeff can be reached at (jefflanzarotta@yahoo.com) and the -" original plugin can be found at: -" http://lanzarotta.tripod.com/vim/plugin/6/bufexplorer.vim.zip -" -" Usage: Normally, this file should reside in the plugins -" directory and be automatically sourced. If not, you must -" manually source this file using ':source minibufexplorer.vim'. -" -" You may use the default keymappings of -" -" mbe - Opens MiniBufExplorer -" -" or you may want to add something like the following -" key mapping to your _vimrc/.vimrc file. -" -" map b :MiniBufExplorer -" -" However, in most cases you won't need any key-bindings at all. -" -" is usually backslash so type "\mbe" (quickly) to open -" the -MiniBufExplorer- window. -" -" Other keymappings include: mbc to close the Explorer -" window, mbu to force the Explorer to Update and -" mbt to toggle the Explorer window; it will open if -" closed or close if open. Each of these key bindings can be -" overridden (see the notes on mbe above.) -" -" You can map these additional commands as follows: -" -" map c :CMiniBufExplorer -" map u :UMiniBufExplorer -" map t :TMiniBufExplorer -" -" NOTE: you can change the key binding used in these mappings -" so that they fit with your configuration of vim. -" -" You can also call each of these features by typing the -" following in command mode: -" -" :MiniBufExplorer " Open and/or goto Explorer -" :CMiniBufExplorer " Close the Explorer if it's open -" :UMiniBufExplorer " Update Explorer without navigating -" :TMiniBufExplorer " Toggle the Explorer window open and -" closed. -" -" To control where the new split window goes relative to the -" current window, use the setting: -" -" let g:miniBufExplSplitBelow=0 " Put new window above -" " current or on the -" " left for vertical split -" let g:miniBufExplSplitBelow=1 " Put new window below -" " current or on the -" " right for vertical split -" -" The default for this is read from the &splitbelow VIM option. -" -" By default we are now (as of 6.0.2) forcing the -MiniBufExplorer- -" window to open up at the edge of the screen. You can turn this -" off by setting the following variable in your .vimrc: -" -" let g:miniBufExplSplitToEdge = 0 -" -" If you would like a vertical explorer you can assign the column -" width (in characters) you want for your explorer window with the -" following .vimrc variable (this was introduced in 6.3.0): -" -" let g:miniBufExplVSplit = 20 " column width in chars -" -" IN HORIZONTAL MODE: -" It is now (as of 6.1.1) possible to set a maximum height for -" the -MiniBufExplorer- window. You can set the max height by -" letting the following variable in your .vimrc: -" -" let g:miniBufExplMaxSize = -" -" setting this to 0 will mean the window gets as big as -" needed to fit all your buffers. -" -" NOTE: This was g:miniBufExplMaxHeight before 6.3.0; the old -" setting is backwards compatible if you don't use MaxSize. -" -" As of 6.2.2 it is possible to set a minimum height for the -" -MiniBufExplorer- window. You can set the min height by -" letting the following variable in your .vimrc: -" -" let g:miniBufExplMinSize = -" -" NOTE: This was g:miniBufExplMinHeight before 6.3.0; the old -" setting is backwards compatible if you don't use MinSize. -" -" IN VERTICAL MODE: (as of 6.3.0) -" By default the vertical explorer has a fixed width. If you put: -" -" let g:miniBufExplMaxSize = -" -" into your .vimrc then MBE will attempt to set the width of the -" MBE window to be as wide as your widest tab. The width will not -" exceed MaxSize even if you have wider tabs. -" -" Accepting the default value of 0 for this will give you a fixed -" width MBE window. -" -" You can specify a MinSize for the vertical explorer window by -" putting the following in your .vimrc: -" -" let g:miniBufExplMinSize = -" -" This will have no effect unless you also specivy MaxSize. -" -" By default we are now (as of 6.0.1) turning on the MoreThanOne -" option. This stops the -MiniBufExplorer- from opening -" automatically until more than one eligible buffer is available. -" You can turn this feature off by setting the following variable -" in your .vimrc: -" -" let g:miniBufExplorerMoreThanOne=1 -" -" (The following enhancement is as of 6.2.2) -" Setting this to 0 will cause the MBE window to be loaded even -" if no buffers are available. Setting it to 1 causes the MBE -" window to be loaded as soon as an eligible buffer is read. You -" can also set it to larger numbers. So if you set it to 4 for -" example the MBE window wouldn't auto-open until 4 eligibles -" buffers had been loaded. This is nice for folks that don't -" want an MBE window unless they are editing more than two or -" three buffers. -" -" To enable the optional mapping of Control + Vim Direction Keys -" [hjkl] to window movement commands, you can put the following into -" your .vimrc: -" -" let g:miniBufExplMapWindowNavVim = 1 -" -" To enable the optional mapping of Control + Arrow Keys to window -" movement commands, you can put the following into your .vimrc: -" -" let g:miniBufExplMapWindowNavArrows = 1 -" -" To enable the optional mapping of and to a -" function that will bring up the next or previous buffer in the -" current window, you can put the following into your .vimrc: -" -" let g:miniBufExplMapCTabSwitchBufs = 1 -" -" To enable the optional mapping of and to mappings -" that will move to the next and previous (respectively) window, you -" can put the following into your .vimrc: -" -" let g:miniBufExplMapCTabSwitchWindows = 1 -" -" -" NOTE: If you set the ...TabSwitchBufs AND ...TabSwitchWindows, -" ...TabSwitchBufs will be enabled and ...TabSwitchWindows -" will not. -" -" As of MBE 6.3.0, you can put the following into your .vimrc: -" -" let g:miniBufExplUseSingleClick = 1 -" -" If you would like to single click on tabs rather than double -" clicking on them to goto the selected buffer. -" -" NOTE: If you use the single click option in taglist.vim you may -" need to get an updated version that includes a patch I -" provided to allow both explorers to provide single click -" buffer selection. -" -" It is possible to customize the the highlighting for the tabs in -" the MBE by configuring the following highlighting groups: -" -" MBENormal - for buffers that have NOT CHANGED and -" are NOT VISIBLE. -" MBEChanged - for buffers that HAVE CHANGED and are -" NOT VISIBLE -" MBEVisibleNormal - buffers that have NOT CHANGED and are -" VISIBLE -" MBEVisibleChanged - buffers that have CHANGED and are VISIBLE -" -" You can either link to an existing highlighting group by -" adding a command like: -" -" hi link MBEVisibleChanged Error -" -" to your .vimrc or you can specify exact foreground and background -" colors using the following syntax: -" -" hi MBEChanged guibg=darkblue ctermbg=darkblue termbg=white -" -" NOTE: If you set a colorscheme in your .vimrc you should do it -" BEFORE updating the MBE highlighting groups. -" -" If you use other explorers like TagList you can (As of 6.2.8) put: -" -" let g:miniBufExplModSelTarget = 1 -" -" into your .vimrc in order to force MBE to try to place selected -" buffers into a window that does not have a nonmodifiable buffer. -" The upshot of this should be that if you go into MBE and select -" a buffer, the buffer should not show up in a window that is -" hosting an explorer. -" -" There is a VIM bug that can cause buffers to show up without -" their highlighting. The following setting will cause MBE to -" try and turn highlighting back on (introduced in 6.3.1): -" -" let g:miniBufExplForceSyntaxEnable = 1 -" -" MBE has had a basic debugging capability for quite some time. -" However, it has not been very friendly in the past. As of 6.0.8, -" you can put one of each of the following into your .vimrc: -" -" let g:miniBufExplorerDebugLevel = 0 " MBE serious errors output -" let g:miniBufExplorerDebugLevel = 4 " MBE all errors output -" let g:miniBufExplorerDebugLevel = 10 " MBE reports everything -" -" You can also set a DebugMode to cause output to be target as -" follows (default is mode 3): -" -" let g:miniBufExplorerDebugMode = 0 " Errors will show up in -" " a vim window -" let g:miniBufExplorerDebugMode = 1 " Uses VIM's echo function -" " to display on the screen -" let g:miniBufExplorerDebugMode = 2 " Writes to a file -" " MiniBufExplorer.DBG -" let g:miniBufExplorerDebugMode = 3 " Store output in global: -" " g:miniBufExplorerDebugOutput -" -" Or if you are able to start VIM, you might just perform these -" at a command prompt right before you do the operation that is -" failing. -" -" History: Moved to end of file -" -" Known Issues: When debugging is turned on and set to output to a window, there -" are some cases where the window is opened more than once, there -" are other cases where an old debug window can be lost. -" -" Several MBE commands can break the window history so [pnw] -" might not take you to the expected window. -" -" Todo: Add the ability to specify a regexp for eligible buffers -" allowing the ability to filter out certain buffers that -" you don't want to control from MBE -" -"============================================================================= -" }}} - -" Startup Check -" -" Has this plugin already been loaded? {{{ -" -if exists('loaded_minibufexplorer') - finish -endif -let loaded_minibufexplorer = 1 -" }}} - -" Mappings and Commands -" -" MBE Keyboard Mappings {{{ -" If we don't already have keyboard mappings for MBE then create them -" -if !hasmapto('MiniBufExplorer') - map mbe MiniBufExplorer -endif -if !hasmapto('CMiniBufExplorer') - map mbc CMiniBufExplorer -endif -if !hasmapto('UMiniBufExplorer') - map mbu UMiniBufExplorer -endif -if !hasmapto('TMiniBufExplorer') - map mbt TMiniBufExplorer -endif - -" }}} -" MBE