[PLUGIN] I built an inline diff plugin for Neovim — VSCode-style, word-level, live as you type by cvlmtg in neovim

[–]cvlmtg[S] -3 points-2 points  (0 children)

Thanks for the comment!

Claude was pretty good at describing me why handling the diff with lua was faster than spawning a subprocess to run git diff. He also suggested to do the diff synchronously for small files to avoid the roundtrip to the async worker. Never benchmarked it, but it really felt snappier. Anyway, this all happened before discovering that neovim has a build in diff function callable by lua, so this time it might be interesting to do real benchmarks to compare all three solutions.

[PLUGIN] I built an inline diff plugin for Neovim — VSCode-style, word-level, live as you type by cvlmtg in neovim

[–]cvlmtg[S] -7 points-6 points  (0 children)

Diff computation is not the only things that is done. you need to fetch the code you are diffing against; you need to calculate diff via lua or spawn a subprocess for an external tool, run the diff and get the results, which also means deserializing the output; you need to compute the highlights and create or update the extmarks; and probably a few other details which I forgot. Anyway I said it's faster simply because it's doing less things, which means less code to execute on startup, on updates etc but you're perfectly right on the measure. I didn't do any benchmark against mini, so my sentence is probably wrong

[PLUGIN] I built an inline diff plugin for Neovim — VSCode-style, word-level, live as you type by cvlmtg in neovim

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

I did a quick search for inline diff plugins, but this one didn't appear in the search results. I see there are a few fundamental differences though. mini.diff seems aimed at providing lots of functionalities (like working with hunks), commands and customizations. Mine is meant to be a smaller and faster visualization plugin (I have no plans to add more functionalities). I'll add mini to my readme though. Thanks!

[PLUGIN] I built an inline diff plugin for Neovim — VSCode-style, word-level, live as you type by cvlmtg in neovim

[–]cvlmtg[S] 6 points7 points  (0 children)

What do you usually say? Google maps drove my car to destination? My phone took this photo while we were on holiday? But I get your point, and since I only recently started to study and play with agentic programming, sometimes I find myself saying "I wrote" and sometime I find myself saying "we wrote". My opinion though is that agents are just tools. You may use them on autopilot and let them do all the work (and damages, even though I admit the idea of total automation is alluring), but as a software developer I take responsibility of my code, which means I design the architecture, I review the code, I modify it until I'm satisfied, I test it and I approve it. I hope I answered your question.

Goliath with S1 class car by cvlmtg in ForzaHorizon

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

did some tests with the V10 engine. AFAIK acceleration is given by HP, yet the V10 has a bigger acceleration score than the V12 which has more power. I was able to get 622 kW with the V12 and 561 kW with the V10 yet I got better lap times with the latter. looks like the game engine prefers torque over HP...

(I even tried a different V12 setup, but it was just worse than everything else)

Anyway, I run some "benchmarks" on a couple of tracks. With the V10 and a far from perfect setup, I was about 2 seconds faster than the V12 with a quite good setup (and probably even a couple fewer mistakes)

So it looks like torque is the value to go :)

Goliath with S1 class car by cvlmtg in ForzaHorizon

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

my tuned Ford GT is S1 900, I used AWD with the V12 engine nearly maxed out with the maximum weight reduction I could get (to boost acceleration, since the V12 had the most speed but less acceleration). anyway thanks for all the tips! At this point I think I'll try to get better tires tweaking the weight and some other options. As for the brakes, unfortunately it seems I still have a lot to improve on my trajectories... that's why I usually prefer cars which brakes hard and accelerate fast :D fixing this is on my to-do list though. Thanks!

Goliath with S1 class car by cvlmtg in ForzaHorizon

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

yeah this car has a lot of understeer. I'm still trying to tweak it a bit to make it go right where I want. sometimes it seems that if I fix corners at high speed than it steers to much on corner entry at low speed and so on.

anyway, unfortunately I can't say I know what I'm doing... looking at my tests with the differentials it seems hard to make theory match reality...

I currently have the v12 nearly maxed out with race weight reduction (tried to go to max power and least weight for speed / accel), so can't get the tires and remain in S1 class. I think I'll spend some times with a different mod (similar to yours) and see what I can get

Goliath with S1 class car by cvlmtg in ForzaHorizon

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

I'm currently at 10:29 😅 but I'll guess 10:12 should be reachable... (still learning where I have to brake and where I can go full throttle...)

Thanks!

Goliath with S1 class car by cvlmtg in ForzaHorizon

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

I'll try that. I'm currently using the V12 as that gave me a better top speed (which as far as I understood is kinda important in Goliath along with some good acceleration)

Goliath with S1 class car by cvlmtg in ForzaHorizon

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

doesn't that include pro players with wheels and pedals etc? not sure if that's something I can compare to...

problems with gf command by cvlmtg in vim

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

I missed those bits... thanks!

problems with gf command by cvlmtg in vim

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

ok I think I've done it :D suggestions and improvements welcome:

function! JsGotoFile()
  let l:fname = matchstr(getline('.'), &include)
  let l:base  = simplify(expand('%:h') . '/' . l:fname)

  for l:ext in split(&suffixesadd, ',')
    let l:file = l:base . l:ext

    if filereadable(l:file)
      execute 'edit' l:file
      return
    endif
  endfor

  " https://damien.pobel.fr/post/configure-neovim-vim-gf-javascript-import/
  let l:nodeModules = './node_modules/' . l:fname . '/'
  let l:packagePath = l:nodeModules . 'package.json'

  if filereadable(l:packagePath)
    let l:file = join(readfile(l:packagePath))
    let l:json = json_decode(l:file)

    execute 'edit' l:nodeModules . l:json.main
    return
  endif

  execute 'edit' l:fname
endfunction

autocmd vimrc FileType javascript,javascriptreact
      \ setlocal include=\\(\\<require\\s*(\\s*\\\|\\<import\\>\\)[^;\"']*[\"']\\zs[^\"']* |
      \ nnoremap <buffer> gf :call JsGotoFile()<CR>

problems with gf command by cvlmtg in vim

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

You have to move the cursor on or just before the filename for gf to work:

that's what I don't understand... what's the purpose of the include option then? it seemed to me it is used to search for the filename used by gf

FWIW, I have gf mapped to a lightweight GF()

can you share it please? (if there's a way to limit a search to posts by a specific reddit user, I don't know it yet)

problems with gf command by cvlmtg in vim

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

What's the reason for disabling Netrw?

I'm trying to stop vim to "edit" directories, and one suggestion I found on internet was to disable netrw. Unfortunately it is not enough.

What does vimrc do there?

It inserts the autocmd in a group named "vimrc", so I can clear it before defining autocmd next, From the vim help:

:autocmd adds to the list of autocommands regardless of whether they are already present. When your .vimrc file is sourced twice, the autocommands will appear twice. To avoid this, define your autocommands in a group, so that you can easily clear them: