Fork me on GitHub
#vim
<
2019-11-05
>
martinklepsch14:11:24

Very cool! It even has a Clojure API!

martinklepsch14:11:00

I’ve been looking for a way to fold the current top level form for a while and the recent cpaF made me realize that I can just do zfaF to fold the top level form. I now tried to make a mapping for this: noremap <Leader>f zfaF but it doesn’t work — what am I missing?

tmt14:11:09

nmap works, i think its because the F object isn't native to vim because it comes from sexp. nnoremap ignores the new mappings so it ignores the aF instruction at the end

👌 4
tmt14:11:17

thats a neat idea btw, i'll definitely use that

martinklepsch15:11:03

sweet, that works! Anyone suggestions on how I could turn <Leader>f into a toggle instead of having to use zo to open folds?

dave15:11:02

there is a variant of the fold operation that toggles. i think it's zi

dave15:11:19

so i think ziaF might work

tmt15:11:13

za toggles, but it doesn't create a fold

tmt15:11:58

you could just use <leader>f to create the fold and then just use za and the other fold commands to manage them

martinklepsch16:11:02

I could do that…. but think about the mental load of multiple keybindings for something that could be achieved by a single one! 😄

dave16:11:42

is fold creation idempotent? if so, it could be one keybinding

dave16:11:10

a keybinding that creates the fold (which is hopefully a no-op if the fold already exists) and then toggles it