Fork me on GitHub
#vim
<
2023-04-21
>
practicalli-johnny06:04:28

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

lispyclouds07:04:13

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.

lispyclouds07:04:49

maybe if you checkin the compiled lua as well?

practicalli-johnny07:04:47

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

lispyclouds07:04:50

i forked it and it seems to load it fine

lispyclouds07:04:36

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

lispyclouds07:04:34

all the examples i see are users, not orgs

practicalli-johnny18:04:46

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

practicalli-johnny09:04:28

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

emilaasa13:04:51

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-johnny17:04:38

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

Leaf Garland19:04:53

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

grazfather21:04:13

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

grazfather21:04:20

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

grazfather21:04:34

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

Proctor13:04:15

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

Proctor13:04:12

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

emilaasa13:04:29

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

Proctor13:04:35

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

emilaasa13:04:06

I got tricked by the treesitter highlighter a bit:

emilaasa13:04:16

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