Configs can also be submitted to NeovimCraft via a pull request. I found NeovimCraft very useful when learning about Neovim packages and community configurations https://github.com/neurosnap/neovimcraft#want-to-submit-a-config
Hm, I want to create a normal mode bind to my trim whitespace binding, but I don't know how to wrangle it in lua:
(nvim.set_keymap :n "<leader>tw" ":%s/\s\+$//e<CR>" {})
; unknown:1:50 Parse error: Invalid string: ":%s/\s\+$//e<CR>"
Working vimscript version:
nnoremap <leader>tw :%s/\s\+$//eI am going to give this plugin a try for trimming whitespace, maybe it is of interest https://github.com/kaplanz/nvim-retrail
When converting viml to Lua, sometimes it's easier to keep the viml - especially so for mappings.
vim.cmd[[ nnoremap <leader>tw :%s/\s\+$//e ]]
I have "<cmd>%s/\\s\\+$//<CR><C-o>" to wipe out trailing whitespace
you need the double backslash because otherwise lua takes the \s as a special character, when you want to pass a backslash and an s. for the backslash you simply do \\.
til keeppatterns, from that plugin. So my binding is now "<cmd>keeppatterns %s/\\s\\+$//<CR><C-o>"
likely need to escape the slashes in the string… e.g .`\` => \\, and maybe even some of the forward slashes
that looks like Fennel, so eval the string you are binding to to see what the string value is
Thanks for replying! 🙂 Yeah I only needed to escape the backslashes and now it works!
That looks to be it. I just got to a neovim session to test it out:
; --------------------------------------------------------------------------------
; eval (current-form): (print ":%s/\\s\\+$//e<CR>")
; (out) :%s/\s\+$//e<CR>
nil
; --------------------------------------------------------------------------------
; eval (root-form): (print ":%s/\s\+$//e<CR>")
; unknown:1:24 Parse error: Invalid string: ":%s/\s\+$//e<CR>"
;
I got tricked by the treesitter highlighter a bit:
They were red before and red after, I got confused 😄
https://dotfyle.com/ seems like a useful tool to help find examples of Neovim configurations. For example, Searching for a plugin shows shared configs that contain that plugin https://dotfyle.com/plugins/Olical/conjure Although if your Neovim dotfile is in a GitHub org, e.g. https://github.com/practicalli/neovim-config-redux , then there doesn't seem to be a way to add it
just added mine: https://dotfyle.com/lispyclouds/dotfiles-nvim maybe it can't handle fennel? mine was in a subdir and still it could config and guess things correctly.
maybe if you checkin the compiled lua as well?
It finds other fennel configs that are in my user account, but nothing from the Practicalli org I've also seen other fennel configs already on there
i forked it and it seems to load it fine
yeah looks like it needs to request org level scope to read things which it probably doesnt have
all the examples i see are users, not orgs
I raised an issue about orgs, but the maintainer is not planning on adding this feature. I'll stick with NeovimCraft for now.