vim

practicalli-johnny 2023-04-21T09:44:28.634729Z

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

emilaasa 2023-04-21T13:06:51.627119Z

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\+$//e

practicalli-johnny 2023-04-21T17:57:38.481439Z

I am going to give this plugin a try for trimming whitespace, maybe it is of interest https://github.com/kaplanz/nvim-retrail

Leaf Garland 2023-04-21T19:06:53.491879Z

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

grazfather 2023-04-25T21:09:13.071729Z

I have "<cmd>%s/\\s\\+$//<CR><C-o>" to wipe out trailing whitespace

grazfather 2023-04-25T21:10:20.673119Z

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 \\.

grazfather 2023-04-25T21:12:34.758079Z

til keeppatterns, from that plugin. So my binding is now "<cmd>keeppatterns %s/\\s\\+$//<CR><C-o>"

2023-04-21T13:08:15.471719Z

likely need to escape the slashes in the string… e.g .`\` => \\, and maybe even some of the forward slashes

2023-04-21T13:09:12.214259Z

that looks like Fennel, so eval the string you are binding to to see what the string value is

emilaasa 2023-04-21T13:13:29.588539Z

Thanks for replying! 🙂 Yeah I only needed to escape the backslashes and now it works!

2023-04-21T13:13:35.690669Z

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>"
; 

emilaasa 2023-04-21T13:14:06.456959Z

I got tricked by the treesitter highlighter a bit:

emilaasa 2023-04-21T13:14:16.101479Z

They were red before and red after, I got confused 😄

practicalli-johnny 2023-04-21T06:59:28.657999Z

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

lispyclouds 2023-04-21T07:10:13.522979Z

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.

lispyclouds 2023-04-21T07:10:49.757019Z

maybe if you checkin the compiled lua as well?

practicalli-johnny 2023-04-21T07:11:47.087319Z

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

lispyclouds 2023-04-21T07:16:50.226159Z

i forked it and it seems to load it fine

lispyclouds 2023-04-21T07:18:01.713319Z

https://dotfyle.com/lispyclouds/neovim-config-redux

lispyclouds 2023-04-21T07:23:36.920679Z

yeah looks like it needs to request org level scope to read things which it probably doesnt have

lispyclouds 2023-04-21T07:24:34.808049Z

all the examples i see are users, not orgs

practicalli-johnny 2023-04-21T18:06:46.856509Z

I raised an issue about orgs, but the maintainer is not planning on adding this feature. I'll stick with NeovimCraft for now.