Readit News logoReadit News
aquariusDue · a year ago
Anvil piqued my interest especially because it provides a REST API to interact with it opening the door to writing extensions in practically anything, similar to Kakoune in that regard. But what I find odd is that there's no mention of a repo (though it has a link to a Discord server) anywhere on the site as far as I've seen.

Sadly there's no mention of LSP either which is kinda a deal-breaker these days nor anything about tree-sitter. But at the same time this might mean that Anvil is free to experiment with its own solutions without being tied to a standard. Every cloud a silver lining or how it goes.

Gio also seems like a solid choice for the UI.

I hope Anvil becomes more popular, it would be fun to see a new generation of niche text editors duke it out between Lem, Helix and Anvil.

ksynwa · a year ago
Source code archives are available on the download page: https://anvil-editor.net/download/

But as you said I couldn't find a repo.

hollerith · a year ago
It is however open-source (MIT license).
Arch-TK · a year ago
> multiple cursors

But seriously though, why does everything these days need multiple cursors? It's a confusing visual gimmick in every scenario I've seen it implemented in. I'll take fully fleshed out structural regular expressions or even perl-re over multiple cursors any day. Combined with as vim's [c]onfirm flag you get all the benefits of multiple cursors without all the clunky downsides and weirdness.

wodenokoto · a year ago
When I need to edit the code around next five instance of "foo", but not every instance in the open file, then I don't know how to do that with structural regular expression, but pressing ctr+d five times and then edit what I want is really straight forward.

And I need to edit around a limited version of foo way more often than I need to edit all instances.

specialist · a year ago
I'd watch this twitch stream. Contemporary editors are like 5-axis CNC mills and I'm still banging the rocks together. My occasional use multiple cursors is very basic. Your strategy wouldn't even occur to me.

Ages ago, Suresh Bhavanani (sp?) studied (suboptimum) usage of office and CADD applications. He was hired by the Army Corps of Engineers to help determine why adoption of CADD hadn't resulted in either higher productivity or improved quality.

His theory, which I believe, is various people have various "strategies" of varying merit. But for some reason users didn't (couldn't) readily learn better techniques from each other. IIRC, His two proposals were 1) re-organize user interfaces around tasks, instead of a features and 2) update training materials emphasize strategies.

IIRC, he compared manual and digital drafting. He identified a bunch of implicit and explicit "strategies" for manual work. eg Using ink and mylar, skilled drafters would work right-to-left, to avoid smudging prior work. Many early adopters carried those manual strategies over to CADD. Suboptimal, right? So then Suresh identified a bunch of digital appropriate strategies, leveraging the new tool.

Suresh did the same for spreadsheets.

Any way, this is a too long ramble now ending with the point: It'd be nice to see how others organize their work. I'm sure there's a lot of low hanging fruit "strategies". All the day to day tricks that experts use that don't get captured and explained in our training materials.

msravi · a year ago
In vim, to replace in the next 5 lines (not instances)

    :.,.+5s/findtext/replacetext/g
In neovim, you'll see a preview of the changes as you type the regexp. Neovim is really good.

globular-toast · a year ago
You would restrict your regexp to a region. In Emacs you just select a region somehow (like your press ctrl+d five times), then just do the regexp replace.
sevensor · a year ago
Vim is a great editor, and when I see people laboriously clicking to create multiple cursors to do something that a simple s/foo/bar/g would accomplish, I feel sorry for them. However, multiple cursors can be pretty great; I love the implementation in kakoune, where I can make multiple selections and then replace them with the output of piping them through an arbitrary shell command. I like to do this with basic math I write out as inputs to dc and then transform to the computed results using select and pipe.
spartanatreyu · a year ago
Would s/foo/bar/g change every foo into bar without also changing every food into bard?

Also in most use cases, clicking for each multicursor is the wrong way to do it.

With multicursor you can:

- Press a shortcut to auto select every instance of the characters that you already have highlighted (which is just s/foo/bar/g with visual feedback before confirming)

- Press your "select next occurrence" shortcut a few times so you're only changing the first few occurrences that you care about.

- Press your "select next occurrence" shortcut to select the instances you want and press your "skip next occurrence" shortcut to skip the instances you want to keep. That way you can change a bunch of "foo"s to "bar"s while keeping all "food"s as "food"s but also keeping those few instances of "foo" that you want to stay as "foo" (such as in comments, imports, tests, etc...)

- Press your "select next occurrence" shortcut (usually ctrl/cmd + d) each time if you literally want to see each instance before moving on to the next. Usually this is when you really want to make sure of something next to one of the occurrences.

- And finally clicking each cursor if there really is no simple pre-existing pattern for where you're trying to make changes

dxuh · a year ago
I use multiple cursors all the time and rarely use the mouse to create them. Either it's "Add cursor to line ends" (VSCode)/"Split into lines"(Sublime) or just Ctrl+D.
alpaca128 · a year ago
I use Vim every day, but sometimes it's simply more convenient to visually confirm how something should be aligned etc., which is where Visual Block mode comes in handy. And Visual Block mode is just multiple cursors limited to a single column, so I can definitely see how multi-cursor support can be a more modern evolution.
dakr · a year ago
Can you give an example of using dc like this? Seems like something I would find really useful!
gpderetta · a year ago
Some people can craft the perfect command ahead of time to execute an series of editing operations on the first try. Some other people (/raises hand) prefer to visual incremental feedback on an in-progress operation and be able to partially undo mistakes as they go.
skydhash · a year ago
With Vim it’s all local decision unless writing a macro or regex substitution would take less time (the structure is very repetitive). Often it’s just n.n.n.n. (Next search occurence and repeat last edit)
subjectsigma · a year ago
I feel exactly the opposite, macros and regexps always felt like I was trying to shoot something blindfolded, it was always awkward and usually didn’t work the first time. Multiple cursors provide immediate visual feedback. Once I started using them they replaced macros and find-and-replace immediately. I don’t use an editor unless it supports multiple cursors. What “clunky downsides and weirdness” are you experiencing?
kqr · a year ago
For the record, there are plugins (for e.g. Emacs) that provide visual feedback on regex operations.
alpaca128 · a year ago
Using :%s instead of :s lets you preview in real-time what a regex substitution will do while you are typing it.
robenkleene · a year ago
Multiple cursors are just live visual feedback for editing macros. Generally live visual feedback is a universal good, e.g., I'd argue most innovations in desktop user interfaces for creative apps are using Moore's Law to take modal interfaces and make them live (and correspondingly, non-destructive). E.g., find-as-you-type search and fuzzy finders being a couple examples, as well as most changes to Photoshop, GPU-based rendering IPR views, the entire existence of Lightroom and Ableton Live as apps.

With that said, the reason live visual feedback haven't systemically replaced all previous modal interfaces, the way they have for media editing apps, is because it's easier to picture the result of a text editor (i.e., relative to a HSR change to a photo), so it's not quite as revolutionary for text editing as it is applied elsewhere, I'd still argue it's a universal good though, more visual feedback is always better.

freetonik · a year ago
I cannot imagine a workflow without multiple cursors. I use this feature dozens of times every single day. It became a subconscious part of how I edit text.
nextcaller · a year ago
I find multiple cursors very useful, a must-have. However I think there needs to be more "safety" around them. It's very easy to accidentally have multiple cursors active without you knowing, and the next thing you type changed something you didn't intend to. I would appreciate if there was some sort of lock I can apply to multiple cursors, to only use them when I need them and when I'm aware that I'm using them.
aragonite · a year ago
> However I think there needs to be more "safety" around them. It's very easy to accidentally have multiple cursors active without you knowing ...

Relatedly, if you've created cursors across many lines (or more lines than fit in your viewport), and for whatever reason you want to move all the cursors to the start or end of lines, you want to press Home/End not once, but twice, due to to possible word wrapping on lines outside your view. I've lost nontrivial work by making this mistake!

quadsteel · a year ago
Way less mental overhead than macros and much faster for most cases. You might wanna look at them beyond surface level, they\'re actually awesome.

Having both is even better. While I'm not a fan of Helix's selection→action model it's a great example of how macros&multicursors go very well together. Soon to be on neovim native too, so there's that

t-3 · a year ago
Multiple cursors aren't really any different from regex for editing, but are much easier for the layman to pick up and often much quicker for edits where the regex would be complicated and verbose. If my edit-scope is within a single screen or so, I will almost never use regex before multiple cursors. They are incredibly useful for writing new content though (just think about all the times text or code is structurally repetitive with lots of identical boilerplate).
globular-toast · a year ago
I see multiple cursors as an alternative to macros rather than regexp. There's stuff that is really awkward with regexp, like anything involving multiple lines, for example. But more importantly, macros and multiple cursors have the opportunity to operate at a higher-level, ie. taking into account language syntax and editor modes etc. Regexp is just about text. Having said that when I see people using it they are just doing a glorified regexp replace more often than not.
Vegenoid · a year ago
I use multiple cursors all the time in Kakoune. Say I want to make a change that is very similar on 10 adjacent lines. I could write a regex or macro that does what I want, which will require me doing that with no visual feedback as I build it. Instead, I can put a cursor on each line and see if I’m getting it right as I’m making the changes. To me, it is an easier, more interactive way of doing the things you’d usually do with a macro in Vim.
dxuh · a year ago
I use multiple cursors multiple times per hour when programming. I do not like vim and I don't use regex. And I am convinced I am faster this way than I could ever be using vim or regex for common editing operations. They are ubiquitous but imho still underrated.
frou_dh · a year ago
Why don't you use regex for all editing in the single-cursor case as well then?
msravi · a year ago
If I want to change a word on one line, I find it faster to do <esc>cw replacetext rather than use the mouse to select the text and then replace text.

If I want to do that on 2-3 lines, I just use /findtext n and . to redo the prev command.

Anything more than that becomes a full search/replace.

Ymmv. It's just what I find efficient, given my muscle memory.

rk06 · a year ago
Two rules of success:

1. Be attractive

2. Don't be unattractive

Lack of multi cursor supprot is unattractive in current era.

sexyman48 · a year ago
Tom Brady agrees.
OmarAssadi · a year ago
While looking into Acme several months back, I actually bumped into this; there just don't seem to be many editors that draw inspiration from Acme's workflow rather than borrowing from things like Vim, Emacs, or more traditional mouse-based GUI editors -- e.g., Notepad++, Sublime, Kate, VS Code, etc -- so Anvil popped up pretty much instantly while searching around for similar concepts.

However, as someone who hadn't, and unfortunately, still hasn't, spent a load of time using Acme, it wasn't super clear to me how they differentiate from each other. I wasn't totally sure whether it was more of a clone made for fun of it, or whether Anvil was trying to solve a genuine issue that Acme wasn't, or was trying to solve in its own distinct way, or perhaps trying to address a gripe with Acme itself, etc.

If anyone working on the project could highlight some of the differences in features and goals, or if anyone who has used one or the other long enough to notice some stuff at a glance, it'd be super helpful as an outsider to both. Superficially, I do see syntax highlighting, but I figure there's probably more going on than that.

Also, is there any sort of publicly accessible version control? I see the source archives, but I couldn't find any sort of mention of git or any other vcs.

FWIW, by the way, I hope asking about a comparison doesn't come across as some sort of dismissive, "what's the point", comment; it was just cool and interesting enough that this isn't the first time I've wanted to ask.

ksjw12 · a year ago
A few of the main differences between Acme and Anvil are:

1. Anvil supports syntax highlighting, as you noted.

2. Anvil allows remote editing over ssh. If you open a file with a name of the form '[username@]host:/path/to/file', then Anvil will establish an SSH connection to the host (if one doesn't already exist) and allow the user to edit the file and execute commands remotely in the context of the window

3. Anvil allows the use of multiple cursors and selections. What's interesting about this is that text manipulation language called "Range Statements" in Anvil uses the current selections in the window as input (the initial ranges on which to operate), and those statements that produce a set of ranges when executed replace the set of selections in the window. Range Statements are mostly equivalent to the Sam language in Acme, which most people refer to as Structural Regular Expressions (but of which Structural Regular Expressions are only a subset of the language). So the practice of selecting text with the mouse or the keyboard, adjusting ranges with expressions, and switching between the two is slightly more tactile than in Acme.

4. Anvil is a bit more convenient to use with the keyboard than Acme. For example, moving up and down with the arrow keys is standard, text can be selected using shift and movement keys, a word can be executed using CTRL-T, and a line by CTRL-Enter, and a number of other common keyboard shortcuts are supported.

5. Anvil has better support for files with spaces in the name

6. Anvil has a special syntax that makes it a bit easier to execute commands or perform searches that contain spaces. If you surround the command or search with lozenges (i.e. ◊|wc -l◊ or ◊search term◊) then executing or searching using the mouse by clicking anywhere within the lozenges executes or searches for the entire delimited string. This is nice for things you do often.

7. Anvil allows searching backwards via clicking, as well as searching for a regexp

8. Anvil borrows from Wily the ability to hit Escape to highlight the recently typed text for easy execution or searching

hollerith · a year ago
>whether Anvil was trying to solve a genuine issue that Acme wasn't

The last time I checked Acme used its own text-rendering algorithms and its own fonts (this is the Acme that is part of plan9port) which wouldn't be a problem except that the visual details (I am pretty sure Acme was using bitmapped fonts) clashed pretty strongly with the rest of the system (I was using a Mac at the time).

The browsers do their own text rendering, too, but the rendering is tuned to match the OS the browser is running on.

Point is, although I could've gotten used to the tiny details of how Acme renders text, I despaired of ever getting used to frequently switching my gaze back and forth between Acme's window and the other windows on the Mac.

In contrast, the text in the Anvil window does not clash with all the other windows on my system (which is no longer a Mac, but rather Gnome / Linux). So that is why I rejected Acme quickly after installing it, but am still interested in Anvil (the existence of which I learned about about an hour ago).

msravi · a year ago
disintegrator · a year ago
I really love working in neovim but this is a frustrating position that much of the community has taken. Editing multiple sites _simultaneously_ is nowhere as intuitive as with VS Code and IntelliJ/Sublime before it.

- Repeat - `.` - is ok for some bulk manipulations but in my opinion it's not as nice because it's after the fact. I like that in VSC I select all the occurrences I want to edit first and then if the selections match my expectations I go ahead.

- Visual mode only lets you work vertically in a contiguous block of text. That's not the same or as convenient as multi-cursor in VSCode where I can select the word "const" for example and ⌘-D to select more occurrences of it anywhere in the buffer, not just above/below, and bulk edit them to "let".

- Macros are often what I lean and they can do far more than multi-cursor editing could but they are far more tedious to string along and repeat when all I want is to change some text in multiple locations.

- Text replacement (sed) is also fine but not as convenient in my opinion.

Either way, neovim will be getting native multi-cursor support and I'm very excited about that because I'm not particularly fond of VS Code (in terms of perf/resource usage) but I recognise (neo)vim doesn't have a monopoly on good ideas.

archargelod · a year ago
There's also vis[0]

It is an editor that combines best parts from vim and plan9 sam[1] (multiple cursors, structural regular expressions).

0 - https://github.com/martanne/vis

1 - https://en.wikipedia.org/wiki/Sam_(text_editor)

stronglikedan · a year ago
I may not need it, but every operation they demonstrated is significantly slower than using multiple cursors, so I definitely want it.
haolez · a year ago
How's the feature parity with Acme + plumber + other Plan9 stuff?

This feels like a modernization of Acme and it sounds like a very good idea to me. If it's not immediately a better alternative to VSCode and other IDEs, it can be seen as a platform for integrating external tools and have a cohesive experience (similar to what Emacs offers). I dig it!

createaccount99 · a year ago
It seems good but as others have mentioned, LSP/tree sitter pretty much must-have these days.

And I'd like to see inspiration taken from OniVim's "sneak" feature, which is basically link hints (or ace jump) for all the buttons in the UI, which makes mouse actions doable with just the keyboard, in an intuitive way.

Dubhead · a year ago
ad is another text editor inspired by Acme:

https://github.com/sminez/ad

euroderf · a year ago
If this can be compiled into WASM and embedded in a web page...