r/programming • • May 20 '18

GitHub - zyedidia/micro: A modern and intuitive terminal-based text editor

https://github.com/zyedidia/micro
418 Upvotes

139 comments sorted by

302

u/[deleted] May 20 '18

Does micro support Vi keybindings? No, if you want to use Vim then use Vim.

28

u/TheBestOpinion May 20 '18

Seems pretty reasonable

8

u/[deleted] May 20 '18

Well, vi != vim

2

u/self May 20 '18

How does that vi compare with nvi? I've used nvi since 1993 or so, when I first installed FreeBSD.

→ More replies (2)

58

u/uzimonkey May 20 '18

Yeah, that's a deal-breaker for me. I don't even use Vim anymore, I use VSCode, but I can't do it without Vim emulation. Going to a "normal" editor feels like walking through mud, I don't want to use a text editor without a vim mode.

64

u/[deleted] May 20 '18

I don't know why you'd expect a terminal based editor that isn't Vim to have vim bindings.

15

u/hpp3 May 20 '18

Why not? Even Emacs has Vim bindings.

20

u/[deleted] May 20 '18

There's a reason it's called "evil" mode ;)

But yes, emacs is quite a bit different than nano or likely micro.

6

u/spockspeare May 20 '18

If you don't have vim and emacs bindings, you'll lose at least half the audience, who long ago decided that learning all-new bindings is just admitting they could have adapted to the other one instead of arguing about it for years...

25

u/[deleted] May 20 '18

If you're making a terminal based editor, you've already lost most of your audience. The remainder either are already satisfied with vim/emacs, or don't know either and want something intuitive for the times when they can't use their preferred graphical editor.

I was the opposite where I wanted to use Vim, but for some reason I needed to use another editor/IDE (Visual Studio, Android Studio, etc). As someone who really likes Vim, I don't see the point of another terminal editor with vim bindings, since I'll just use Vim.

What is there to gain by making vim bindings in an environment where Vim is ubiquitous? Are the features this editor offers really enough to displace vim enough that incomplete bindings are better than just using vim with a few plugins?

→ More replies (4)

6

u/Vhin May 20 '18

If you are familiar with vim, why would you /not/ use vim when you need a terminal text editor, and instead use a different text editor with vim bindings? If you like vim and are already in the terminal, I feel like you'd reach for vim, not an imitator.

Especially in this case. Vim is likely to be installed; micro is likely to not be installed.

→ More replies (1)
→ More replies (2)

-7

u/uzimonkey May 20 '18

I don't know what it being terminal-based has to do with with it, but if they expect me to do work in it then it needs a vim mode. A lot of people are of the same opinion, the VS Code vim emulation plugin alone has over 2.4 million installs. Similarly on Visual Studio there's a vim emulator with a high number of installs, and on IntelliJ, and on Sublime, and on Atom, and on Emacs and virtually every other "serious" text editor or IDE out there.

And it's not that I'd expect it, it's that I require it or I won't consider using it. And for them to flippantly dismiss a vim mode is probably only hurting them in the long run.

29

u/[deleted] May 20 '18

Vim is already terminal based, so why reinvent the wheel? Just use Vim.

Vim mode makes sense for graphical editors and IDEs like Visual Studio Code and Visual Studio because they're not competing with vim. I personally don't use Vim bindings because I'm always disappointed in missing features, like registers, vertical block select, and macros.

If you're editing text from a command line and want vim bindings, just use Vim. The other features of most text editors can be had with plugins, and you won't be disappointed with incomplete Vim bindings. You could also try emacs evil mode if you like emacs better for whatever reason.

3

u/didnt_readit May 20 '18 edited Jul 15 '23

Left Reddit due to the recent changes and moved to Lemmy and the Fediverse...So Long, and Thanks for All the Fish!

→ More replies (3)

25

u/pataoAoC May 20 '18

I'm not sure why you're getting downvoted. Vim motions are kind of a standard by this point, and for those of us used to them, they're pretty essential.

For everyone else, no problem of course, but you weren't speaking for them.

54

u/IceSentry May 20 '18

They are only standard for people used to them.

11

u/pataoAoC May 20 '18

a standard, not the standard. Emacs is the other major standard that I know of.

5

u/will_i_be_pretty May 21 '18

Or, you know, CUA, which is the standard in literally every other damn piece of software that isn't Emacs or Vim.

→ More replies (1)
→ More replies (7)

7

u/captainvoid05 May 20 '18

It makes sense to me. Vim modes for gui apps make sense to me, because they are more complex, so having their features and ui with vim bindings could be useful. In a terminal text editor if you've got vim bindings you're basically using vim anyway so why not just use vim?

9

u/commissarg May 20 '18

Emacs motions are the standard for the majority of CLI applications.

2

u/pataoAoC May 20 '18

That's certainly the other major standard. I don't really know any other options.

3

u/th0masr0ss May 20 '18

I personally use Emacs (and Emacs > Vim, of course) but you can configure readline to use vim keybindings (I'm just not sure how "good" it is)

3

u/spockspeare May 20 '18

The F'est of FAQ's for this context.

1

u/[deleted] May 20 '18

Don't worry. Someone will write a plugin to support them.

0

u/[deleted] May 20 '18

[deleted]

97

u/auto-xkcd37 May 20 '18

half ass-vim clone


Bleep-bloop, I'm a bot. This comment was inspired by xkcd#37

→ More replies (3)

19

u/flubba86 May 20 '18

I've been using this for about 18 months, I have installed it on all of the Linux servers I administer at work, I love it.

16

u/H4N_S0L0 May 20 '18

I wonder if the developer gave it that name just so he could make the joke "micro > nano"...

13

u/schwerpunk May 20 '18

Kinda like "less > more"

16

u/execrator May 20 '18

This one's even better. On many systems, less is more.

5

u/[deleted] May 20 '18

I think you mean "more is less". More is old and doesn't have many nice features, so the distro likely symlinked more -> less.

5

u/execrator May 20 '18

No, I meant what I typed :) Both statements make sense with the symlink in place. What provides more on this system? It's less? Ah, so less is more.

51

u/brokething May 20 '18 edited May 20 '18

I tried it. I'm used to Sublime, and I'd like a terminal version of that or similar. I didn't find this very intuitive. I found Open and Save on my own, but not much else.

Why can't we just have an actual menu bar like Windows/OSX/Dos's EDIT? In order to find commands, you have to go trawling around through documentation -- which is better than nothing, and certainly more discoverable than vim, but what's wrong with an interface where you can drop down options and see what options are available to you and learn shortcuts by reading them in the menus?

(please excuse my little rant)

37

u/TheBestOpinion May 20 '18

I find your rant very reasonable and that's one of the key perks of having menus - being able to see what options are available to you, in a categorized fashion, as part of the user experience

I wouldn't want a tree view to show up when I type "help" in my terminal though... also I fear how they'd implement the navigation

-11

u/shevegen May 20 '18

I don't see how this is a "rant".

He provided valid feedback about technical shortcomings.

I am sure many more people wonder why we can't have topmenu bars; actually, some programs do happen to have them such as midnight commander.

What is a "rant" here again?

7

u/Dgc2002 May 21 '18

The person labeled it as a rant themselves

(please excuse my little rant)

1

u/myringotomy May 20 '18

Spacemacs!

→ More replies (2)

27

u/NuSkooler May 20 '18

Currently my favorite drop in terminal editor and one of the first things I throw on a new box. Keep up the good work!

20

u/[deleted] May 20 '18

I stopped using it, because it doesn't support linux console well, and switched back to vim, I never regret.

11

u/oblio- May 20 '18

Could you expand on this, please?

6

u/[deleted] May 20 '18

expand

at linux console (not xterm) in those days selecting text for copy and pasting wasn't possible. It didn't looked like it will change because the developer thought its technical impossible, whereas vim clearly proves it is possible.

3

u/[deleted] May 20 '18

now I think it does

65

u/acceleratedpenguin May 20 '18

You learnt to live with vim because you couldn't exit it.

Happens to the best of us.

-2

u/[deleted] May 20 '18

no, I'm very open minded running all kinds of editors. But vim serves best at the console.

6

u/acceleratedpenguin May 20 '18

It was just a joke, dude. I get that vim is quite powerful when you are used to it. I tried to get into it but I settled for nano, haven't had time to look at vim properly.

7

u/normalmighty May 20 '18

That's what it always comes down to for me. I'm sure vim is great and all, but I can't justify the time investment to learn how to use the thing when there are perfectly usable alternatives that actually work intuitively.

3

u/acceleratedpenguin May 20 '18

Nano is more intuitive to me personally, but that's because I come from a beginner background, I.e. Working with graphical editors like notepad++ when I used Windows. I have heard vim is very good as an editor, but to learn everything when Im not using it as much seems a waste of time that could be better spent. Il probably learn how to use vim when I get free time, it's pre installed on a huge range of devices anyhow where Nano and gedit arent

4

u/shevegen May 20 '18

It's not fair to compare nano to vim.

Nano is much simpler but also has fewer features.

I use nano a lot; vim only very rarely.

I use nano because it is fast and simple.

→ More replies (5)
→ More replies (1)

-1

u/heisian May 21 '18

Sort of a funny joke, but is it really that hard to exit?

:wq

shift+zz

1

u/dustojnikhummer Jan 02 '23

opposed to ctrl q? yes

3

u/[deleted] May 20 '18

What do you mean? Supports it fine as far as I can tell.

5

u/[deleted] May 20 '18

Plugins in lua? You're teasing me...

3

u/[deleted] May 20 '18

You can write native lua plugins in Neovim too!

2

u/MountainDewer May 20 '18

I use this solely as my GIT_EDITOR since it's not modal, and supports a single key combo to save and quit.

2

u/[deleted] May 20 '18

does this editor have function to search in multiple files (usually ctrl+shift+f in other editors) ? or maybe some plugin provides such a functionality ?

3

u/TheBestOpinion May 20 '18 edited May 20 '18

I cannot try it right now so, sorry, but I must ask: Does it have these two features ?

Because those are deal breakers for me

2

u/brokething May 20 '18

It has the first one. I don't understand what the second gif is depicting.

edit: if you mean using the left/right arrow keys to go across lines then yes

3

u/TheBestOpinion May 20 '18

I re-did the second gif for you. I think it's more clear now.

Here's what it does on VIM: https://gfycat.com/BlankFineHagfish

You don't go to the next line when you're on the last character and you press "right"

You don't go to the last line when you're on the first character and you press "left"

1

u/brokething May 20 '18

Got it. Yep it does go across lines.

3

u/TheBestOpinion May 20 '18

Woah that's the first terminal editor I've came across that does both of these

1

u/BufferUnderpants May 20 '18

Emacs does both, but it's hardly ever used in a tty. You can, but people use it with its own GUI.

4

u/nsiivola May 20 '18

People use it in terminal all the time! What else except emacs -nw would you run if you're over ssh and aren't a vi-head?

2

u/Free_Math_Tutoring May 20 '18

Nano. Or, you know, micro, since we're already here.

→ More replies (1)

1

u/coriandor May 20 '18

Every editor I know of has the first. I don't know of an editor that doesn't do the second other than vim, which you can fix with set whichwrap+=<,>,h,l,[,] in your .vimrc.

-1

u/TheBestOpinion May 20 '18 edited May 20 '18

Suplemon doesn't have the first and I don't believe nano does either

I'm not going to configure vim as I don't plan to ever use it. Micro already does that natively and it's actually a sane editor.

edit: as in, vim has so many things I dislike that it's a lost cause; thanks though, but you're wasting your breath. I have suplemon installed on every machine I use on which I'm limited to a terminal. Vim is out of the way.

-2

u/coriandor May 20 '18

I know how annoying vim evangelicals are, but really, you should give it a shot if you haven't put in the time. To me, not spending the 10 hours or so to learn vim well is like not going to the DMV, because walking is so much more intuitive, and you don't want to bother with gas and insurance, and walking is just as fast as driving, right?

3

u/TheBestOpinion May 20 '18

You're in over your head.

It's been a few years since GUI editors stopped being the slow alternative to vim

Sublime has macros, regexes, lots of plugins and native multiple cursors (which vim still doesn't have).

I'm quite proficient with Sublime now and I'm faster with it than some friends who've been using vim for years.

And those friends are the kind of nerds that do vimgolf and they're kind of good at it I guess ? So thanks but there's just no way I'm wasting time to learn vim when there's non-shitty, intuitive alternatives that exist

1

u/SoraFirestorm May 20 '18

Sublime has macros, regexes, lots of plugins and native multiple cursors (which vim still doesn't have).

Nothing you can do with multiple cursors can't also be done with macros. So I fail to see the problem. Apparently it's rather flaky in Vim and not efficient in Emacs owing to how buffers are represented. I've never actually tried any type of multi-cursor functionality, but in light of that, I'll just practice my macro-writing skills.

2

u/TheBestOpinion May 20 '18 edited May 20 '18

The point is doing some of it faster

It allows you to match simple things without having to type a regex, and to do macros on the fly with direct visual feedback. (you can always use a regex and put a cursor on every match though)

It's also slightly more powerful than macros, since you can copy bits of text and paste them, which is often useful for things like this

https://gfycat.com/FluffyWellwornCranefly

I fully integrated these into my work flow.

It's been weeks since I last typed a regex or did a macro.

Cursors solve most problems solved by macros and most problems solved by regexes but they aren't a full replacement for either. They can, however, be much quicker than both of these when applicable (which is pretty often)

Here's a fun one in which you type every time slot of the day; format "Xh-X+1h" separated by a {TAB} character

1

u/coriandor May 21 '18

Oh sublime is my primary editor. I only use vim proper over ssh or for small edits. Sublime text with vi mode is my favorite combination. Multiple cursors plus vim movements is really powerful.

→ More replies (2)
→ More replies (1)

3

u/_lyr3 May 20 '18

Why there is not even ONE terminal that let us copy terminal text without mouse intervention! Just like we can do with Word.

Emacs Terminal do have that feature but lack some importants features as curses.!

9

u/[deleted] May 20 '18

No, wait, vim can do that right? "+y

6

u/_FedoraTipperBot_ May 20 '18

With neovim, if you use the term command you can copy anything you want from the terminal.

1

u/_lyr3 May 20 '18

Cool...

4

u/trueHOVER May 20 '18

Check out tmux.

1

u/_lyr3 May 20 '18

I know that Screen/Tmux help on that!

Both are workaround that we cant always count with...

1

u/[deleted] May 20 '18

I'm not sure what you mean. Ctrl+shift+C (copy, though you need to select something first; xclip can work), Ctrl+shift+V or shift+insert (both paste) have worked well for me to access the system buffer, and in Vim you access it with "+<command> (e.g. "+p or "+yy). I'm not sure how to access the X buffer though without middle click outside vim (in Vim, you repeat the above, but with * instead of +), but I only use it after graphically selecting text anyway, so my hand is already on the mouse.

This has worked in every standard terminal emulator I've used, though some require configuration (e.g. I think rvxt needed some config, but GNOME Terminal and Konsole work OOTB).

1

u/_lyr3 May 20 '18

I mean that feature that both Screen and Tmux of copying selected text not the whole output!

Just like Word, we select some text with Shift, then we copy (ctrl-c) and paste in any other external application!

1

u/[deleted] May 20 '18 edited May 20 '18

Then:

  • select text

  • Ctrl+shift+C to copy

  • Ctrl+shift+V to paste in a terminal app, or Ctrl+V into an external graphical app

Screen and tmux are more difficult to get set up for copying than a regular terminal emulator. In fact, I usually just use the terminal emulator's copy/paste instead of messing with tmux.

You can do this with both vim and emacs, just disable any UI elements in the selection (e.g. set nonumber in Vim). Otherwise, why not just use the editor's built in way of handling copy/paste? You're using the other features it has, so why stop at copy/paste? You can always make this a thing by setting vim's default copy buffer to the system buffer so yy and p work with other programs by default. You can also use the mouse to select text and use y to copy, so there's a built in way to get exactly what you seem to be after, it's just not default because it's not as useful for most people to have it the way you say you want IMO.

0

u/_lyr3 May 20 '18 edited May 20 '18

Care to elaborate

  • select text

That is exactly what I am after and as far I know there is only mouse to select text!

I want an keyboard solution

It aint 1980

Such a feature should be common in every terminal!

Using a mouse is wasting time and counter effective!

1

u/[deleted] May 20 '18

I'm going to describe the vim solution because I don't know emacs very well.

  • press v to enter visual select mode

  • select your text using your favorite movements

  • press "*y to copy into the * buffer (which is the system buffer, which applications like Firefox use by default)

If your copy of vim is compiled with clipboard support, then this will work as expected. Many Linux distributions don't have this in the default vim package, so you may need to install gvim to get CLI vim with clipboard support. You can check by running vim --version and look for clipboard and xterm_clipboard (+ means it's compiled with that feature).

You can set * as the default copy register in .vimrc by setting clipboard to unnamed. Here's a helpful stack exchange answer.

There's a bunch of other magic in Vim as well that really add quality of life improvements, such as:

Undo after closing and reopening file:

set undofile```

Turn on mouse mode (enter visual mode when dragging, move cursor when clicking):

```set mouse=a```

Etc. There are tons of plugins as well that add stuff like autocompletion (like Intellisense in Visual Studio), syntax checking (gives a marker at the line of an error, and prints the error in the status bar when the cursor is on that line), file navigation (like most IDEs have on a sidebar), and even Sublime's multi cursor. Basically, any feature from another editor that I or any of my coworkers have wanted have had a vim plugin.
→ More replies (3)

1

u/look_at_the_sun May 20 '18

Termite supports this. Ctrl+Shift+Space to start selection mode, and then keybindings for moving the cursor, highlighting, and selecting: h/j/k/l or arrow keys for moving the cursor, v for highlighting character-wise, V for highlighting line-wise, and then Enter for copying.

1

u/_lyr3 May 20 '18

Oh, indeed! I recall that!

1

u/r4ib3n May 20 '18

I found copy/paste to not work correctly on some versions of linux. I'll probably stick with Nano until that's fixed.

1

u/tripl3dogdare May 20 '18

This is great! I've never really liked Vim or Emacs, so I'd relied on nano for my command-line editing, but I'll be switching to this right away (though I'll still be keeping VSCode as my main editor, since I don't do that much command-line editing anyways).

0

u/surlysmiles May 20 '18

Looks nice. If I did enough text editing in a terminal I would def check it out

0

u/Mamsaac May 20 '18

I spend a lot of time configuring servers over ssh.

Honestly, I use nano because I don't care about learning vim bindings. This text editor will be a blessing, gonna install it everywhere :) I wish there was a ppa though.

0

u/[deleted] May 27 '18

One, you shouldn't be configuring servers over SSH, you should be using images, containers or provisioning. Two, get acquainted with the tools in every modern Unix like operating system if you spend a lot of time with it, vim is superior to nano

1

u/Mamsaac May 27 '18

Yeah because I don't create images via ssh. I got like 20 aws amis for different purposes and maintain hundreds of servers. Sometimes we can use system manager for sending commands to all instances, but often we have to make specific changes to instances or make changes to amis so that new things happen.

It is very funny how people make assumptions of the workflow of others just because they use a tool.

1

u/[deleted] May 27 '18

I didn't make an assumption, you're doing enterprise management the wrong way and have not demonstrated otherwise.

-6

u/shevegen May 20 '18

I was excited to try it out until I realized I'd need go for it.

So, nah - I stick to nano.

8

u/AngrySoundTech May 20 '18

You don't need anything if you use the prebuilt binary

2

u/jedthehumanoid May 20 '18

Go compiles binaries (just as GCC)

-4

u/Luckystewie May 20 '18

Nice editor, but could you please fix clipboard? I cannot copy paste outside of editor which is a deal breaker (assume not for me only).

3

u/coolreader18 May 20 '18

Install xclip or xsel.

-4

u/Luckystewie May 20 '18

Of course. This is what u do when you install a new product. Install another 5-6 tools to workaround its limitations.

5

u/coolreader18 May 20 '18

Calling it a product is kinda high and mighty of you, it's open source, you didn't pay for it and they're not selling it. It's also not really working around its limitations if there's built in support for it, it's not like a hack or anything. Besides, it's literally just sudo apt install xclip if you're on a debian based distro.

0

u/[deleted] May 20 '18

[deleted]

0

u/Luckystewie May 20 '18

With all my respect. I understand this is open source. To me this looks like a missed functional requirement. Dont remember that vim or any office tool required installation of additional tools to work on text. E.g. grep to search inside texts

4

u/myringotomy May 20 '18

Vim doesn't use the clipboard by default.

0

u/[deleted] May 20 '18

[deleted]

5

u/frozenbrains May 20 '18

FTE - Folding Text Editor. http://fte.sourceforge.net

I use it as my Windows console editor, although it hasn't been updated in years now. I've tried poking through the code here and there, but haven't had the time to put serious effort into it.

3

u/[deleted] May 20 '18

For Linux there's Jed.

1

u/mlk May 20 '18

Them flashbacks

1

u/circlesock May 21 '18

Development has apparently stopped of both xwpe and the fork xwpe-alpha (someone else could in principle fork again and maintain it? maybe they have already), but it's actually still packaged for current linux distros - old code can still work, of course.