guns / vim-clojure-static

Meikel Brandmeyer's excellent Clojure runtime files
Other
420 stars 50 forks source link

Appending to lispwords in .vimrc breaks lispwords #55

Closed kyptin closed 10 years ago

kyptin commented 10 years ago

Hey, thanks for your work on vim-clojure-static. Definitely a timesaver for me!

I've stripped down my .vimrc file to an approximately minimal example:

set nocompatible
execute pathogen#infect()
filetype plugin indent on
syntax on

When I open a .clj file in Vim, everything works as expected, and I can type :set lispwords? to get:

lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,
definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecor
d,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,e
xtend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify
,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-binding
s,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-f
n,with-test

…which looks good to me.

However, when I add the following line to my .vimrc:

autocmd FileType clojure set lispwords+=log-wrap

…I can quit Vim, open up the same .clj file, and get lispwords equal to:

lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do
*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparame
ter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolis
t,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple
-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless
,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with
-output-to-string,with-package-iterator,define-condition,handler-bind,handler-ca
se,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-wa
rning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defcl
ass,defmethod,print-unreadable-object,log-wrap

As you can see, in this case, lispwords is its default value, plus log-wrap. As you can imagine, this means my Vim experience involves a lot of manual indentation.

Any idea what's going on here?

For what it's worth, I have Vim version 7.4, and I'm running on the latest version of this plugin.

guns commented 10 years ago

Hello,

Thanks for the descriptive problem description. lispwords was a global setting until 7.4.201, when it became a global-local option:

https://groups.google.com/forum/#!topic/vim_dev/6Abi8nsY2Dc

As a consequence of this, set lispwords+=log-wrap will append the global value, and setlocal lispwords+=log-wrap will append the local value.

Apparently, set lispwords+= also truncates the local value, presumably to cause &lispwords to fall through to the global value.

So, if you have Vim version 7.4.201+, please confirm if using setlocal solves your problem. If you have an earlier version, then this is a different problem.

Thanks for reporting!

kyptin commented 10 years ago

Hmm, I wasn't aware of the global vs. global-local distinction, nor of the setlocal command. Good to know!

I am using Vim 7.4.258, and I confirm that using setlocal instead of set makes it work perfectly. Many thanks!

Incidentally, thanks for all your work in the Clojure ecosystem, and kudos on getting a patch accepted for Vim. :-)