vim

For discussion on all things (neo)vim.
nmkip 2021-06-02T13:19:00.038800Z

Hi! I'm looking for a nvim plugin to manage sexps. I tried https://github.com/vim-scripts/paredit.vim it's super useful but I found a problem (not sure if I'm using it wrong or if it's a bug) When I delete until the end of line inside of a string inside of a vector I end up with unbalanced brackets.

[:p "If I press D here | paredit will do this"] -> [:p "If I press D here"
Are you using another plugin? I'm new to nvim plugins so any other useful plugins are welcomed.

dharrigan 2021-06-02T13:22:57.039200Z

I use parinfer-rust myself

βž• 1
dharrigan 2021-06-02T13:23:34.040100Z

that along with Plug 'guns/vim-sexp', {'for': 'clojure'} and Plug 'tpope/vim-sexp-mappings-for-regular-people', {'for': 'clojure'}

βž• 1
dharrigan 2021-06-02T13:23:59.040500Z

Hey Dave, stop copying me πŸ˜›

πŸ™ƒ 2
nmkip 2021-06-02T13:24:10.040800Z

Can I copy you?

dharrigan 2021-06-02T13:24:16.041100Z

oh, okay then πŸ˜„

nmkip 2021-06-02T13:24:16.041200Z

πŸ˜›

dharrigan 2021-06-02T13:25:47.042800Z

My vimrc in all it's magnificant glory(*) can be found here: <https://github.com/dharrigan/vimconfig>

πŸ‘ 1
dharrigan 2021-06-02T13:25:54.043100Z

(*) == or maybe not πŸ™‚

nmkip 2021-06-02T13:26:22.043700Z

I'll read the docs, try it and might come later with questions πŸ˜„ I'm trying to use vscode + vscode-neovim

dharrigan 2021-06-02T13:26:43.044100Z

oh, no guarantees then. I have never used vscode with neovim

nmkip 2021-06-02T13:26:56.044500Z

Me neither πŸ˜›

dharrigan 2021-06-02T13:27:06.045Z

I think vscode + calva (the clojure plugin) does the balancing

dharrigan 2021-06-02T13:27:11.045200Z

have you tried calva?

nmkip 2021-06-02T13:27:45.045600Z

Calva's paredit and vim don't get along well

nmkip 2021-06-02T13:27:57.045900Z

you can mess everything up in normal mode

nmkip 2021-06-02T13:29:02.047Z

I usually use emacs with evil and my parens are under control there πŸ˜„

NoahTheDuke 2021-06-02T13:47:11.048700Z

if you ever have unbalanced parens but your plugins won’t let you input them (this happens to me sometimes with vim-sexp and vim-sexp-mappings), CTRL-V in insert mode will β€œforce” input of the character without triggering/respecting mappings

NoahTheDuke 2021-06-02T13:47:33.049100Z

:help i_CTRL-V: The characters typed right after CTRL-V are not considered for mapping.

πŸ‘€ 2
dave 2021-06-02T14:15:09.050800Z

Good to know! Another little trick I use in a situation like that is to go to another instance of the character I want to insert but can't (e.g. a close paren), go into visual mode to copy it (`vy`), and the paste it wherever I want it to go with p.

NoahTheDuke 2021-06-02T14:17:46.051600Z

yeah that’s another good method, especially if you need to paste multiple parens

dharrigan 2021-06-02T14:39:29.052400Z

If ever I find myself in that situation (which is rarer now since I've got used to how parinfer-rust works), I just exit, load up vi, without any plugins, do a bit of editing, save and open again in vim πŸ™‚

πŸ˜‚ 1
NoahTheDuke 2021-06-02T14:40:05.052700Z

love that solution, lol

defndaines 2021-06-02T14:41:17.053300Z

Other strategies I’ve used for a quick fix.

defndaines 2021-06-02T14:41:29.053900Z

; ) then delete the ;

NoahTheDuke 2021-06-02T14:41:40.054200Z

g/vim -u NONE will load vim with no plugins

1
1
NoahTheDuke 2021-06-02T14:41:45.054500Z

oh that’s a good one too

defndaines 2021-06-02T14:41:47.054700Z

Or ")" then remove the quotes.

dharrigan 2021-06-02T14:46:27.055100Z

I think it's been well over 1 year since I had to do my trick

dharrigan 2021-06-02T14:46:44.055500Z

once you get into the flow of how parinfer-rust, etc., work, then you sorta just forget about the parens etc..

dharrigan 2021-06-02T14:46:51.055700Z

it just works(tm)

walterl 2021-06-02T14:56:23.057200Z

You've all effectively demonstrated why paredit can't really guarantee balanced parens 😜

πŸ˜‚ 2
πŸ˜† 1
NoahTheDuke 2021-06-02T14:57:16.058Z

lol if you count just adding as many parens as necessary to the last line of a file, it def can πŸ₯΄

grazfather 2021-06-02T14:57:35.058400Z

haha I would yank 1 char from another closing paren and paste it

πŸ’― 1
2021-06-02T15:06:17.060400Z

while we are talking about balanced parens... what is the best choice these days for auto-closing parenthesis/braces/strings? I've tried a couple recently, and they are broken in different but pretty bad ways : (

dave 2021-06-02T15:42:20.060900Z

https://github.com/jiangmiao/auto-pairs has served me well. I haven't looked into any of the alternatives, though.

βž• 1
NoahTheDuke 2021-06-02T16:19:24.061500Z

i somehow have autopairs but have no idea what makes them happen lmao

dave 2021-06-02T16:25:44.061900Z

I just realized that I have autopairs disabled for Clojure and other Lisps:

augroup autopairs_config
  " disable auto-pairs for lisp -- it interferes with parinfer
  autocmd Filetype lisp,scheme,clojure,lfe let b:AutoPairs = {}
augroup END

dave 2021-06-02T16:25:51.062200Z

Which makes sense, because Parinfer does this for you.

dave 2021-06-02T16:26:09.062700Z

autopairs works great for other languages, though!

nbardiuk 2021-06-02T16:29:48.063300Z

vim-sexp comes with insert mapping to autoclose parens https://github.com/guns/vim-sexp/blob/master/README.markdown#insert-mode-mappings-insert

πŸ‘ 1
1
2021-06-02T18:48:12.063700Z

surely it's easier to type in 8 a Ctrl-V )

NoahTheDuke 2021-06-02T18:50:14.064300Z

Idk how to count, I gotta go one at a time

2021-06-02T18:56:10.064500Z

oh, you mean a Ctrl-V ) followed by . until you are done? πŸ˜„

NoahTheDuke 2021-06-02T19:02:01.065400Z

Haha yeah, or v y followed by p until I’m done

emilaasa 2021-06-02T19:08:26.065600Z

:ParinferOff is another possibility πŸ™‚

walterl 2021-06-02T19:37:06.066500Z

I use AutoPairs and not parinfer, but had to tweak it a bit for Clojure:

" Don't automatically insert closing ' or `
let b:AutoPairs = {'(':')', '[':']', '{':'}','"':'"'}

2021-06-02T20:18:34.067500Z

hm, auto-pairs was the last one I had enabled, and I can't remember why exactly, but I removed it. Will give it a spin again, thanks!