Fork me on GitHub
#vim
<
2020-03-13
>
marrs18:03:29

Hello vimmers, can anyone tell me why vim might be using different rules to define words for lisp as it does for other languages? And more importantly, how to stop it from doing that? Right now, words are defined more along the lines of a standard W than a w. This also affects searching for a word under the cursor with * or #

mjw18:03:46

I’m trying to remember the name of the exact setting, but it’s possible define keyword boundaries per language. You probably have a plugin that’s setting those boundaries explicitly (e.g., jdbc/execute-one! is treated as a single word in Clojure whereas it might be two or three in other languages).

marrs18:03:48

thx @matt.wistrand. The example you gave seems to be true for the standard lisp filetype setting as well. One way it differs from Clojure for me at least is that for a string like ring.util.blah, "ring", "util", and "blah" are treated as separate words

marrs18:03:49

whereas in Clojure mode, everything that isn't a whitespace is matched

mjw19:03:30

The setting is iskeyword. If you enter :set iskeyword in Vim, you’ll see a list of characters included in the file type’s definition of “word characters”. You’re supposed to be able to override that via ftplugin/clojure.vim but I’m having trouble doing so.

marrs19:03:51

thx, I'll take a look

marrs19:03:57

interesting, the rules for lisp and clojure are actually very similar. It looks like . is almost the only char that isn't included by the lisp ftplugin that is included by the clojure one. I guess the intention for both is that matching is on the entire symbol, rather than a portion of it. Anyway, I now know that it's a standard feature of vim rather than a plugin, so thanks for that. I'll see how i get on with the different defaults for both filetypes

mjw19:03:32

Yeah, it’s not in any of my plugins, so :verbose set iskeyword reveals the setting is coming from (neo)vim itself.

marrs19:03:05

@matt.wistrand found a nice solution. I'm going to guess you were trying to modify ~/.vim/ftplugin/clojure.vim. That won't work cos the installed ftplugin gets called after that. You have to create a file in ~/.vim/after/ftplugin/clojure.vim instead, and then you can modify the setings in there, so I added setlocal iskeyword-=/ to allow me to find all calls belonging to an imported package

🎉 4
marrs19:03:00

(also, what is going on with Slack formatting?)

Noah Bogart15:03:23

do you mean the new editor stuff? if you want the old markdown-only method of formatting text, go to your preferences, advanced, click the "format messages with markup" button