Vim instructions don't seem to work
Error executing vim.schedule lua callback: ~.vim/plugged/conjure/lua/conjure/buffer.lua:88: Vim(function):E746: Function name does not match script file name: cljstyle#fix
Maybe this is related to Conjure, I'll dig in a bit and try to find a way to make it work but just wanted to flag this.
I added the following to ~/.config/nvim/after/ftplugin/clojure.vim as described in the integrations doc.
" Add to file for vim or neovim:
" ~/.vim/after/ftplugin/clojure.vim
" ~/.config/nvim/after/ftplugin/clojure.vim
" NOTE: typically you'd set these to use a formatter, but in this case it fails
" since cljstyle usually can't run on partial forms.
"setlocal equalprg=cljstyle\ pipe
"setlocal formatprg=cljstyle\ pipe
" This can also go in autoload/cljstyle.vim
function cljstyle#fix()
let cwd = getcwd()
let winsave = winsaveview()
execute "cd" . expand('%:p:h')
:%!cljstyle pipe
execute "cd" . cwd
call winrestview(winsave)
endfunction
" Example shortcut to fix the current file
nnoremap <leader>cs :call cljstyle#fix()<cr>
I ended up getting this to work by adding it to ~/.config/nvim/autoload/cljstyle.vim. I found the instructions not super clear, would you be open for a PR improving them?
Ah, good to know - I use it in the autoload fashion, so maybe there's something special about the function hash name syntax? 🤔 Definitely open to a PR to clarify the instructions!
I think my suggested edit would be something similar to the below but maybe that's just because I don't really understand what any of the above is about 😅
Place the following in ~/.config/nvim/autoload/cljstyle.vim
function cljstyle#fix()
let cwd = getcwd()
let winsave = winsaveview()
execute "cd" . expand('%:p:h')
:%!cljstyle pipe
execute "cd" . cwd
call winrestview(winsave)
endfunction
" Example shortcut to fix the current file
nnoremap <leader>cs :call cljstyle#fix()<cr>
Huh, this does appear to be an issue with the hash-separated function name. https://neovim.io/doc/user/userfunc.html#autoload