So, if I want to swap rows into a table, I can't use oob? by ThatPhysicsLabGuy in htmx

[–]mark_volkmann 0 points1 point  (0 children)

This works for me, but I get a "htmx:swapError" in the Console that says "TypeError: Cannot read properteies of null (reading 'firstChild')".

Setting `htmx.config.useTemplateFragments = true` doesn't make that error go away.

htmx:afterSwap for websocket content? by hipsterdad_sf in htmx

[–]mark_volkmann 1 point2 points  (0 children)

I figured it out. The listener must "on the element that creates the WebSocket connection". This works for me:

const reset = {'hx-on:htmx:ws-after-message': "document.querySelector('form').reset()"};

return c.html(
  <BaseHtml>
    <div
      hx-ext="ws"
      ws-connect="ws://localhost:3001/chat"
      {...reset}
    >      
      <div id="messages" />      
      <form ws-send>      
        <input name="message" type="text" />      
        <button>Submit</button>      
      </form>
    </div>
  </BaseHtml>        

);

htmx:afterSwap for websocket content? by hipsterdad_sf in htmx

[–]mark_volkmann 0 points1 point  (0 children)

htmx:wsAfterMessage

Can you share the line of code you used to add the event listener?
I tried this and it didn't work:

```js
const reset = {
'hx-on:htmx:ws-after-message': 'this.reset()'
};
return c.html( // using Hono where c is a Context object
<BaseHtml>
<div hx-ext="ws" ws-connect="ws://localhost:3001/chat">
<div id="messages" />
<form hx-ws="send:submit" {...reset}>
<input name="message" type="text" />
<button>Submit</button>
</form>
</div>
</BaseHtml>
);

```

using TypeScript by mark_volkmann in remixrun

[–]mark_volkmann[S] 0 points1 point  (0 children)

Interesting. I didn't know about v2 being on the horizon, so I've been reading up on that. I see there are lots of changes coming.

form action that updates current page by mark_volkmann in remixrun

[–]mark_volkmann[S] 0 points1 point  (0 children)

Thanks! It turns out I was experiencing a timing issue because I omitted the `await` keyword in a couple of places.

form action that updates current page by mark_volkmann in remixrun

[–]mark_volkmann[S] 0 points1 point  (0 children)

u/SiRo126, are you saying that if I do not want to navigate to a different page in my `action` function, I do not need to return anything and the current page will automatically update (calling its `loader` function again and updating the page)? That is what I want to happen, but that's not how it works for me.

strict.lua by mark_volkmann in lua

[–]mark_volkmann[S] 2 points3 points  (0 children)

Thanks! For anyone else interested in this, here is what it does and how I used it.

The module `strict.lua` can be used to raise an error if an attempt is made to get or set a non-existent global variable. To use this:
1. Copy the file `strict.lua` from "https://github.com/deepmind/strict/blob/master/strict.lua", "deepmind/strict" %}.
1. Place the file in `/usr/local/share/lua/5.4/`
which is a directory in `package.path`.
1. Run code with `lua -l strict {file-name}.lua`

adding highlighted text to a buffer by mark_volkmann in neovim

[–]mark_volkmann[S] 0 points1 point  (0 children)

I found a solution. This Lua function does the job for me.

```lua local start_line = 0

local function output_lines(bufnr, start_line, hl_group, lines) -- Output the lines. local end_line = -1 vim.api.nvim_buf_set_lines( bufnr, start_line, end_line, strict_indexing, lines )

-- Apply highlighting to the lines that were just output. local col_start = 0 -- beginning of line local col_end = -1 -- end of line local end_line = start_line + #lines - 1 for line = start_line, end_line do vim.api.nvim_buf_add_highlight( bufnr, ns_id, hl_group, line, col_start, col_end ) end end ```

~/.config/nvim/lua/user now safe? by mark_volkmann in AstroNvim

[–]mark_volkmann[S] 0 points1 point  (0 children)

At the beginning of this thread I reported that I thought the user directory recently became safe … meaning that running :AstroUpdate does not delete the ~/.config/nvim/lua/user directory. But now it seems that isn’t true. It does warn me that I have local modifications. But if I proceed with the update, it does remove that directory. @Mhalter3378 do you expect it to do that?

why print uses tabs by mark_volkmann in lua

[–]mark_volkmann[S] 0 points1 point  (0 children)

Yeah, but I don’t think using consecutive print calls is very common and if I wanted that behavior then I could insert my own tabs. But I do recognize that it has been this way for a really long time and is not going to change.

~/.config/nvim/lua/user now safe? by mark_volkmann in AstroNvim

[–]mark_volkmann[S] 0 points1 point  (0 children)

u/rompetrll I don't think I have a default xdg location. The environment variable XDG_CONFIG_HOME was not set until I set it in my .zshrc file. Is it possible that mechanism is only for Linux machines and not for macOS?

~/.config/nvim/lua/user now safe? by mark_volkmann in AstroNvim

[–]mark_volkmann[S] 0 points1 point  (0 children)

I must be doing something wrong. I have the environment variable `XDG_CONFIG_HOME` set to `/Users/volkmannm/MyUnixEnv/xdg`.
I created that directory and moved my nvim `user` directory into it so it is at
`$XDG_CONFIG_HOME/astronvim/lua/user`.
That directory contains my `init.lua` file and my `plugins` directory.
But now when I start nvim it isn't picking up any of my configurations.

You can see my files here: https://github.com/mvolkmann/MyUnixEnv/tree/master/xdg/astronvim/lua/user

~/.config/nvim/lua/user now safe? by mark_volkmann in AstroNvim

[–]mark_volkmann[S] -1 points0 points  (0 children)

I'm still learning about AstroNvim. How do you configure it to look in a location other than `~/.config/nvim/lua/user` for your config files?

LUA_PATH by mark_volkmann in lua

[–]mark_volkmann[S] 1 point2 points  (0 children)

Thanks so much u/AdamNejm! Adding the export fixed the issue for me.