loading...

First impressions of Micro

yujiri8 profile image Ryan Westlund ・4 min read

I recently asked to be persuaded to switch away from Nano, and someone got me into Micro. It's going pretty well so far. This doesn't represent a final opinion or anything (I might do a more in-depth review when I've seen more of it). Here are my impressions so far.

Syntax highlighting

The default syntax highilighting schemes look a lot worse than Nano's if you ask me. Their customization is also a bit more complex. That said, I think the system it uses for them is way better. It can do things Nano's can't, like contextual rules (the lack of that often caused unsolvable imperfections in Nano's highlighting). When I have time, I plan to use this to implement an extension to JS syntax highlighting that allows template strings containing HTML or CSS to be colored as such, for use with the Lit-Element library I use.

Scroll margins...?!?

There's this 'scroll margins' setting which lets me set how far my cursor should have to get to the edge of the screen to start scrolling. Everywhere else I've seen this value has just been 1 or 2 or something and no one questioned it. Micro defaults it to 2. When I saw this, I realized the implications and set it to 15.

It's awesome. What a great feature. Although I would've griped about Micro not having the "scroll the window without moving the cursor" ability Nano has, this mostly replaces that.

Search/replace much worse

There's a built-in find-by-regex functionality, and also replace-by-regex, but the latter is much less powerful than it was in Nano in several ways.

Firstly, there isn't a menu for it. I can't bind a key that will ask for a string to search for, then a string to replace with, accepting with enter - the best I can do is a bind a key that opens the command bar and pretypes replace. The params go after it, but since they work like CLI args, they can take quoting and escaping, which is less convenient than pressing enter to delimit them.

There are commands replace and replaceall meaning I have to decide which at the start of the operation. In Nano, I'd order a replace command and it'd ask me about each operation, but at any of the prompts I could say "do all of the ones after this". As far as I can tell, I can't do that in Micro; I have to cancel and do a replaceall.

It also doesn't seem like I can switch between find and find-by-regex with a hotkey without exiting the find prompt and typing a command manually. In Nano, opening the find prompt would enable context-sensitive hotkeys that would let me toggle whether I was going to do a literal or regex search, forward or backward, or even toggle between find and find-to-replace. In Micro, those switches are all implemented as separate commands.

Line moving

The second major feature I gained moving to Micro is the "move line" feature. The default hotkey is alt-up/down; it moves the current or selection. This is an incredibly common operation. In Nano I always did this by cutting the lines, then moving the cursor and pasting them. This is way faster. Currently I'm constantly doing it by accident because in Nano, alt-up/down was the hotkey for scroll-without-moving-cursor, but this'll save me a ton of time once I get used to it.

Line highlighting

The line I'm on is highlighted faintly. It's a pretty minor feature, but I'm glad to have it available because sometimes I'd lose my cursor in Nano, and this should help with that.

Config from inside editor

Any config option can be changed, persistently or not, from inside an editor instance.

Regex dialect

Apparently the regex dialect used is re2, whereas Nano uses GNU extended regex. It seems like re2 brings a couple of features GNU extended doesn't, but not nearly all of what PCRE does. Most importantly, I still don't get lookaround, which is the #1 thing I missed with Nano's regexes.

Status bar

It has a status bar like Nano, but - at least with the default config - it doesn't show nearly as much information. In particular, it doesn't show the length of the line I'm on or the length of the file (although the scrollbar helps somewhat with the latter). Those were useful things to see all the time.

That said, the status bar is customizable, so I'm not sure yet if I can fix this or not.

Default syntax?

I'm probably unusual for wanting this, but with Nano I had taken advantage of the "default" syntax highlighting feature for thoughts files. In Micro, while I can adapt the file, I'm not seeing any way to mark it as default. I might have to start naming my thoughts files with an extension. That's a bit annoying.

Softwrap line movement

I use softwrap for paragraphs in all my non-code files. In Nano, when a line is wrapped onscreen, up/down arrows take me across visible lines, rather than logical ones. But in Micro they take me across logical lines. That makes navigating softwrapped paragraphs a lot less convenient. I can't step 120 characters through a paragraph by pressing down; I have to either move by words or look for a unique snippet of text and jump to it.

Line numbers work better with copy-paste

Nano has a toggleable line-number-ruler, but I rarely used it because it messed up external copy/paste. I figured it wasn't that important when I had Nano's awesome status bar. Micro handles this more sophisticatedly; it uses the external copy/paste buffer itself, so I don't have that problem.


So I'm definitely planning to stick. I expect some of these issues can be fixed with configuration I haven't found yet, some others might be fixed in the future, and there might be plugins to fix others.

Posted on by:

yujiri8 profile

Ryan Westlund

@yujiri8

I'm a programmer, writer, and philosopher. My Github account is yujiri8; all my content besides code is at yujiri.xyz.

Discussion

pic
Editor guide
 

Oof, something else I just found out that's really bad: apparently search operations are not counted as part of a macro if I do them while recording. I used that all the time in Nano. Macros are way less useful if they can't include searches.

 

Thanks for the writeup, I think there are a lot of great thoughts here that I haven't considered which could be used to improve micro, and I should look into implementing some of them!