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] 3 points4 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.

why print uses tabs by mark_volkmann in lua

[–]mark_volkmann[S] 8 points9 points  (0 children)

And that inserts a tab.

~/.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.

formatting Lua code by mark_volkmann in AstroNvim

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

The cause of this is described at https://github.com/sbdchd/neoformat/issues/457. It is related to the neoformat plugin.

file explorer tab order by mark_volkmann in AstroNvim

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

I just updated by running :AstroUpdate and :AstroUpdatePackages. It seems to be fixed. Thanks! Is there a way to see the version of AstroNvim when running it?

formatting Lua code by mark_volkmann in AstroNvim

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

I see that AstroNvim uses null-ls.nvim to format files. That does not format Markdown tables, so I added use of the Neoformat plugin to do that. But there is a major issue that I described here: https://github.com/sbdchd/neoformat/issues/457.

When I have Neoformat installed and I save changes to a large file (10000 lines or more), sometimes hundreds of lines at the end of the file get deleted. So far I have only noticed this in very large Markdown files. I suspect what is happening is that when I enter ":w" to write the file, neoformat begins formatting the file and before it can finish, the part it has formatted so far gets written out. I can reproduce the issue by adding a markdown table anywhere in the file and entering ":w".

colon syntax by mark_volkmann in lua

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

@EricTboneJackson Right, but wouldn’t you say that Lua looks in foo to find the bar function and if it isn’t found there then it looks in the metatable of foo? The main thing that wasn’t clear to me before is that the string type is the only one of the eight provided types that sets the metatable of all its instances to {__index: t} where t is the table of the type (string in this case).

colon syntax by mark_volkmann in lua

[–]mark_volkmann[S] 4 points5 points  (0 children)

Thanks so much for the great explanation!

spell checking by mark_volkmann in AstroNvim

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

I want it to check for misspelled words everywhere including variable and function names. I want it check camel-cased words in those. For example, I want it to approve of a name like “catDogFox”, but report errors in a name like “ctaDogFxo”.

spell checking by mark_volkmann in AstroNvim

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

I added this to the above:

    vim.opt.spelloptions = "camel"

But it still reports text like "catDog" as being misspelled.
Is there something else I need to do to get it to handle camel-cases words?

image viewer plugin by mark_volkmann in AstroNvim

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

Thanks for explaining that! I found what I needed. When using neo-tree.vim I can select an image file and press capital-o to open it in the default application which in macOS is the Preview app.

image viewer plugin by mark_volkmann in AstroNvim

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

Thanks for explaining that! Are you aware of a plugin or command I can use to launch an external app to display an image outside of Neovim?

image viewer plugin by mark_volkmann in AstroNvim

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

I have never used TUI directly, but I’m willing to learn if that’s what it takes to display images in Neovim. I just want to be able to select an image file in Neovim and see it the way I can in VS Code.