Commits

Steve Losh  committed 3438f76

Goodbye Slimv, hello Fireplace

  • Participants
  • Parent commits 2c5398c

Comments (0)

Files changed (6)

 vim/bundle/clam           = [hg]https://bitbucket.org/sjl/clam.vim/
 vim/bundle/commentary     = [git]git://github.com/tpope/vim-commentary.git
 vim/bundle/ctrlp          = [git]git://github.com/kien/ctrlp.vim.git
+vim/bundle/fireplace      = [git]git://github.com/tpope/vim-fireplace.git
 vim/bundle/fugitive       = [git]git://github.com/tpope/vim-fugitive.git
 vim/bundle/gundo          = [hg]https://bitbucket.org/sjl/gundo.vim/
 vim/bundle/html5          = [git]git://github.com/othree/html5.vim.git
 vim/bundle/markdown       = [git]git://github.com/tpope/vim-markdown.git
 vim/bundle/nerdtree       = [git]git://github.com/scrooloose/nerdtree.git
 vim/bundle/orgmode        = [git]git://github.com/jceb/vim-orgmode.git
+vim/bundle/paredit        = [hg]https://bitbucket.org/kovisoft/paredit
 vim/bundle/powerline      = [git]git://github.com/Lokaltog/vim-powerline.git
 vim/bundle/python-mode    = [git]git://github.com/klen/python-mode.git
+vim/bundle/rainbow-parens = [git]git://github.com/kien/rainbow_parentheses.vim.git
 vim/bundle/repeat         = [git]git://github.com/tpope/vim-repeat.git
 vim/bundle/smartinput     = [git]git://github.com/kana/vim-smartinput.git
 vim/bundle/sparkup        = [git]git://github.com/sjl/vim-sparkup.git
 vim/bundle/surround       = [git]git://github.com/tpope/vim-surround.git
 vim/bundle/syntastic      = [git]git://github.com/scrooloose/syntastic.git
 vim/bundle/tslime         = [git]git://github.com/sjl/tslime.vim.git
+vim/bundle/vim-clojure-static = [git]git://github.com/guns/vim-clojure-static.git
 vim/bundle/vitality       = [hg]https://bitbucket.org/sjl/vitality.vim
 vim/bundle/yankring       = [git]git://github.com/vim-scripts/YankRing.vim.git
 8533fffd9fbb690dfc8e334f91a10c72e35a6dce vim/bundle/clam
 dc349bb7d30f713d770fc1fa0fe209e6aab82dc8 vim/bundle/commentary
 c1646e3c28d75bcc834af4836f4c6e12296ba891 vim/bundle/ctrlp
+4f6b8e52376dc9973ca0478b750578b681681b55 vim/bundle/fireplace
 cff78c3ab4605d490e6be8d8af02f1e7efd25c95 vim/bundle/fugitive
 8c570a493d260890242cbdc5a22d8500dc4604cb vim/bundle/gundo
 34b407d2344a3c2a94b56e9d443e18e01e8544d9 vim/bundle/html5
 dcdab0cd55da5e0b8655c000d99d96624cd6404c vim/bundle/markdown
 a1433c485eb254838c1db52e087d5ec4d1e77cfd vim/bundle/nerdtree
 f45b4529dd282393f2e08306ae161d77de0051a0 vim/bundle/orgmode
+b6b7d8b1982b67a0bba936c198041f6f3a2286a4 vim/bundle/paredit
 2af074850fde676743f655775e3e151925751adf vim/bundle/powerline
 1b4b8f1a8f1c88d8caae6c1b12c22c52ef418f32 vim/bundle/python-mode
+eb8baa5428bde10ecc1cb14eed1d6e16f5f24695 vim/bundle/rainbow-parens
 613eb1c81261adfa5dead315089c432ff6dbbc51 vim/bundle/repeat
 78ab4b3df24fa2753d3dfc1be75ed5a3df1565b8 vim/bundle/smartinput
 c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup
 1a73f607f8f5477d6942df2eb6e7245c4864f4d3 vim/bundle/surround
 0a7b21d6021a3a565db066e7b8f7f158c918037c vim/bundle/syntastic
 2dee007ddae8156735cbae7f0cd4e0a24ba7287b vim/bundle/tslime
+949adf73ae1a82c48cd951677c055bd38a30af99 vim/bundle/vim-clojure-static
 84365f56fc87c11f1f04eed487d256cf8b128f7c vim/bundle/vitality
 a884f3a161fa3cd8c996eb53a3d1c68631f60c21 vim/bundle/yankring
 #!/usr/bin/env bash
 
-# Ensure this file is executable via chmod a+x lein, then place it
+# Ensure this file is executable via `chmod a+x lein`, then place it
 # somewhere on your $PATH, like ~/bin. The rest of Leiningen will be
 # installed upon first run into the ~/.lein/self-installs directory.
 
-export LEIN_VERSION="2.0.0"
+export LEIN_VERSION="2.1.2"
 
 case $LEIN_VERSION in
     *SNAPSHOT) SNAPSHOT="YES" ;;
     *) SNAPSHOT="NO" ;;
 esac
 
-if [[ "$OSTYPE" == "cygwin" ]]; then
+if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
     delimiter=";"
 else
     delimiter=":"
     # ensure we have native paths
     if [[ "$OSTYPE" == "cygwin" && "$1"  == /* ]]; then
     echo -n "$(cygpath -wp "$1")"
+    elif [[ "$OSTYPE" == "msys" && "$1"  == /* ]]; then
+    echo -n "$(sh -c "(cd $1 2</dev/null && pwd -W) || echo $1 | sed 's/^\\/\([a-z]\)/\\1:/g'")"
     else
     echo -n "$1"
     fi
 
 BIN_DIR="$(dirname "$SCRIPT")"
 
-# Try to make the default more sane for :eval-in :classloader.lein
-grep -E -q '^\s*:eval-in\s+:classloader\s*$' project.clj 2> /dev/null &&
-LEIN_JVM_OPTS="${LEIN_JVM_OPTS:-"-Xms64m -Xmx512m"}"
+export LEIN_JVM_OPTS="${LEIN_JVM_OPTS-"-XX:+TieredCompilation -XX:TieredStopAtLevel=1"}"
+
+# When :eval-in :classloader we need more memory
+grep -E -q '^\s*:eval-in\s+:classloader\s*$' project.clj 2> /dev/null && \
+    export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Xms64m -Xmx512m"
 
 if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
     # Running from source checkout
     LEIN_DIR="$(dirname "$BIN_DIR")"
 
-    # Need to use lein 1.x to bootstrap the leiningen-core library (for aether)
-    if [ "$(ls "$LEIN_DIR"/leiningen-core/lib/*)" = "" ]; then
+    # Need to use lein release to bootstrap the leiningen-core library (for aether)
+    if [ ! -r "$LEIN_DIR/leiningen-core/.lein-bootstrap" ]; then
         echo "Leiningen is missing its dependencies."
-        echo "Please see \"Building\" in CONTRIBUTING.md."
+        echo "Please run \"lein bootstrap\" in the leiningen-core/ directory"
+        echo "with a stable release of Leiningen. See CONTRIBUTING.md for details."
         exit 1
     fi
 
         fi
     fi
 
-    # Use bin/lein to calculate its own classpath since src/ and
-    # leiningen-core/lib/*jar suffices to run the classpath task.
+    # Use bin/lein to calculate its own classpath.
     if [ ! -r "$LEIN_DIR/.lein-classpath" ] && [ "$1" != "classpath" ]; then
         echo "Recalculating Leiningen's classpath."
         ORIG_PWD="$PWD"
     fi
 
     mkdir -p "$LEIN_DIR/target/classes"
-    export LEIN_JVM_OPTS="${LEIN_JVM_OPTS:-"-Xms64m -Xmx256m"} -Dclojure.compile.path=$LEIN_DIR/target/classes"
+    export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Dclojure.compile.path=$LEIN_DIR/target/classes"
     add_path CLASSPATH "$LEIN_DIR/leiningen-core/src/" "$LEIN_DIR/leiningen-core/resources/" \
-                          "$LEIN_DIR/test:$LEIN_DIR/target/classes" "$LEIN_DIR/src" ":$LEIN_DIR/resources"
+        "$LEIN_DIR/test:$LEIN_DIR/target/classes" "$LEIN_DIR/src" ":$LEIN_DIR/resources"
 
     if [ -r "$LEIN_DIR/.lein-classpath" ]; then
         add_path CLASSPATH "$(cat "$LEIN_DIR/.lein-classpath" 2> /dev/null)"
     else
-        add_path CLASSPATH "$LEIN_DIR/leiningen-core/lib/*"
+        add_path CLASSPATH "$(cat "$LEIN_DIR/leiningen-core/.lein-bootstrap" 2> /dev/null)"
     fi
 else # Not running from a checkout
     add_path CLASSPATH "$LEIN_JAR"
     echo "to turn off certificate checks:"
     echo "  export HTTP_CLIENT=\"wget --no-check-certificate -O\" # or"
     echo "  export HTTP_CLIENT=\"curl --insecure -f -L -o\""
+    echo "It's also possible that you're behind a firewall haven't yet"
+    echo "set HTTP_PROXY and HTTPS_PROXY."
 }
 
 # TODO: explain what to do when Java is missing
 # If you're packaging this for a package manager (.deb, homebrew, etc)
 # you need to remove the self-install and upgrade functionality or see lein-pkg.
 if [ "$1" = "self-install" ]; then
-    if [ -r "$LEIN_JAR" ]; then
+    if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
+        echo "Running self-install from a checkout is not supported."
+        echo "See CONTRIBUTING.md for SNAPSHOT-specific build instructions."
+        exit 1
+    elif [ -r "$LEIN_JAR" ]; then
       echo "The self-install jar already exists at $LEIN_JAR."
       echo "If you wish to re-download, delete it and rerun \"$0 self-install\"."
       exit 1
     else
         rm "$LEIN_JAR.pending" 2> /dev/null
         download_failed_message "$LEIN_URL"
-        if [ $SNAPSHOT = "YES" ]; then
-            echo "See README.md for SNAPSHOT-specific build instructions."
-        fi
         exit 1
     fi
 elif [ "$1" = "upgrade" ]; then
         echo "You do not have permission to upgrade the installation in $SCRIPT"
         exit 1
     else
-        # TODO: change to stable when 2.0.0 is released
-        TARGET_VERSION="${2:-preview}"
+        TARGET_VERSION="${2:-stable}"
         echo "The script at $SCRIPT will be upgraded to the latest $TARGET_VERSION version."
         echo -n "Do you want to continue [Y/n]? "
         read RESP
 
     if ([ "$LEIN_FAST_TRAMPOLINE" != "" ] || [ -r .lein-fast-trampoline ]) &&
         [ -r project.clj ]; then
-        INPUTS="$@ $(cat project.clj) $(cat "$LEIN_HOME/profiles.clj")"
+        INPUTS="$@ $(cat project.clj) $LEIN_VERSION $(cat "$LEIN_HOME/profiles.clj")"
         INPUT_CHECKSUM=$(echo $INPUTS | shasum - | cut -f 1 -d " ")
         # Just don't change :target-path in project.clj, mkay?
         TRAMPOLINE_FILE="target/trampolines/$INPUT_CHECKSUM"
         exec sh -c "exec $(cat $TRAMPOLINE_FILE)"
     else
         export TRAMPOLINE_FILE
-        "$LEIN_JAVA_CMD" \
-            -client -XX:+TieredCompilation \
+        "$LEIN_JAVA_CMD" -client \
             "${BOOTCLASSPATH[@]}" \
             $LEIN_JVM_OPTS \
             -Dfile.encoding=UTF-8 \

File vim/after/plugin/fireplace.vim

+" Rebind keys in this file in the middle of nowhere because Tim Pope doesn't
+" like letting me do it in my vimrc like every other plugin in the world.
+
+" K is for "Kill", M is for "Man"
+autocmd FileType clojure nunmap <buffer> K
+autocmd FileType clojure nmap   <buffer> M <Plug>FireplaceK
+
+" Soft and hard require can take "r" in localleaderland
+autocmd FileType clojure nunmap <buffer> cpr
+autocmd FileType clojure nmap   <buffer> <localleader>r :Require<cr>
+autocmd FileType clojure nmap   <buffer> <localleader>R :Require!<cr>
+
+" Okay enough with the goddamn eval mappings
+autocmd FileType clojure nunmap <buffer> cp
+autocmd FileType clojure nunmap <buffer> cpp
+autocmd FileType clojure nunmap <buffer> cq
+autocmd FileType clojure nunmap <buffer> cqq
+autocmd FileType clojure nunmap <buffer> cqp
+autocmd FileType clojure nunmap <buffer> cqc
+autocmd FileType clojure nunmap <buffer> c!
+autocmd FileType clojure nunmap <buffer> c!!
+
+" Eval form
+autocmd FileType clojure nmap   <buffer> <localleader>ef <Plug>FireplacePrintab
+
+" Eval top-level form
+autocmd FileType clojure nmap   <buffer> <localleader>ee mz:call PareditFindDefunBck()<cr><Plug>FireplacePrintab:normal! `z<cr>
+
+" QuasiREPL
+autocmd FileType clojure execute 'nmap <buffer> <localleader>q <Plug>FireplacePrompt' . &cedit . 'i'
+
+" Again!
+autocmd FileType clojure execute 'nmap <buffer> <localleader>a <Plug>FireplacePrompt' . &cedit . 'k<cr>'
+
+" Edit form in quasirepl
+autocmd FileType clojure nmap   <buffer> <localleader>Ef <Plug>FireplaceEditab
+
+" Kill all the movement mappings except gf (I like that one)
+autocmd FileType clojure nunmap <buffer> [<c-d>
+autocmd FileType clojure nunmap <buffer> ]<c-d>
+autocmd FileType clojure nunmap <buffer> <c-w><c-d>
+autocmd FileType clojure nunmap <buffer> <c-w>d
+autocmd FileType clojure nunmap <buffer> <c-w>gd
+
+" Use normal tag movement keys instead, ctags is fucked for Clojure anyway
+autocmd FileType clojure nmap   <buffer> <c-]> <Plug>FireplaceDjump
+autocmd FileType clojure nmap   <buffer> <c-\> :vsplit<cr><Plug>FireplaceDjump
+

File vim/ftplugin/clojure/folding.vim

+if exists('loaded_clojurefolding') || &cp
+    finish
+endif
+let loaded_clojurefolding=1
+
+let folded_forms = [
+            \ 'def',
+            \ 'defn',
+            \ 'defn-',
+            \ 'defform',
+            \ 'defform-',
+            \ 'defrule',
+            \ 'defprotocol',
+            \ 'defparser',
+            \ 'defmacro',
+            \ 'defmethod',
+            \ 'defmulti',
+            \ 'defonce',
+            \ 'defpage',
+            \ 'defmigration',
+            \ 'defsketch',
+            \ 'defspec',
+            \ 'defremote',
+            \ 'defrecord',
+            \ 'defrec',
+            \ 'defpartial',
+            \ 'extend-type',
+            \ 'extend-protocol',
+            \ 'defgauge',
+            \ 'defmeter',
+            \ 'defhistogram',
+            \ 'defcounter',
+            \ 'deftimer',
+            \ 'deftest',
+            \ 'defroutes',
+            \ 'defentity',
+            \ 'defaspect',
+            \ 'add-aspect',
+            \ 'defdb',
+            \ 'defproject',
+            \ 'defsynth',
+            \ 'definst',
+            \ 'ns'
+            \ ]
+let s:form_re      = '\v^\((' . join(folded_forms, '|') . ')\s'
+let s:form_re_bare = '\v^\((' . join(folded_forms, '|') . ')$'
+
+function! s:NextNonBlankLineContents(start)
+    let lnum = a:start
+    let max = line("$")
+
+    while 1
+        let lnum += 1
+
+        " If we've run off the end of the file, return a blank string as
+        " a sentinel.
+        if lnum > max
+            return ""
+        endif
+
+        " Otherwise, get the contents.
+        let contents = getline(lnum)
+
+        " If they're non-blank, return it.  Otherwise we'll loop to the next
+        " line.
+        if contents =~ '\v\S'
+            return contents
+        endif
+    endwhile
+endfunction
+
+function! GetClojureFold()
+    let line = getline(v:lnum)
+
+    if line =~ s:form_re || line =~ s:form_re_bare
+        " We're on one of the forms we want to fold.
+
+        let nextline = s:NextNonBlankLineContents(v:lnum)
+
+        " If we've run off the end of the file, this means we're on a top-level
+        " form with no later nonblank lines in the file.  This has to be a one
+        " liner, because there's no content left that could be closing parens!
+        if nextline == ""
+            return 0
+        elseif nextline =~ '\v^\s+'
+            " If it's indented, this almost certainly isn't a one-liner.  Fold
+            " away!
+            return ">1"
+        else
+            " Otherwise, the next non-blank line after this one is not
+            " indented.  This means we're on a one-liner, so we don't want to
+            " fold.
+            return 0
+        endif
+    elseif line =~ '^\s*$'
+        " We need to look at the next non-blank line to determine how to fold
+        " blank lines.
+        let nextline = s:NextNonBlankLineContents(v:lnum)
+
+        " If we've run off the end of the file, this means we're on one of
+        " a series of blank lines ending the file.  They shouldn't be folded
+        " with anything.
+        if nextline == ""
+            return 0
+        elseif nextline =~ '\v^\s+'
+            " If it's indented, we're in the middle of an existing form.
+            " Just fold with that.
+            return "="
+        else
+            " Otherwise, the next non-blank line after this one is not
+            " indented.  That means we need to close any existing folds
+            " here.
+            return "<1"
+        endif
+    elseif line =~ '\v^\s+\S'
+        " Indented content, fold it into any existing folds.
+        return "="
+    else
+        " We are sitting on a non-blank, non-indented line, but it's not one of
+        " our special top-level forms, so we'll just leave it alone.
+        return 0
+    endif
+endfunction
+
+function! TurnOnClojureFolding()
+    setlocal foldexpr=GetClojureFold()
+    setlocal foldmethod=expr
+endfunction
 " }}}
 " Clojure {{{
 
-" function! SlimvToggleRepl()
-"     if bufname('%') ==# 'SLIMV.REPL'
-"         let origin = b:pop_back_to
-"         q
-"         execute "" . origin . "wincmd w"
-"     else
-"         let origin = winnr()
-"         vertical botright split
-"         e SLIMV.REPL
-"         let b:pop_back_to = origin
-"     endif
-" endfunction
-
-function! s:DebullshitClojureStacktrace() " {{{
-    syntax match GarbageFrame '\v +.+\.(java|clj):\d+ (clojure|swank)\..+$'
-    hi link GarbageFrame Comment
-endfunction " }}}
-
-command! -nargs=0 DebullshitClojureStacktrace call s:DebullshitClojureStacktrace()
-
 augroup ft_clojure
     au!
 
-    au FileType SLDB DebullshitClojureStacktrace
+    au BufNewFile,BufRead riemann.config set filetype=clojure
 
-    au BufNewFile,BufRead riemann.config set filetype=clojure
     au FileType clojure silent! call TurnOnClojureFolding()
-    au FileType clojure compiler clojure
-    au FileType clojure setlocal report=100000
-
-    au BufWinEnter            SLIMV.REPL setlocal nolist
-    au BufNewFile,BufReadPost SLIMV.REPL setlocal nowrap foldlevel=99
-    au BufNewFile,BufReadPost SLIMV.REPL nnoremap <buffer> A GA
-    au BufNewFile,BufReadPost SLIMV.REPL nnoremap <buffer> <localleader>R :emenu REPL.<Tab>
-
-    " Fix the eval mappings.
-    au FileType clojure nnoremap <buffer> <localleader>ef :call SlimvEvalExp()<cr>
-    au FileType clojure nnoremap <buffer> <localleader>ee :call SlimvEvalDefun()<cr>
-    au FileType clojure nnoremap <buffer> <localleader>en mzgg:call SlimvEvalDefun()<cr>`z
 
     " Friendlier Paredit mappings.
     au FileType clojure noremap <buffer> () :<c-u>call PareditWrap("(", ")")<cr>
     au FileType clojure noremap <buffer> (s :<c-u>call PareditSplit()<cr>
     au FileType clojure noremap <buffer> [ :<c-u>call PareditSmartJumpOpening(0)<cr>
     au FileType clojure noremap <buffer> ] :<c-u>call PareditSmartJumpClosing(0)<cr>
-
-    " And the inspect mapping.
-    au FileType clojure nmap <buffer> \i \di
-
-    " And REPL-toggling mapping.
-    " au FileType clojure nnoremap <buffer> \rr :call SlimvToggleRepl()<cr>
+    " ))))))))
 
     " Indent top-level form.
-    au FileType clojure nmap <buffer> <localleader>= mz99[(v%='z
+    au FileType clojure nmap <buffer> <localleader>= mz:call PareditFindDefunBck()<cr>=ab'z
 augroup END
 
 " }}}
 augroup END
 
 " }}}
-" Lisp {{{
-
-augroup ft_lisp
-    au!
-    au FileType lisp call TurnOnLispFolding()
-    " au FileType lisp nnoremap <buffer> <localleader>ee mz99[(va("ry:call Send_to_Tmux(@r)<cr>
-    " au FileType lisp nnoremap <buffer> <localleader>ee mz99[(:call SlimvEvalExp()<cr>`z
-
-    " Fix the eval mappings.
-    au FileType lisp nnoremap <buffer> <localleader>ef :call SlimvEvalExp()<cr>
-    au FileType lisp nnoremap <buffer> <localleader>ee :call SlimvEvalDefun()<cr>
-
-    au FileType lisp nnoremap <buffer> <localleader>tt mz0l99[(vab"ry:call Send_to_Tmux(@r)<cr>`z
-    au FileType lisp nnoremap <buffer> <localleader>tb mzggVG"ry:call Send_to_Tmux(@r)<cr>`z
-
-    " Indent top-level form.
-    au FileType lisp nmap <buffer> <localleader>= mz99[(v%='z
-augroup END
-
-" }}}
 " Mail {{{
 
 augroup ft_mail
 nnoremap <leader>L :LinediffReset<cr>
 
 " }}}
-" Lisp (built-in) {{{
-
-let g:lisp_rainbow = 1
-
-" }}}
 " Makegreen {{{
 
 nnoremap \| :call MakeGreen('')<cr>
 let g:org_debug = 1
 
 " }}}
+" Paredit {{{
+
+let g:paredit_smartjump = 1
+let g:paredit_shortmaps = 0
+
+" }}}
 " Powerline {{{
 
 let g:Powerline_symbols = 'fancy'
 nnoremap <silent> <leader><tab> :ScratchToggle<cr>
 
 " }}}
-" SLIMV {{{
-
-let g:slimv_leader = '\'
-let g:slimv_keybindings = 2
-let g:slimv_repl_name = 'SLIMV.REPL'
-let g:slimv_repl_split = 4
-" let g:slimv_repl_syntax = 0
-let g:slimv_repl_wrap = 0
-let g:slimv_preferred = 'clisp'
-let g:paredit_smartjump = 1
-
-" Use a swank command that works, and doesn't require new app windows.
-let g:slimv_swank_clojure = '!dtach -n /tmp/dtach-swank.sock -r winch lein ritz 4005'
-" let g:slimv_swank_clojure = '! xterm -e lein ritz 4005 &'
-let g:slimv_swank_clojure = '!false'
-
-" }}}}
 " Sparkup {{{
 
 let g:sparkupNextMapping = '<c-s>'
 let g:tslime_vars_mapping = '<localleader>T'
 
 " }}}
-" VimClojure {{{
-
-let vimclojure#HighlightBuiltins = 1
-let vimclojure#ParenRainbow = 1
-let vimclojure#WantNailgun = 0
-
-" }}}
 " YankRing {{{
 
 function! YRRunAfterMaps()