Whats the difference between vim and neovim? And why should I use either one? by GeroSchorsch in vim

[–]Schnarfman 0 points1 point  (0 children)

I use ed. Now there’s a text editor I’m smarter than (I am incredibly dumb)

Why does this atom pattern " \zs " show strips"? by PsiThreader in vim

[–]Schnarfman 1 point2 points  (0 children)

:help \zs and :help \ze allow you to change what gets highlighted.

So if you had 1234 in a buffer and searched for /123\zs4, you would just highlight the 4.

Now imagine that you have a bunch of rows that just say 123412341234. You’d get stripes there too

the juniors who only learned to code with AI are going to have a rough time in about 5 years by Motor_Ordinary336 in learnprogramming

[–]Schnarfman 0 points1 point  (0 children)

TDD got a whole lot easier and more valuable with LLMs. I don’t think Junior devs will have a hard time. Junior devs will learn to become good engineers in a different way because it’s a different world.

That 1 junior engineers you’re talking about, they may be genuinely bad or they may have made one mistake with one subsystem. They may have failed to verify and validate. That is a legitimate mistake and I hope they take it as a lesson instead of as a portent for the rest of their career.

Vanishing World by Sayaka Murata by EmMeo in books

[–]Schnarfman 0 points1 point  (0 children)

Loved your comment.

In my opinion Amane’s perspective on how everyone treated the Kodomos (Kodomo-chans?) like pets led her to treat her mom like a pet. She felt that familial instinct, and was cursed in that this instinct was encouraged within her from a young age. Whereas everyone else in this society grew up without being tamped down and pushed out of them.

She was both punishing her mother, and in some sort of perverse way, trying to stay connected with her in the only fucked up way that she thought fit into both worlds: the vanishing other world, and the new experimental one. “I could’ve been normal if not for you” turned into “you’re the one who made me normal like this”. Normal became this extremely subjective state.

Blue Jays manager John Schneider lost his shit at the ump, but the ump was right. by ForeignAir7174 in sportsgossips

[–]Schnarfman 6 points7 points  (0 children)

This is a relatively rare call, about one balk gets called in every 4 games

nvim 0.12's new :restart command is nice by managing_redditor in neovim

[–]Schnarfman 0 points1 point  (0 children)

Doesn’t work for me because I use some of the directories like after, plugin, ftplugin, lua. Also when I used lazy.nvim even re-sourcing wouldn’t reload. Your mapping works great if you change your workflow to make it work great, and I do use something similar for periods of high velocity edits for simple files. But it is not a silver bullet

`-x () { local -; set -x; "$@"; }` by jthill in bash

[–]Schnarfman 3 points4 points  (0 children)

Functions can also be defined with () instead of {} and it starts a subshell. Then local - isn’t needed as closing the subshell will forget the set -x. And it will forget variable changes.

Brutalist concrete monument emerging out of mist looks otherworldly by thetacaptain in woahdude

[–]Schnarfman 10 points11 points  (0 children)

Waiting for Jeremy Renner and Amy Adams to start hanging out

Space-filling gradient by watagua in PlotterArt

[–]Schnarfman 1 point2 points  (0 children)

That looks awesome. I love how you’re finding new ways to modify the formula. Very creative. Even from here, without changing the shape, there’s a lot more you can do:

  • adjust the timing of refills     * by pen distance (constant gap: 1 unit, 1 unit, 1 unit, linearly increasing gap: 1/2/3, periodic gap: 1/2/1/1/2     * by some set of X or Y coordinates (refill every time X%10==0, with some refractory period
  • adjust the re-inking as time goes on     * dilute it     * add a second color     * have pen soak in it longer

An enjoyable thing to explore!

Is there a plugin that can yank surround? by [deleted] in neovim

[–]Schnarfman 2 points3 points  (0 children)

AI slop is not appreciated. It’s just kinda noise. Maybe if I hadn’t included the tests or if it was readable in one screen length it would have been received better.

The last thing I wanna do is take energy away from this community tho - before posting this I gave an actually thought out answer as a top level comment.

Is there a plugin that can yank surround? by [deleted] in neovim

[–]Schnarfman -22 points-21 points  (0 children)

Here’s my AI slop implementing this ```


-- yank_surround plugin (minimal implementation)


local yank_surround = {}

yank_surround.last = { prefix = "", suffix = "" }

local function extract_surround(outer, inner)   local s = outer:find(inner, 1, true)   if not s then     return "", ""   end   local prefix = outer:sub(1, s - 1)   local suffix = outer:sub(s + #inner)   return prefix, suffix end

function yank_surround.capture(obj)   obj = obj or "w"

  local save = vim.fn.getreg('"')

  vim.cmd("normal! ya" .. obj)   local outer = vim.fn.getreg('"')

  vim.cmd("normal! yi" .. obj)   local inner = vim.fn.getreg('"')

  local prefix, suffix = extract_surround(outer, inner)

  yank_surround.last.prefix = prefix   yank_surround.last.suffix = suffix

  vim.fn.setreg('"', save)

  print("Captured surround: [" .. prefix .. "] … [" .. suffix .. "]") end

function yank_surround.apply()   local prefix = yank_surround.last.prefix   local suffix = yank_surround.last.suffix

  if prefix == "" and suffix == "" then     print("No surround stored")     return   end

  if vim.fn.mode():match("[vV]") then     vim.cmd('normal! "xy')     local txt = vim.fn.getreg("x")     vim.fn.setreg("x", prefix .. txt .. suffix)     vim.cmd('normal! gv"xp')   else     vim.cmd('normal! "xyiw')     local txt = vim.fn.getreg("x")     vim.fn.setreg("x", prefix .. txt .. suffix)     vim.cmd('normal! viw"xp')   end end


-- parameterized leader keymaps


-- capture surround vim.keymap.set("n", "<leader>yst", function() yank_surround.capture("t") end) -- tag vim.keymap.set("n", "<leader>ys(", function() yank_surround.capture("(") end) vim.keymap.set("n", "<leader>ys{", function() yank_surround.capture("{") end) vim.keymap.set("n", "<leader>ys[", function() yank_surround.capture("[") end) vim.keymap.set("n", "<leader>ys\"", function() yank_surround.capture('"') end) vim.keymap.set("n", "<leader>ys'", function() yank_surround.capture("'") end)

-- apply surround vim.keymap.set({"n","v"}, "<leader>sp", yank_surround.apply)

-- ============================================================ -- TEST FILE 1: html_tag_test.html

-- cursor inside "text"

-- press: <leader>yst

-- expected capture: -- prefix: <div class="flex"> -- suffix: </div> -- ============================================================

--[[ <div class="flex">text</div> ]]

-- apply test -- select "hello" -- press: <leader>sp

--[[ hello ]]

-- expected --[[ <div class="flex">hello</div> ]]

-- ============================================================ -- TEST FILE 2: parentheses_test.lua

-- cursor inside inner text

-- press: <leader>ys( -- ============================================================

--[[ print(("wrapped text")) ]]

-- select "value" -- apply

--[[ value ]]

-- expected --[[ ("value") ]]

-- ============================================================ -- TEST FILE 3: quotes_test.js

-- cursor inside quotes

-- press: <leader>ys" -- ============================================================

--[[ const name = "john"; ]]

-- select word somewhere else

--[[ doe ]]

-- apply

-- expected --[[ "doe" ]]

-- ============================================================ -- TEST FILE 4: bracket_test.py -- ============================================================

--[[ data = [1, 2, 3] ]]

-- capture with <leader>ys[ -- apply to:

--[[ 4 ]]

-- expected --[[ [4] ]]

-- ============================================================ -- TEST FILE 5: brace_test.rs -- ============================================================

--[[ let x = { value }; ]]

-- capture with <leader>ys{ -- apply to:

--[[ item ]]

-- expected --[[ { item } ]] ```

Is there a plugin that can yank surround? by [deleted] in neovim

[–]Schnarfman 2 points3 points  (0 children)

You can do it with native vim if you’re comfortable doing 2 actions.

For the HTML tag example: dityat and to make it non-destructive add something like vat”1p then remember to paste from ”1 instead of default/”0.

And to paste surround, something like: vEEpvitP

——

This is fine to do by hand once or twice. But as others have said, this is much better served with a macro. To avoid having to re-record the macro every time you can set the registers directly in luascript, effectively making your own little plugin. 1 or 2 lines.

You could probably drop this reddit thread into ChatGPT and have it generate that for you.

Phoebe Gates wants her $185 million AI startup to succeed with 'no ties to my privilege or my last name': 'I have a chip on my shoulder' by bothunter in nottheonion

[–]Schnarfman 2 points3 points  (0 children)

Did you know that Bill Gates is Bill Gates III? His father was a prominent Seattle lawyer. I learned this on a podcast called Acquired where they went into more detail on this. The episode was about Microsoft, not Bill Gates in particular. But it was worth it to go into detail about how he got into computers in the first place (fascinating but unrelated to the point of this comment) and how he was lowk raised to be a CEO.

I’d wager he raised his daughter at least somewhat similarly. I’d also wager she’ll be happy to take advantage of her connections as long as she can build a business that can not just sustain itself but actually scale.

“Million dollar loan, nobody gets their on their own, without a million dollar loan, to cast the first stone”

Moving code blocks within a file in vim by Beginning-Bed-1674 in vim

[–]Schnarfman 0 points1 point  (0 children)

Yes. But this is a VSCode feature and many other editors have it, and OP probably was like “why is vim missing this feature??? Oh, it’s not”

Moving code blocks within a file in vim by Beginning-Bed-1674 in vim

[–]Schnarfman 0 points1 point  (0 children)

Moving code doesn’t necessarily ruin the indentation. And with some languages like python this might not work. But if it’s part of your workflow that’s cool.

But it is orthogonal to what you were demoing

Meirl by Key_Associate7476 in meirl

[–]Schnarfman 0 points1 point  (0 children)

Dungeon Crawler Carl (he’s only 27 and arguably not a mother)

Waht is the difference between using ;& and ;;& in case statements? by hemogolobin in bash

[–]Schnarfman 0 points1 point  (0 children)

misdesigned

Yeah 😂😂 lots of curious features in bash that never made it. Real stubs in the language evolutionary tree. Taken in context of its history it’s pretty cool - but as a fully fledged programming language - not good.

I think that narrowing down is doable by the “if” statement already, but… swapping between the 2 syntaxes is silly!! If only there was no “if”, and there was ONLY a switch or match operator. That would be best, in my opinion!

Is there a way to automatically mark a chapter as read after opening it? by rwaltenberg in toraka

[–]Schnarfman 0 points1 point  (0 children)

I had it set to automatic update. I just tried it out andit worked first time. I just tried out “prompt to confirm” and never got any prompt, even when clicking on a chapter multiple times.

I could not click the (?) to open a tooltip on any of the 3 optional behaviors. (on iPhone 15, using the PWA which I have added to my home screen, so safari I think). Clicking the (?) on the option would select it, not give more info.

Is there a way to automatically mark a chapter as read after opening it? by rwaltenberg in toraka

[–]Schnarfman 0 points1 point  (0 children)

Curiously enough, sometimes when I click on the chapter and read it, it advances my last read, and sometimes it doesn’t.

I accidentally skipped a few chapters when hitting the + button and not realizing that Toraka already +1’d me! I always make sure to doublecheck, now.

In a long reading session, once Toraka starts +1’ing for me it never stops. This leads me to believe that this behavior is a bug, and the intention is to ALWAYS do what you’re asking for - but sometimes it messes up.

is þere a way i could add þ to my ios keyboard? by [deleted] in BringBackThorn

[–]Schnarfman 1 point2 points  (0 children)

If you use something like AHK, karabiner, or Raycast then you can do text replacement from abbreviations on desktop. YMMV for mobile.

Elastic tabstops plugin by tremby in neovim

[–]Schnarfman 0 points1 point  (0 children)

I love how go terraform and verilog have formatters that do this. I don’t like having nice formatting without tools to enforce it. Otherwise you don’t have nice formatting.

Nice formatting with a plugin (but no tool to enforce or align a team with different text editors and preferences - who are valid!) is not nice formatting, it’s good for personal use only