This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-30
Channels
- # announcements (5)
- # beginners (90)
- # cider (15)
- # clara (1)
- # clj-kondo (2)
- # cljs-dev (17)
- # clojars (8)
- # clojure (132)
- # clojure-europe (14)
- # clojure-nl (5)
- # clojure-uk (57)
- # clojurescript (39)
- # code-reviews (44)
- # conjure (6)
- # core-async (6)
- # cursive (20)
- # data-science (1)
- # datomic (13)
- # fulcro (11)
- # graalvm (6)
- # graphql (6)
- # helix (10)
- # joker (2)
- # kaocha (37)
- # leiningen (24)
- # malli (15)
- # off-topic (13)
- # pathom (18)
- # pedestal (14)
- # re-frame (67)
- # reitit (5)
- # ring (13)
- # ring-swagger (4)
- # sci (41)
- # shadow-cljs (33)
- # slack-help (5)
- # spacemacs (1)
- # sql (34)
- # tools-deps (64)
- # vim (171)
- # xtdb (3)
After using evil mode emacs for a long time, I figured I should try vim again, since I often find myself using vim in other circumstances. The problem is that I don’t really know vim. I only really know vi.
I have Pathogen running, and I tried installing vim-surround.vim, vim-sexp/plugin/sexp.vim, vim-sexp/autoload/sexp.vim, sexp_mappings_for_regular_people.vim, and repeat.vim all under my ~/.vim/bundle directory.
But this is where my lack of vim gets me. I don’t know how to enable any of this stuff. I had naively thought it would work when I run vim on a .clj file, but doing things like inserting a (
character doesn’t do anything special.
Does anyone know how I can turn it on please?
try adding vim-clojure-static - that should make clojure hook in to use the lisp / sexp oriented plugins
there's also :set lisp
which can be run in any buffer and should turn on all your lisp-specific plugins in that buffer if they are loaded
The runtimepath value is picking up all the subdirectories under ~/.vim/bundle
so I figure that pathogen is working
and I see that omnifunc is set to clojurecomplete#Complete,
so it looks like something that does Clojure stuff came in
But I load a .clj file and open a paren, and nothing happens. :set lisp
did not change anything
you can try calling any :
command defined by one of the plugins I guess? - if you use the new /pack/
alternative to bundle (built into vim) there's a :packadd
command
do you just have this issue with clojure files? are any other plugins loaded?
check out :he pack
- it's the thing that comes with the editor, so one less plugin to use, and has some inspectability and is well documented
It’s a bit of a shame. I had it installed on a previous system (just following the same directions), and I could get simple functionality. I had thought it would be easy to install the same way
for the basic sanity check, you've restarted vim since adding the plugins right?
you'll need to check the docs for pathogen for that
oh - s/`:he pack`/`:he packages` - that's the better doc node for the built in directory based plugin package installation
there's also debug-mode vim -D ...
but I haven't used it, just read about it
that's what I'd recommend yeah, it accepts the same plugins that pathogen uses
not just pack/start
pack/foo/start
- I just use pack/default/start
but the middle dir helps you keep things more organized
To be honest, I don’t know if I’m loading anything properly at all. If I’m not, then this might fix it. If I am, and it’s just not working for another reason, then this will do nothing
fair enough!
I just tried vim -D
for the first time - works with vim but not nvim it seems
OK. It seems to have loaded. I removed the pathogen infect line from .vimrc, and when I say :set
then I see a whole lotta things like lispwords
and indentExpr
. So it must be picking things up
lispwords comes with vim
it gets set locally by vim-clojure-static with clojure apropriate words though
no, vim has an abstract concept of "a lisp" and how to behave differently with lisps
oh, then that's a good sign
`lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defon ce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-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-bindings,with-in-s tr,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test`
perhaps you need to run the command that actually turns on vim-sexp (though I see nothing like that in my own config...)
perhaps vim does come with a clojure filetype nowadays - you could check by starting with no config file
vim -u NONE
to skip init and plugins, vim -u NORC
to get plugins but no vimrc
there's also the fact that vim and nvim put plugins and config in different places
:syntax on
fixes that
:colorscheme ...
anyway, removing telling it to skip config files / plugins is a good way to get a baseline
It looks like packages are being loaded just fine. The issue is that neither paredit nor sexp do anything
are you using vim-clojure-static
?
not sure, I always use it
I’m sort of expecting someone to say, “Oh, you have xyz
set. That stops it from working.” I will then confess that I am an idiot who knows nothing about computers, and we can get on with our day 🙂
What doesn't work for you?
Do you have paredit installed or just sexp?
I don't have paredit, and I get that behavior -
% ls ~/.config/nvim/pack/default/start
airline cucumber fzf.vim gundo orgmode tags utl
airline-themes fugitive gnupg ingo-library outliner tags-te
clojure-static fzf guile neoterm sexp ultisnips
Does vim "recognize" the filetype as clojure?
What happens when you ":set ft=clojure"
unless I'm reading that wrong, clojure-static and sexp are my only clojure specific plugins
So it recognizes the ft, but the plugins don't work? Does any other plugin not related to clojure work?
if vim-sexp is working - run this in any buffer regardless of file type and it will cause (
to insert ()
:imap <silent><buffer> ( <Plug>(sexp_insert_opening_round)
if that fails to insert () or errors that sexp_insert_opening_round doesn't exist, sexp wasn't loaded
that's thanks to <silent> I bet, but yeah I think that proves it wasn't loaded
then when I went to insert mode and tried to type a (
it appeared to hang. I press Ctrl-C, and I get a screen full of:
lug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug><Plug>
um wow
that gets mapped by default in clojure files
That's the thing I dislike about pathogen - no feedback... Any way I can interest you in using https://github.com/junegunn/vim-plug instead? The instructions are very simple and it fetches and loads the plugins for you. Also, are you using Vim or Neovim? Which version?
@nirrub I already suggested moving to the built in vim plugin management...
I don't see why one would use a third party package for that these days
In my (very) humble opinion - it's just more intuitive than pack - you write the names of the plugins, issue a command, and they get installed to wherever it's needed. You get builtin nifty stuff like seeing which packages are installed, a single command to update etc. Just easier to grok IMHO (that's about vim-plug)
:thumbsup: - that's a fair argument, we are discussing similar in this thread https://clojurians.slack.com/archives/C0DF8R51A/p1593539395294400
one thing i like about vim-plug is that it updates all the plugins in parallel, instead of iterating through them one by one i haven't tried the built in vim package manager, so for all i know, it does that too, but i would guess that it probably doesn't
if you only have a handful of plugins, then it doesn't matter. i'm on the "vim as an IDE" side of the spectrum, though, and i have dozens of plugins
by updating do you mean it is looking for newer versions?
I don't think the builtin even has that functionality (I can imagine how I'd implement it I guess) - I've never been the type to blindly update versions of anything in my dev toolchain though (bit hard by CIDER years ago and still shy)
it all depends on your philosophy. i have a recurring reminder that i set for myself to update all of my vim plugins and apt-get packages twice a week
every now and then i get bit by a breaking change, but i figure things don't typically change much within a few days, and it isn't too annoying to work through these small sorts of breaking changes
vs. waiting months/years and then updating and facing potentially lots of big breaking changes
i can definitely understand the "never update" philosophy that a lot of people have though
if you have a set of package versions that are working for you, and you don't have a compelling reason to update, then why bother?
mind you, for things I deploy at work, we have strict security rules and enforced updates based on CVEs
but that doesn't really effect my local dev stack so much
Vim-clojure-static shouldn't be necessary. It's included with vim. It sounds like vim-sexp isn't loaded @quoll
TIL - I guess I did set up my config a very long time ago
indeed - precisely why I suggested switching to the built in packaging instead of figuring out how to debug pathogen LOL
@noisesmith so, totally separate conversation, dein is faster than the package functionality
yeah - I try to obey occam's razor with my setup, and always considered third package management an unneeded entity :D
but I'll consider that if my startup time gets painful
@noisesmith got me to change to pack
@quoll could you do find
in that folder? I want to double check what you've got exactly.
I’ve put some vim files in directly. For some things I’ve done a git clone
. So it’s messy
$ find . -type f
./indent/clojure.vim
./ftplugin/clojure.vim
./repeat.vim
./ftdetect/clojure.vim
./rust/indent/rust.vim
./rust/ftplugin/rust.vim
./rust/ftplugin/rust/tagbar.vim
./rust/LICENSE-APACHE
./rust/ctags/rust.ctags
./rust/test/Dockerfile
./rust/test/coverage.vader
./rust/test/vimrc
./rust/test/.gitignore
./rust/test/sample.rs
./rust/test/run-tests
./rust/syntax_checkers/rust/cargo.vim
./rust/syntax_checkers/rust/rustc.vim
./rust/ftdetect/rust.vim
./rust/plugin/rust.vim
./rust/plugin/cargo.vim
./rust/README.md
./rust/ISSUE_TEMPLATE.md
./rust/.vintrc.yml
./rust/.gitignore
./rust/doc/rust.txt
./rust/autoload/rust.vim
./rust/autoload/cargo/quickfix.vim
./rust/autoload/rust/debugging.vim
./rust/autoload/rust/delimitmate.vim
./rust/autoload/rustfmt.vim
./rust/autoload/cargo.vim
./rust/after/syntax/rust.vim
./rust/.git/config
./rust/.git/shallow
./rust/.git/objects/61/14b747b578814c81f0a7577e94e134ace03ae8
./rust/.git/objects/92/885e74f3c020f38ed5c456c36a7844c52cbe9a
./rust/.git/objects/68/bc584564015f3c173ce567f6c2c0a4c2841e1b
./rust/.git/objects/32/86ab2a84757044457ed1fbd2e11c0c026f53dc
./rust/.git/objects/51/adf5f5f74d196abfcdd1aca8bd5899b756c6c7
./rust/.git/objects/5f/e77ccb964f4011c480d7047c677985e12caada
./rust/.git/objects/9c/b1b4801ebc06bb56f85fa272488edb05e98b75
./rust/.git/objects/9c/8e6be762cc67efebbd72408a07ca8925f200f6
./rust/.git/objects/a4/7a75a22040a0ab92b4591d16ae51cd84d4839f
./rust/.git/objects/b5/d40e2f59c0d2803d6452f8bbbdf4e704719abc
./rust/.git/objects/ad/f2d4b0fe4ffba4e14cb3f80383ca2d2c3fea0f
./rust/.git/objects/d0/652ec8f4ed4ff67f1493803a01169f478061b4
./rust/.git/objects/d6/0a3d3a10a9d681af47444cc1e57ba311347744
./rust/.git/objects/d6/e51180aebb0f4a9519e7cab840889d58497bb7
./rust/.git/objects/ae/307a0bc9904a4f2c6c2469b0f57aa581d1378e
./rust/.git/objects/fc/681cc29771771526b4901db2dc189c4aeed2d5
./rust/.git/objects/fd/b2d39fb04b139fcdb9b707f9b2ccc219566632
./rust/.git/objects/e3/8d1641bd14493aac13e70a436c60339f3c4490
./rust/.git/objects/e3/75078549c39292572b07cdb7b1b7a381ae1e5f
./rust/.git/objects/c8/4c49e9aabf99b0a452dd5b6e40c7a7ddaea51a
./rust/.git/objects/fb/16fc72e081199d3e1532ea4ab89f5a94207c7d
./rust/.git/objects/4e/c13dc4e75652fc085aff4a585ead2a5fba936e
./rust/.git/objects/16/fe87b06e802f094b3fbb0894b137bca2b16ef1
./rust/.git/objects/87/de60989266eab5cc95589ca2d92ad7a6d3bc8c
./rust/.git/objects/7e/2e9fd6ee74994b8978c0612ea06dc2e23b7ac6
./rust/.git/objects/10/afd1558d87ba2d4cab58b1aa8003abfc4183b6
./rust/.git/objects/5c/d413cc37b141a54cac08b5b46b810845db287a
./rust/.git/objects/09/14f1b532a4c33c0736d09da5b40324988b2b10
./rust/.git/objects/91/192c39ff7a17ce599d56bb386b6a54e91fc51e
./rust/.git/objects/62/bfc652d52f2d0696ea9361d16690a2d71c2441
./rust/.git/objects/96/b443c87b9fe3c0a53ff567e2b086aa61e0d730
./rust/.git/objects/06/36a117f26cfc8fb55db8ff2491ff060087b935
./rust/.git/objects/99/9326978bb10914ab7f1a25deb24b320a01deeb
./rust/.git/objects/0a/56e3fc5d8cbcd1fda80cafa819b3972e27e455
./rust/.git/objects/90/be1c7cd7d823329fdb8c33de46b1370dad8843
./rust/.git/objects/d4/f474e653a877cda610a7c1b9cce585c7a245a8
./rust/.git/objects/b1/1d4181198fa7129df853322f899225de31a3ab
./rust/.git/objects/aa/ba3dacb0e3d1673cf09658612a6768f8a6f03b
./rust/.git/objects/af/b10a183009146ab083fd78157fda896a33c64e
./rust/.git/objects/a8/c63b6053bd4be47142d89fbc30eeaffba71747
./rust/.git/objects/ef/8de3e1ab22cfe06597d9b87a71541a194055c6
./rust/.git/objects/e6/9282e381bc07152cc7598f21f3162e4bbb1f22
./rust/.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
./rust/.git/objects/f7/b6953c757742e077f77410fb82ae18715c9712
./rust/.git/objects/f7/f1533d40e1f4c295ec478cc6fbafa2ccfac5d7
./rust/.git/objects/fa/69300e5723165e2cff621efb266282114138f0
./rust/.git/objects/77/e28e74aa4ca27d2e28a505812bdc55b05cfc64
./rust/.git/objects/70/56d533c039d1f7739e3810ea3e563088399c5d
./rust/.git/objects/84/734e7d41d1936af04c7f7ced9f598583d84c34
./rust/.git/objects/4a/419f406c77f0de55ddfd8b718962a0e71d4410
./rust/.git/objects/25/87add766e467baf50862c795a82c718349aa2b
./rust/.git/HEAD
./rust/.git/info/exclude
./rust/.git/logs/HEAD
./rust/.git/logs/refs/heads/master
./rust/.git/logs/refs/remotes/origin/HEAD
./rust/.git/description
./rust/.git/hooks/commit-msg.sample
./rust/.git/hooks/pre-rebase.sample
./rust/.git/hooks/pre-commit.sample
./rust/.git/hooks/applypatch-msg.sample
./rust/.git/hooks/fsmonitor-watchman.sample
./rust/.git/hooks/pre-receive.sample
./rust/.git/hooks/prepare-commit-msg.sample
./rust/.git/hooks/post-update.sample
./rust/.git/hooks/pre-applypatch.sample
./rust/.git/hooks/pre-push.sample
./rust/.git/hooks/update.sample
./rust/.git/refs/heads/master
./rust/.git/refs/remotes/origin/HEAD
./rust/.git/index
./rust/.git/packed-refs
./rust/syntax/rust.vim
./rust/.travis.yml
./rust/compiler/cargo.vim
./rust/compiler/rustc.vim
./rust/LICENSE-MIT
./elm/indent/elm.vim
./elm/ftplugin/elm.vim
./elm/LICENSE
./elm/ftdetect/elm.vim
./elm/README.md
./elm/doc/elm-vim.txt
./elm/doc/tags
./elm/autoload/elm/io.vim
./elm/.git/config
./elm/.git/objects/pack/pack-91ae275cd15300b17441773c51e0de70d40299ee.pack
./elm/.git/objects/pack/pack-91ae275cd15300b17441773c51e0de70d40299ee.idx
./elm/.git/HEAD
./elm/.git/info/exclude
./elm/.git/logs/HEAD
./elm/.git/logs/refs/heads/master
./elm/.git/logs/refs/remotes/origin/HEAD
./elm/.git/description
./elm/.git/hooks/commit-msg.sample
./elm/.git/hooks/pre-rebase.sample
./elm/.git/hooks/pre-commit.sample
./elm/.git/hooks/applypatch-msg.sample
./elm/.git/hooks/prepare-commit-msg.sample
./elm/.git/hooks/post-update.sample
./elm/.git/hooks/pre-applypatch.sample
./elm/.git/hooks/pre-push.sample
./elm/.git/hooks/update.sample
./elm/.git/refs/heads/master
./elm/.git/refs/remotes/origin/HEAD
./elm/.git/index
./elm/.git/packed-refs
./elm/syntax/elm.vim
./sexp_mappings_for_regular_people.vim
./sexp.vim
./README.markdown
./surround.vim
./autoload/clojurecomplete.vim
./autoload/sexp.vim
./.git/ORIG_HEAD
./.git/config
./.git/objects/pack/pack-187a88017b0b4b80320453122bef3d8c49b437ff.pack
./.git/objects/pack/pack-e1cae023eb0b5c1cd4077d825f6e39f4503e840a.idx
./.git/objects/pack/pack-187a88017b0b4b80320453122bef3d8c49b437ff.idx
./.git/objects/pack/pack-b82e26e3bde859c755c4dff5e60baf124af7a42b.pack
./.git/objects/pack/pack-b82e26e3bde859c755c4dff5e60baf124af7a42b.idx
./.git/objects/pack/pack-e1cae023eb0b5c1cd4077d825f6e39f4503e840a.pack
./.git/HEAD
./.git/info/exclude
./.git/logs/HEAD
./.git/logs/refs/heads/master
./.git/logs/refs/remotes/origin/issue-77
./.git/logs/refs/remotes/origin/HEAD
./.git/logs/refs/remotes/origin/master
./.git/description
./.git/hooks/commit-msg.sample
./.git/hooks/pre-rebase.sample
./.git/hooks/pre-commit.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/fsmonitor-watchman.sample
./.git/hooks/pre-receive.sample
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/post-update.sample
./.git/hooks/pre-merge-commit.sample
./.git/hooks/pre-applypatch.sample
./.git/hooks/pre-push.sample
./.git/hooks/update.sample
./.git/refs/heads/master
./.git/refs/tags/vim-release-011
./.git/refs/remotes/origin/issue-77
./.git/refs/remotes/origin/HEAD
./.git/refs/remotes/origin/master
./.git/index
./.git/packed-refs
./.git/FETCH_HEAD
./LICENSE.txt
./syntax/clojure.vim
./clj/vim/test-runtime.vim
./clj/project.clj
./clj/test/vim_clojure_static/syntax_test.clj
./clj/test/vim_clojure_static/indent_test.clj
./clj/bin/syntime
./clj/dev-resources/test-inherit-indent.out
./clj/dev-resources/test-reader-conditional-indent.in
./clj/dev-resources/test-multibyte-indent.txt
./clj/dev-resources/test-dispatch-macro-indent.in
./clj/dev-resources/test-basic-sexp-indent.txt
./clj/dev-resources/test-reader-conditional-indent.out
./clj/dev-resources/test-side-effects-in-indentexpr.in
./clj/dev-resources/test-dispatch-macro-indent.out
./clj/dev-resources/test-inherit-indent.in
./clj/dev-resources/test-side-effects-in-indentexpr.out
./clj/.gitignore
./clj/src/vim_clojure_static/test.clj
./clj/src/vim_clojure_static/generate.clj
I did put them in directly. But looking now, it seems that I stuffed the moving for something. There’s at least one directory whose contents were moved rather than the directory
then in the .vim/pack/default/start
directory I ran:
git clone
git clone
git clone
git clone
I open a .clj file. Press o
to enter insert mode. Press (
. I get a (
character and nothing else
I personally wouldn't recommend vim classpath. But that's because I always start a repl anyway.
So in this case you've selected paredit.vim, which should be providing the pair matching functionality I think.
Well, now that I have one of them working… what I was seeing online was that sexp was better, due to a “repeat” issue?
They're different - both support s-expression level editing, but paredit tries to keep you in balance (parens wise 😉) while sexp doesn't AFAIK
BTW - I have colleagues that swear by parinfer
, but it's really not for me (keeps parens balanced by level of indentation)
Hey guys. I'm new to Clojure, trying to setup vim. So far I have it working with nREPL + conjure plugin. What other plugins would be essential to easily modify parens/edit text?
I would say that vim-sexp is better. They keep you balanced but in different ways. Vim-sexp gives you tools to modify sexpr in a way that keeps them balanced. Paredit overrides vim built ins to try and automatically keep things in balance. The paredit model is very emacsy, and the sexp model is very vimy. I'd say paredit is easier to start with, but sexp is more powerful long term.
Yeah was just reading up on it haha! Thanks
I might need to make the shift to vim-sexp, as I can’t get slurp or barf to work (I really wish there were better names for those)
leader and > (that is shift+.) - while standing on the parentheses
the <
or >
denote the direction the parentheses will move when you issue the command. So, they'll either slurp or barf - depends if you're on the opening parens or the closing one
:thumbsup:
to elaborate on vim-sexp: "paredit" tries to act like the emacs plugin of the same name, and offers the same operations, "vim-sexp" uses the vim native concept of "text objects" so that you can use the same thinking process editing a lisp as any other structured input in vim
On mobile, so tried to keep it short. But yeah, there's a whole blog post in comparing the approaches.
also, for anyone using vim but not thinking in terms of text-objects yet, I highly recommend spending a few hours on it, it was a massive level up in my vim usage
good rule of thumb, if you use h/j/k/l
for all your movement and backspace to make changes, text-objects could change your life
3. disable insert, replace, tabs, and visual modes or maybe that's -1
in all honesty I use all these things, but I rarely touch the arrow keys (I found it handy to bind the arrows to the vim-sexp "weird" operations)
paredit seems quite confusing, it's not letting me delete parens, or add/wrap new ones easily (my bad at not having read :h paredit but I thought it would be intuitive enough, guess not). I think I'll just disable it for now until I'm more familiar with clojure
another option that helps manage parentheses automatically based on indentation is parinfer-rust: https://github.com/eraserhd/parinfer-rust i strongly recommend using it if you're just getting started with clojure (and don't have any prior experience with editing code written in any flavor of lisp) 🙂
this website should give you a feel of how parinfer works: https://shaunlebron.github.io/parinfer/