Fork me on GitHub
#vim
<
2020-06-30
>
quoll16:06:13

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?

noisesmith16:06:04

try adding vim-clojure-static - that should make clojure hook in to use the lisp / sexp oriented plugins

noisesmith16:06:36

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

quoll16:06:46

Hmmm… is there some way I can check if any of these loaded

quoll16:06:55

The runtimepath value is picking up all the subdirectories under ~/.vim/bundle so I figure that pathogen is working

quoll17:06:26

and I see that omnifunc is set to clojurecomplete#Complete, so it looks like something that does Clojure stuff came in

quoll17:06:16

But I load a .clj file and open a paren, and nothing happens. :set lisp did not change anything

noisesmith17:06:18

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

noisesmith17:06:50

do you just have this issue with clojure files? are any other plugins loaded?

quoll17:06:46

I also have elm.vim and rust.vim

quoll17:06:26

everything else is clojure stuff (which have only been added in the last 20 minutes)

quoll17:06:45

I suppose I need to read a book on vim

noisesmith17:06:52

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

quoll17:06:02

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

noisesmith17:06:46

for the basic sanity check, you've restarted vim since adding the plugins right?

quoll17:06:41

Is there any way to see if something from the plugins has been loaded?

noisesmith17:06:08

you'll need to check the docs for pathogen for that

noisesmith17:06:52

oh - s/`:he pack`/`:he packages` - that's the better doc node for the built in directory based plugin package installation

noisesmith17:06:15

there's also debug-mode vim -D ... but I haven't used it, just read about it

quoll17:06:17

OK… so I want to move everything into start directories under pack

noisesmith17:06:43

that's what I'd recommend yeah, it accepts the same plugins that pathogen uses

quoll17:06:02

OK. I’ll see what this does

noisesmith17:06:30

not just pack/start pack/foo/start - I just use pack/default/start but the middle dir helps you keep things more organized

quoll17:06:46

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

noisesmith17:06:02

fair enough!

quoll17:06:05

yup, I saw the suggested structure

noisesmith17:06:33

I just tried vim -D for the first time - works with vim but not nvim it seems

quoll17:06:35

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

quoll17:06:41

still no paredit though

noisesmith17:06:51

lispwords comes with vim

quoll17:06:13

Oh, so vim knows Clojure?

noisesmith17:06:13

it gets set locally by vim-clojure-static with clojure apropriate words though

noisesmith17:06:33

no, vim has an abstract concept of "a lisp" and how to behave differently with lisps

quoll17:06:40

I’m seeing Clojure specific words in there

noisesmith17:06:48

oh, then that's a good sign

quoll17:06:53

`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`

noisesmith17:06:06

perhaps you need to run the command that actually turns on vim-sexp (though I see nothing like that in my own config...)

noisesmith17:06:55

perhaps vim does come with a clojure filetype nowadays - you could check by starting with no config file

noisesmith17:06:04

vim -u NONE to skip init and plugins, vim -u NORC to get plugins but no vimrc

quoll17:06:33

Well, I’m losing syntax highlighting

noisesmith17:06:35

there's also the fact that vim and nvim put plugins and config in different places

noisesmith17:06:47

:syntax on fixes that

quoll17:06:37

OK… but it’s a different color scheme 🙂

noisesmith17:06:22

:colorscheme ...

noisesmith17:06:40

anyway, removing telling it to skip config files / plugins is a good way to get a baseline

quoll17:06:13

It looks like packages are being loaded just fine. The issue is that neither paredit nor sexp do anything

noisesmith17:06:43

are you using vim-clojure-static ?

quoll17:06:57

I wasn’t, but then I added it

quoll17:06:37

is it better to have it?

noisesmith17:06:48

not sure, I always use it

quoll17:06:30

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 🙂

nirrub17:06:29

What doesn't work for you?

quoll17:06:21

If I type ( then I don’t get a corresponding closing paren

nirrub17:06:35

Do you have paredit installed or just sexp?

noisesmith17:06:55

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

quoll17:06:31

I tried paredit, but because it didn’t do that, I switched to sexp

nirrub17:06:45

Does vim "recognize" the filetype as clojure?

nirrub17:06:56

What happens when you ":set ft=clojure"

noisesmith17:06:57

unless I'm reading that wrong, clojure-static and sexp are my only clojure specific plugins

quoll17:06:15

when I say :set ft it writes:

filetype=clojure

nirrub17:06:46

So it recognizes the ft, but the plugins don't work? Does any other plugin not related to clojure work?

quoll17:06:44

I’ve only used plugins for syntax highlighting, so outside of that, I don’t know

noisesmith17:06:11

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)

noisesmith17:06:31

if that fails to insert () or errors that sexp_insert_opening_round doesn't exist, sexp wasn't loaded

quoll17:06:47

OK… neither of these happened

quoll17:06:59

I entered it, with no problems

noisesmith17:06:13

that's thanks to <silent> I bet, but yeah I think that proves it wasn't loaded

quoll17:06:02

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>

noisesmith17:06:38

that gets mapped by default in clojure files

nirrub17:06:47

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?

noisesmith17:06:24

@nirrub I already suggested moving to the built in vim plugin management...

noisesmith17:06:50

I don't see why one would use a third party package for that these days

nirrub18:06:18

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)

noisesmith18:06:23

👍 - that's a fair argument, we are discussing similar in this thread https://clojurians.slack.com/archives/C0DF8R51A/p1593539395294400

dave21:06:34

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

dave21:06:04

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

noisesmith21:06:28

by updating do you mean it is looking for newer versions?

dave22:06:17

yeah, basically doing a git pull in the repo for each plugin

noisesmith22:06:54

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)

dave22:06:43

that's fair

dave22:06:03

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

dave22:06:50

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

dave22:06:10

vs. waiting months/years and then updating and facing potentially lots of big breaking changes

dave22:06:42

i can definitely understand the "never update" philosophy that a lot of people have though

dave22:06:35

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?

noisesmith22:06:54

mind you, for things I deploy at work, we have strict security rules and enforced updates based on CVEs

noisesmith22:06:03

but that doesn't really effect my local dev stack so much

dominicm17:06:55

Vim-clojure-static shouldn't be necessary. It's included with vim. It sounds like vim-sexp isn't loaded @quoll

noisesmith17:06:34

TIL - I guess I did set up my config a very long time ago

dominicm17:06:04

So. You can get a newer version by going direct. Keep it

dominicm17:06:14

But minimization is better right

noisesmith17:06:46

indeed - precisely why I suggested switching to the built in packaging instead of figuring out how to debug pathogen LOL

dominicm17:06:41

Always good to just operate at the rtp right.

dominicm17:06:57

I suspect that an entry was added for individual files instead of the whole repo

dominicm17:06:46

@noisesmith so, totally separate conversation, dein is faster than the package functionality

noisesmith18:06:08

yeah - I try to obey occam's razor with my setup, and always considered third package management an unneeded entity :D

noisesmith18:06:28

but I'll consider that if my startup time gets painful

dominicm17:06:27

I don't think now is the time to be guessing about package managers

dominicm17:06:48

@quoll how are you using pathogen?

quoll17:06:11

@noisesmith got me to change to pack

dominicm17:06:51

😂 ok. How did you set that up?

nirrub17:06:52

And do you use vim version 8 that actually has it?

dominicm17:06:12

Vim 7 has it too... It's many years old.

dominicm17:06:19

Anyway, doesn't matter :)

quoll17:06:42

I created ~/.vim/pack/default/start, and started putting everything in there

quoll17:06:58

I’m currently on Vim 8.1.2292

dominicm17:06:17

@quoll how did you put it there

quoll17:06:16

Also, I removed the infect line in my .vimrc

dominicm17:06:47

@quoll could you do find in that folder? I want to double check what you've got exactly.

quoll17:06:33

I’ve put some vim files in directly. For some things I’ve done a git clone. So it’s messy

quoll17:06:38

$ 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

dominicm18:06:34

I think something has gone wrong here. surround.vim should be in a plugin directory

quoll18:06:04

OK. I’ll clear it out and git clone them all from scratch

dominicm18:06:16

If that's not a problem, that'd be good I think

dominicm18:06:30

Each plugin should end up with its own directory

quoll18:06:40

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

quoll18:06:51

It wasn’t like that under pathogen

dominicm18:06:16

Let us know if that works. I appreciate you taking time doing that again.

dominicm17:06:07

Probably worth running echo &rtp after startup

quoll18:06:10

OK. I blew everything away. Copied back in my elm and rust directories

quoll18:06:18

then in the .vim/pack/default/start directory I ran:

git clone 
git clone 
git clone 
git clone 

dominicm18:06:32

How's it looking?

quoll18:06:42

Starting vim now takes about 5 seconds

quoll18:06:23

I open a .clj file. Press o to enter insert mode. Press (. I get a ( character and nothing else

dominicm18:06:41

That is vim-classpath. The good news is that your plugins are loading I guess.

dominicm18:06:13

I personally wouldn't recommend vim classpath. But that's because I always start a repl anyway.

quoll18:06:23

Happy to remove it 🙂

quoll18:06:10

shifted it out. It starts quickly now

dominicm18:06:16

So in this case you've selected paredit.vim, which should be providing the pair matching functionality I think.

nirrub18:06:29

It does provide it

dominicm18:06:19

@quoll does :help paredit work?

quoll18:06:27

ah. I have it now!

dominicm18:06:49

I'm glad it's working.

quoll18:06:25

Well, now that I have one of them working… what I was seeing online was that sexp was better, due to a “repeat” issue?

quoll18:06:58

And thank you

nirrub18:06:15

They're different - both support s-expression level editing, but paredit tries to keep you in balance (parens wise 😉) while sexp doesn't AFAIK

nirrub18:06:18

BTW - I have colleagues that swear by parinfer, but it's really not for me (keeps parens balanced by level of indentation)

quoll18:06:40

Ah, OK. Thank you

mitesh18:06:09

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?

dominicm18:06:19

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.

dominicm18:06:41

^ @mitesh applies to you too :)

mitesh18:06:01

Yeah was just reading up on it haha! Thanks

olical18:06:18

+1 for vim-sexp

quoll18:06:06

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)

nirrub18:06:32

leader and > (that is shift+.) - while standing on the parentheses

quoll18:06:19

and leader is \ by default, right?

nirrub18:06:48

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

quoll18:06:48

apparently not. But, I just added:

let mapleader="\\"
to my ~/.vimrc and now it works

quoll18:06:10

No idea what the leader was when I wasn’t setting it. I couldn’t figure it out

olical18:06:37

Also vim-sexp-mappings-for-regular-people or whatever it's called

noisesmith18:06:04

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

dominicm18:06:59

On mobile, so tried to keep it short. But yeah, there's a whole blog post in comparing the approaches.

noisesmith18:06:34

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

noisesmith18:06:11

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

nate18:06:32

vim learning levels: 1. disable arrow keys 2. disable hjkl

noisesmith20:06:39

3. disable insert, replace, tabs, and visual modes or maybe that's -1

nate20:06:29

oh man, that's pretty far

nate20:06:38

I haven't even gone to level 2 yet

noisesmith20:06:31

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)

nate20:06:40

oh interesting

quoll18:06:50

Huh. I got a bit confused for a while there. There is no default leader on the mac

mitesh20:06:41

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

abdusalam01:07:37

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) 🙂

abdusalam01:07:26

this website should give you a feel of how parinfer works: https://shaunlebron.github.io/parinfer/

snoe15:07:08

vim-sexp is a less restrictive paredit too