# HG changeset patch # User Steve Losh # Date 1461148705 0 # Node ID 08965030b28bb6dc81b109b6e8dc38f77f1a36fa # Parent f13a2b1ddedf8c5cf48ee62e69bd7f30e8476852 Roswellize the lispindent thing, unfuck paredit, and more diff -r f13a2b1ddedf -r 08965030b28b .hgignore --- a/.hgignore Fri Apr 15 18:06:03 2016 +0000 +++ b/.hgignore Wed Apr 20 10:38:25 2016 +0000 @@ -39,3 +39,4 @@ weechat/certs/ca-bundle.crt roswell/clhs +roswell/lispindent diff -r f13a2b1ddedf -r 08965030b28b bin/lisp --- a/bin/lisp Fri Apr 15 18:06:03 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -e - -rlwrap-sbcl "$@" diff -r f13a2b1ddedf -r 08965030b28b bin/lispindent --- a/bin/lispindent Fri Apr 15 18:06:03 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -#!/usr/local/bin/sbcl --script - -;Dorai Sitaram -;Oct 8, 1999 -;last change 2014-09-16 - -;this script takes lines of Lisp or Scheme code from its -;stdin and produces an indented version thereof on its -;stdout - -(defun safe-read (stream) - (let ((*read-eval* nil)) - (read stream nil))) - -(defun safe-read-from-string (string) - (let ((*read-eval* nil)) - (read-from-string string))) - - -(defvar *lisp-keywords* '()) - -(defun define-with-lisp-indent-number (n syms) - (dolist (sym syms) - (let* ((x (symbol-name sym)) - (c (assoc x *lisp-keywords* :test #'string-equal))) - (unless c - (push (setq c (cons x nil)) *lisp-keywords*)) - (setf (cdr c) n)))) - -(define-with-lisp-indent-number 0 - '(block - handler-bind - loop)) - -(define-with-lisp-indent-number 1 - '(case - defpackage do-all-symbols do-external-symbols dolist do-symbols dotimes - ecase etypecase eval-when - flet - handler-case - labels lambda let let* let-values - macrolet - prog1 - typecase - unless unwind-protect - when with-input-from-string with-open-file with-open-socket - with-open-stream with-output-to-string)) - -(define-with-lisp-indent-number 2 - '(assert - defun destructuring-bind do do* - if - multiple-value-bind - with-slots)) - -(defparameter *config-files* - (list (merge-pathnames ".lispwords" (user-homedir-pathname)) - ".lispwords" )) - -(dolist (path *config-files*) - (with-open-file (i path :if-does-not-exist nil) - (when i - (loop - (let ((w (or (safe-read i) (return)))) - (define-with-lisp-indent-number (car w) (cdr w))))))) - -(defun past-next-token (s i n) - (let ((escapep nil)) - (loop - (when (>= i n) (return i)) - (let ((c (char s i))) - (cond (escapep (setq escapep nil)) - ((char= c #\\) (setq escapep t)) - ((char= c #\#) - (let ((j (+ i 1))) - (if (>= j n) (return i) - (let ((c (char s j))) - (cond ((char= c #\\) (setq escapep t i j)) - (t (return i))))))) - ((member c '(#\space #\tab #\( #\) #\[ #\] #\" #\' #\` #\, #\;)) - (return i)))) - (incf i)))) - -(defun lisp-indent-number (s &optional (possible-keyword-p t)) - (or (cdr (assoc s *lisp-keywords* :test #'string-equal)) - (if (zerop (or (search "def" s :test #'char-equal) -1)) - 0 - (if possible-keyword-p - (let ((p (position #\: s :from-end t))) - (if p - (lisp-indent-number (subseq s (1+ p)) nil) - -1)) - -1)))) - -(defun literal-token-p (s) - (let ((colon-pos (position #\: s))) - (if colon-pos - (if (= colon-pos 0) t nil) - (let ((s (safe-read-from-string s))) - (or (eql t s) (characterp s) (numberp s) (stringp s)))))) - -;(trace lisp-indent-number literal-token-p read-from-string past-next-token) - -(defstruct lparen - word - spaces-before - num-aligned-subforms - (num-finished-subforms 0) - (num-processed-subforms 0)) - -(defun current-word (s i n) - (let ((j (past-next-token s i n))) - (when (not (= i j)) - (subseq s i j)))) - -(defvar *labels-keywords* '(labels flet)) - -(defun in-labels-p (stack w) - ; (format t "~%") - ; (format t "WORD: ~S~%" w) - ; (format t "STACK: ~S~%" stack) - (let ((target (cadr stack))) - ; (format t "TARGET: ~S~%" target) - (and target - (member (lparen-word target) *labels-keywords* - :key #'symbol-name :test #'string-equal) - (= (lparen-num-processed-subforms target) 0)))) - -(defun calc-subindent (stack s i n) - (let* ((j (past-next-token s i n)) - (num-aligned-subforms 0) - (left-indent - (if (= j i) 1 - (let ((w (subseq s i j))) - (if (and (>= i 2) (member (char s (- i 2)) '(#\' #\`))) 1 - (let ((nas (if (in-labels-p stack w) - 1 - (lisp-indent-number w)))) - (cond ((>= nas 0) (setq num-aligned-subforms nas) - 2) - ((literal-token-p w) 1) - ((= j n) 2) - (t (+ (- j i) 2))))))))) - (values left-indent num-aligned-subforms (1- j)))) - -(defun num-leading-spaces (s) - (let ((n (length s)) - (i 0) (j 0)) - (loop - (when (>= i n) (return 0)) - (case (char s i) - (#\space (incf i) (incf j)) - (#\tab (incf i) (incf j 8)) - (t (return j)))))) - -(defun string-trim-blanks (s) - (string-trim '(#\space #\tab #\newline #\return) s)) - - -(defun indent-lines () - (let ((left-i 0) (paren-stack '()) (stringp nil)) - (loop - (let* ((curr-line (or (read-line nil nil) (return))) - (leading-spaces (num-leading-spaces curr-line)) - (curr-left-i - (cond (stringp leading-spaces) - ((null paren-stack) - (when (= left-i 0) (setq left-i leading-spaces)) - left-i) - (t (let* ((lp (car paren-stack)) - (nas (lparen-num-aligned-subforms lp)) - (nfs (lparen-num-finished-subforms lp)) - (extra-w 0)) - (when (< nfs nas) ;(and (>= nas 0) (< nfs nas)) - (incf (lparen-num-finished-subforms lp)) - (setq extra-w 2)) - (+ (lparen-spaces-before lp) - extra-w)))))) - (setq curr-line (string-trim-blanks curr-line)) - (dotimes (k curr-left-i) (write-char #\space)) - ; (princ paren-stack) - (princ curr-line) (terpri) - ; - (let ((i 0) (n (length curr-line)) (escapep nil) - (inter-word-space-p nil)) - (loop - (when (>= i n) (return)) - (let ((c (char curr-line i))) - (cond (escapep (setq escapep nil)) - ((char= c #\\) (setq escapep t)) - (stringp (when (char= c #\") (setq stringp nil))) - ((char= c #\;) (return)) - ((char= c #\") (setq stringp t)) - ((member c '(#\space #\tab) :test #'char=) - (unless inter-word-space-p - (setq inter-word-space-p t) - (let ((lp (car paren-stack))) - (when lp - (incf (lparen-num-finished-subforms lp)))))) - ((member c '(#\( #\[) :test #'char=) - (setq inter-word-space-p nil) - (multiple-value-bind (left-indent num-aligned-subforms j) - (calc-subindent paren-stack curr-line (1+ i) n) - (push - (make-lparen :word (current-word curr-line (1+ i) n) - :spaces-before (+ i curr-left-i left-indent) - :num-aligned-subforms num-aligned-subforms) - paren-stack) - (setq i j))) - ((member c '(#\) #\]) :test #'char=) - (setq inter-word-space-p nil) - (cond (paren-stack (pop paren-stack)) - (t (setq left-i 0))) - (let ((lp (car paren-stack))) - (when lp - (incf (lparen-num-processed-subforms lp))))) - (t (setq inter-word-space-p nil))) - (incf i)))))))) - -(indent-lines) - -;eof diff -r f13a2b1ddedf -r 08965030b28b bin/lispindent.lisp --- a/bin/lispindent.lisp Fri Apr 15 18:06:03 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -./lispindent \ No newline at end of file diff -r f13a2b1ddedf -r 08965030b28b bin/lispindentclean --- a/bin/lispindentclean Fri Apr 15 18:06:03 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -LISP=sbcl lispindent | sed -e 's/ *$//' diff -r f13a2b1ddedf -r 08965030b28b lispwords --- a/lispwords Fri Apr 15 18:06:03 2016 +0000 +++ b/lispwords Wed Apr 20 10:38:25 2016 +0000 @@ -1,6 +1,11 @@ ; unfuck normal shit (1 if) (-1 loop) +(2 defmethod) +(2 with-accessors) + +; my own weird things +(1 make-array) ; fiveam (1 test) diff -r f13a2b1ddedf -r 08965030b28b roswell/lispindent.ros --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/roswell/lispindent.ros Wed Apr 20 10:38:25 2016 +0000 @@ -0,0 +1,253 @@ +#!/bin/sh +#|-*- mode:lisp -*-|# +#| +exec ros -Q -- $0 "$@" +|# + +#| + +Roswell version of my fork of lispindent +https://github.com/ds26gte/scmindent + +Some day I need to rewrite this with smug or something, jesus. + +|# + +;Dorai Sitaram +;Oct 8, 1999 +;last change 2014-09-16 + +;this script takes lines of Lisp or Scheme code from its +;stdin and produces an indented version thereof on its +;stdout + +(defun safe-read (stream) + (let ((*read-eval* nil)) + (read stream nil))) + +(defun safe-read-from-string (string) + (let ((*read-eval* nil)) + (read-from-string string))) + + +(defvar *lisp-keywords* '()) +(defvar *labels-keywords* '(labels flet macrolet)) +(defvar *lambda-list-keywords* '(defun defmethod)) + + +(defun define-with-lisp-indent-number (n syms) + (dolist (sym syms) + (let* ((x (symbol-name sym)) + (c (assoc x *lisp-keywords* :test #'string-equal))) + (unless c + (push (setq c (cons x nil)) *lisp-keywords*)) + (setf (cdr c) n)))) + +(define-with-lisp-indent-number 0 + '(block + handler-bind + loop)) + +(define-with-lisp-indent-number 1 + '(case + defpackage do-all-symbols do-external-symbols dolist do-symbols dotimes + ecase etypecase eval-when + flet + handler-case + labels lambda let let* let-values + macrolet + prog1 + typecase + unless unwind-protect + when with-input-from-string with-open-file with-open-socket + with-open-stream with-output-to-string)) + +(define-with-lisp-indent-number 2 + '(assert + defun destructuring-bind do do* + if + multiple-value-bind + with-slots)) + + +(defparameter *config-files* + (list (merge-pathnames ".lispwords" (user-homedir-pathname)) + ".lispwords" )) + + +(defun source-config-files () + (dolist (path *config-files*) + (with-open-file (i path :if-does-not-exist nil) + (when i + (loop + (let ((w (or (safe-read i) (return)))) + (define-with-lisp-indent-number (car w) (cdr w)))))))) + + +(defstruct lparen + word + spaces-before + num-aligned-subforms + (num-finished-subforms 0) + (num-processed-subforms 0)) + + +(defun past-next-token (s i n) + (let ((escapep nil)) + (loop + (when (>= i n) (return i)) + (let ((c (char s i))) + (cond (escapep (setq escapep nil)) + ((char= c #\\) (setq escapep t)) + ((char= c #\#) + (let ((j (+ i 1))) + (if (>= j n) (return i) + (let ((c (char s j))) + (cond ((char= c #\\) (setq escapep t i j)) + (t (return i))))))) + ((member c '(#\space #\tab #\( #\) #\[ #\] #\" #\' #\` #\, #\;)) + (return i)))) + (incf i)))) + +(defun lisp-indent-number (s &optional (possible-keyword-p t)) + (or (cdr (assoc s *lisp-keywords* :test #'string-equal)) + (if (zerop (or (search "def" s :test #'char-equal) -1)) + 0 + (if possible-keyword-p + (let ((p (position #\: s :from-end t))) + (if p + (lisp-indent-number (subseq s (1+ p)) nil) + -1)) + -1)))) + +(defun literal-token-p (s) + (let ((colon-pos (position #\: s))) + (if colon-pos + (if (= colon-pos 0) t nil) + (let ((s (safe-read-from-string s))) + (or (eql t s) (characterp s) (numberp s) (stringp s)))))) + +;(trace lisp-indent-number literal-token-p read-from-string past-next-token) + +(defun current-word (s i n) + (let ((j (past-next-token s i n))) + (when (not (= i j)) + (subseq s i j)))) + + +(defun in-labels-p (stack) + (let ((target (cadr stack))) + (and target + (member (lparen-word target) *labels-keywords* + :key #'symbol-name :test #'string-equal) + (= (lparen-num-processed-subforms target) 0)))) + +(defun in-lambda-list-p (stack) + (let ((target (car stack))) + (and target + (member (lparen-word target) *lambda-list-keywords* + :key #'symbol-name :test #'string-equal) + (= (lparen-num-processed-subforms target) 0)))) + + +(defun calc-subindent (stack s i n) + (let* ((j (past-next-token s i n)) + (num-aligned-subforms 0) + (left-indent + (if (= j i) 1 + (let ((w (subseq s i j))) + (if (and (>= i 2) (member (char s (- i 2)) '(#\' #\`))) 1 + (let ((nas (if (in-labels-p stack) + 1 + (lisp-indent-number w)))) + (cond ((in-lambda-list-p stack) 1) + ((>= nas 0) (setq num-aligned-subforms nas) + 2) + ((literal-token-p w) 1) + ((= j n) 2) + (t (+ (- j i) 2))))))))) + (values left-indent num-aligned-subforms (1- j)))) + +(defun num-leading-spaces (s) + (let ((n (length s)) + (i 0) (j 0)) + (loop + (when (>= i n) (return 0)) + (case (char s i) + (#\space (incf i) (incf j)) + (#\tab (incf i) (incf j 8)) + (t (return j)))))) + + +(defun string-trim-blanks (s) + (string-trim '(#\space #\tab #\newline #\return) s)) + + +(defun indent-lines () + (let ((left-i 0) + (paren-stack '()) + (stringp nil)) + (loop + (let* ((curr-line (or (read-line nil nil) (return))) + (leading-spaces (num-leading-spaces curr-line)) + (curr-left-i + (cond (stringp leading-spaces) + ((null paren-stack) + (when (= left-i 0) (setq left-i leading-spaces)) + left-i) + (t (let* ((lp (car paren-stack)) + (nas (lparen-num-aligned-subforms lp)) + (nfs (lparen-num-finished-subforms lp)) + (extra-w 0)) + (when (< nfs nas) ;(and (>= nas 0) (< nfs nas)) + (incf (lparen-num-finished-subforms lp)) + (setq extra-w 2)) + (+ (lparen-spaces-before lp) + extra-w)))))) + (setq curr-line (string-trim-blanks curr-line)) + (when (not (string= curr-line "")) ; don't add "trailing" whitespace + (dotimes (k curr-left-i) (write-char #\space))) + (princ curr-line) + (terpri) + ; + (let ((i 0) (n (length curr-line)) (escapep nil) + (inter-word-space-p nil)) + (loop + (when (>= i n) (return)) + (let ((c (char curr-line i))) + (cond (escapep (setq escapep nil)) + ((char= c #\\) (setq escapep t)) + (stringp (when (char= c #\") (setq stringp nil))) + ((char= c #\;) (return)) + ((char= c #\") (setq stringp t)) + ((member c '(#\space #\tab) :test #'char=) + (unless inter-word-space-p + (setq inter-word-space-p t) + (let ((lp (car paren-stack))) + (when lp + (incf (lparen-num-finished-subforms lp)))))) + ((member c '(#\( #\[) :test #'char=) + (setq inter-word-space-p nil) + (multiple-value-bind (left-indent num-aligned-subforms j) + (calc-subindent paren-stack curr-line (1+ i) n) + (push + (make-lparen :word (current-word curr-line (1+ i) n) + :spaces-before (+ i curr-left-i left-indent) + :num-aligned-subforms num-aligned-subforms) + paren-stack) + (setq i j))) + ((member c '(#\) #\]) :test #'char=) + (setq inter-word-space-p nil) + (cond (paren-stack (pop paren-stack)) + (t (setq left-i 0))) + (let ((lp (car paren-stack))) + (when lp + (incf (lparen-num-processed-subforms lp))))) + (t (setq inter-word-space-p nil))) + (incf i)))))))) + + +(defun main (&rest argv) + (declare (ignore argv)) + (source-config-files) + (indent-lines)) diff -r f13a2b1ddedf -r 08965030b28b userContent.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userContent.css Wed Apr 20 10:38:25 2016 +0000 @@ -0,0 +1,21 @@ +body.sjl-unstyled { + width: 800px; margin: 50px auto 200px; + font-family: Georgia; + font-size: 16px; + line-height: 1.4; +} +body.sjl-unstyled pre,code { + font-family: menlo !important; + font-size: 14px; + line-height: 1.4; +} +body.sjl-unstyled code { + background: #eee; + padding: 1px 4px; +} +body.sjl-unstyled pre { + padding: 15px; + overflow-x: scroll; +} +body.sjl-unstyled h3 { text-decoration: none; } +body.sjl-unstyled h4 { text-decoration: none; } diff -r f13a2b1ddedf -r 08965030b28b vim/after/plugin/paredit.vim --- a/vim/after/plugin/paredit.vim Fri Apr 15 18:06:03 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -augroup unmap_paredit_bullshit - au! - - " Quit fucking with my split-line mapping, paredit. - au Filetype lisp,clojure,gdl,scheme nnoremap S i^mwgk:silent! s/\v +$//:noh`w - - " Also quit fucking with my save file mapping. - au FileType lisp,clojure,gdl,scheme nunmap s - - " Oh my god will you fuck off already - au FileType lisp,clojure,gdl,scheme nnoremap dp :diffput - au FileType lisp,clojure,gdl,scheme nnoremap do :diffobtain -augroup END diff -r f13a2b1ddedf -r 08965030b28b vim/bundle/ooze/plugin/ooze.vim --- a/vim/bundle/ooze/plugin/ooze.vim Fri Apr 15 18:06:03 2016 +0000 +++ b/vim/bundle/ooze/plugin/ooze.vim Wed Apr 20 10:38:25 2016 +0000 @@ -127,6 +127,25 @@ let @z = z endfunction " }}} +function! OozeQuickload(system) " {{{ + let msg = {"op": "eval", "code": "(ql:quickload :" . a:system . ")"} + call OozeSendMessage(msg) +endfunction " }}} +function! OozeQuickloadCurrent() " {{{ + let systems = split(system('ls -1 *.asd | grep -v test')) + if len(systems) == 0 + echom "Could not find any .asd files..." + return + elseif len(systems) > 1 + echom "Found too many any .asd files..." + return + endif + + let system = split(systems[0], '[.]')[0] + + call OozeQuickload(system) +endfunction " }}} + function! OozeDocument(symbol) " {{{ let msg = {"op": "documentation", "symbol": a:symbol} call OozeSendMessage(msg) @@ -159,6 +178,12 @@ let @z = z endfunction " }}} function! OozeArglistFormHead() " {{{ + if synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") == "Comment" + " bail if we're in a comment + " TODO: make this suck less + return + endif + let view = winsaveview() execute "normal v\(sexp_inner_list)o\(sexp_inner_element)" call OozeArglistSelection() @@ -207,6 +232,9 @@ nnoremap C :call OozeConnect() nnoremap K :call OozeDisconnect() + nnoremap q :call OozeQuickloadCurrent() + nnoremap Q :call OozeQuickload(input("? ")) + nnoremap h :call OozeHyperspecForm() nnoremap H :call OozeHyperspec(input("? ")) diff -r f13a2b1ddedf -r 08965030b28b vim/ftplugin/lisp/lispfolding.vim --- a/vim/ftplugin/lisp/lispfolding.vim Fri Apr 15 18:06:03 2016 +0000 +++ b/vim/ftplugin/lisp/lispfolding.vim Wed Apr 20 10:38:25 2016 +0000 @@ -119,51 +119,58 @@ endfunction function! GetLispFold(lnum) + let save_cursor = getpos('.') + let save_search = @/ let inline_fn_comment_re = '\v^ *;;( .*)?$' - if getline(a:lnum) =~ '^;;;; ' - " Never fold top-level header comments - return "0" - elseif getline(a:lnum) =~ '^;;; ' - " Subheader top level comments should get folded together in level 1 - return "1" - elseif getline(a:lnum) =~ inline_fn_comment_re - " Inline function comments should increment the fold level - let prev = getline(a:lnum - 1) =~ inline_fn_comment_re - let next = getline(a:lnum + 1) =~ inline_fn_comment_re + try + if getline(a:lnum) =~ '^;;;; ' + " Never fold top-level header comments + return "0" + elseif getline(a:lnum) =~ '^;;; ' + " Subheader top level comments should get folded together in level 1 + return "1" + elseif getline(a:lnum) =~ inline_fn_comment_re + " Inline function comments should increment the fold level + let prev = getline(a:lnum - 1) =~ inline_fn_comment_re + let next = getline(a:lnum + 1) =~ inline_fn_comment_re - if (!prev) && next - return "a1" - elseif prev && (!next) - return "s1" + if (!prev) && next + return "a1" + elseif prev && (!next) + return "s1" + else + return "=" + endif + elseif getline(a:lnum) =~ '^; ' + " don't include commentary-commented lines in deeper folds than necessary + return "-1" + elseif getline(a:lnum) =~ '^(test ' + " (test ...) folds at the top level + return ">1" + elseif getline(a:lnum) =~ '^(def\S\+ ' + " fuck it just fold everything that looks kinda deffy + return ">1" + elseif getline(a:lnum) =~ '^$' && getline(a:lnum - 1) =~ '^$' + return "0" + elseif getline(a:lnum) =~ '^$' + " Single blank lines fold along with the previous line, so that the + " blank line after a defun gets folded into the defun. + return "=" + " elseif LispFoldingStartFlet(a:lnum) == 1 + " " if this is a function definition in a labels/flet/etc, we want to + " " start a new deeper fold + " return ">2" + " elseif LispFoldingEndFlet(a:lnum) + " " if this is the END of a flet definition, we should pop a foldlevel + " return "<2" else return "=" endif - elseif getline(a:lnum) =~ '^; ' - " don't include commentary-commented lines in deeper folds than necessary - return "-1" - elseif getline(a:lnum) =~ '^(test ' - " (test ...) folds at the top level - return ">1" - elseif getline(a:lnum) =~ '^(def\S\+ ' - " fuck it just fold everything that looks kinda deffy - return ">1" - elseif getline(a:lnum) =~ '^$' && getline(a:lnum - 1) =~ '^$' - return "0" - elseif getline(a:lnum) =~ '^$' - " Single blank lines fold along with the previous line, so that the - " blank line after a defun gets folded into the defun. - return "=" - elseif LispFoldingStartFlet(a:lnum) == 1 - " if this is a function definition in a labels/flet/etc, we want to - " start a new deeper fold - return ">2" - elseif LispFoldingEndFlet(a:lnum) - " if this is the END of a flet definition, we should pop a foldlevel - return "<2" - else - return "=" - endif + finally + call setpos('.', save_cursor) + let @/ = save_search + endtry endfunction function! TurnOnLispFolding() diff -r f13a2b1ddedf -r 08965030b28b vim/vimrc --- a/vim/vimrc Fri Apr 15 18:06:03 2016 +0000 +++ b/vim/vimrc Wed Apr 20 10:38:25 2016 +0000 @@ -298,6 +298,9 @@ nnoremap ( :tabprev nnoremap ) :tabnext +" My garbage brain can't ever remember digraph codes +inoremap :help digraph-table + " Wrap nnoremap W :set wrap! @@ -1012,16 +1015,20 @@ augroup ft_commonlisp au! - au BufNewFile,BufRead *.asd set filetype=lisp + au BufNewFile,BufRead *.asd,*.ros set filetype=lisp au FileType lisp call SetLispWords() au FileType lisp RainbowParenthesesActivate au syntax lisp RainbowParenthesesLoadRound + au FileType lisp call EnableParedit() au FileType lisp silent! call TurnOnLispFolding() - au FileType lisp setlocal iskeyword+=!,?,% + au FileType lisp setlocal equalprg=lispindent + + " scratch buffer + au FileType lisp nnoremap :e scratch.lisp " Paredit mappings au FileType lisp noremap () :call PareditWrap("(", ")") @@ -1032,12 +1039,8 @@ au FileType lisp noremap (s :call PareditSplit() au FileType lisp noremap )j :call PareditJoin() au FileType lisp noremap )s :call PareditSplit() - au FileType lisp noremap [[ :call PareditSmartJumpOpening(0) - au FileType lisp noremap ]] :call PareditSmartJumpClosing(0) " )) - au FileType lisp setlocal equalprg=lispindentclean - " s/it/happening/ " " Map the Ooze keys, then add a few extra on top to work with the REPL. @@ -2313,6 +2316,25 @@ let g:paredit_smartjump = 1 let g:paredit_shortmaps = 0 let g:paredit_electric_return = 1 +let g:paredit_disable_lisp = 1 + +function! EnableParedit() + call PareditInitBuffer() + + " Quit fucking with my split-line mapping, paredit. + nunmap S + + " Also quit fucking with my save file mapping. + nunmap s + + " Oh my god will you fuck off already + " nnoremap dp :diffput + " nnoremap do :diffobtain + + " Eat shit + nunmap [[ + nunmap ]] +endfunction " }}} " Python-Mode {{{ @@ -2390,22 +2412,28 @@ " Sexp {{{ function! s:vim_sexp_mappings() " {{{ - xmap af (sexp_outer_list) - omap af (sexp_outer_list) - xmap if (sexp_inner_list) - omap if (sexp_inner_list) - xmap aF (sexp_outer_top_list) - omap aF (sexp_outer_top_list) - xmap iF (sexp_inner_top_list) - omap iF (sexp_inner_top_list) - xmap as (sexp_outer_string) - omap as (sexp_outer_string) - xmap is (sexp_inner_string) - omap is (sexp_inner_string) - xmap ae (sexp_outer_element) - omap ae (sexp_outer_element) - xmap ie (sexp_inner_element) - omap ie (sexp_inner_element) + xmap af (sexp_outer_list) + omap af (sexp_outer_list) + xmap if (sexp_inner_list) + omap if (sexp_inner_list) + xmap aF (sexp_outer_top_list) + omap aF (sexp_outer_top_list) + xmap iF (sexp_inner_top_list) + omap iF (sexp_inner_top_list) + xmap as (sexp_outer_string) + omap as (sexp_outer_string) + xmap is (sexp_inner_string) + omap is (sexp_inner_string) + xmap ae (sexp_outer_element) + omap ae (sexp_outer_element) + xmap ie (sexp_inner_element) + omap ie (sexp_inner_element) + + nmap [[ (sexp_swap_element_backward) + xmap [[ (sexp_swap_element_backward) + nmap ]] (sexp_swap_element_forward) + xmap ]] (sexp_swap_element_forward) + " nmap ( (sexp_move_to_prev_bracket) " xmap ( (sexp_move_to_prev_bracket) " omap ( (sexp_move_to_prev_bracket) @@ -2473,10 +2501,6 @@ " xmap (sexp_swap_list_backward) " nmap (sexp_swap_list_forward) " xmap (sexp_swap_list_forward) - " nmap (sexp_swap_element_backward) - " xmap (sexp_swap_element_backward) - " nmap (sexp_swap_element_forward) - " xmap (sexp_swap_element_forward) " nmap (sexp_emit_head_element) " xmap (sexp_emit_head_element) " nmap (sexp_emit_tail_element)