90

I'm trying to do a case-sensitive search in Nano. The help menu at the bottom of the screen says I can toggle case-sensitivity by typing M-C.

^G Get Help         ^Y First Line       ^T Go To Line       ^W Beg of Par       M-J FullJstify      M-B Backwards
^C Cancel           ^V Last Line        ^R Replace          ^O End of Par       M-C Case Sens       M-R Regexp

I'm not sure how to do this. Does M- refer to a modifier key that should be held while I type C? Or does M- mean I should press some key or key combination before hitting C?

dB'
  • 7,838
  • 15
  • 58
  • 101
  • I notice that I'm getting close votes. Would this question be more appropriate for unix.stackexchange.com? Should I delete this and repost there? – dB' Oct 09 '14 at 18:53
  • 2
    Probably superuser.com would be best. Technically, it depends on the terminal emulator you are using. – chepner Oct 09 '14 at 19:01
  • 1
    Alright. If it gets closed I'll throw it up on superuser. – dB' Oct 09 '14 at 19:03
  • 1
    Once upon a time there was a thing called a Lisp machine. It was very much pertinent to programming, but today it gets a downvote and ignored. "Most of the people who do what we do are not aware of where this stuff came from, not aware of their own craft. We have no sense of history, really, in software. Part of that is because it turns over so quickly, but part of it is that we’ve forgotten all this important knowledge." - Douglas Crockford on HanselMinutes. http://hanselminutes.com/396/bugs-considered-harmful-with-douglas-crockford – David J. Liszewski Oct 09 '14 at 19:20

3 Answers3

118

M refers to the meta key, which is not present on most keyboards. (Its use in software is for primarily historical reasons.) Usually, the meta key is emulated by another key on your keyboard. On Windows and Linux, it is usually the Alt key. On Mac OS X, that key (aka Option) already has other uses, and so Escape is used instead.

chepner
  • 497,756
  • 71
  • 530
  • 681
  • 10
    Well, escape followed by C, but yes :) – chepner Oct 09 '14 at 19:00
  • I'm trying `M-?` combination in midnight commander on Ubuntu 16. But when I press `Alt`, the Ubuntu menu in the top of the screen activates. So the combination doesn't work: MC doesn't start a file search which the combination stands for. – Serge Rogatch Sep 14 '16 at 19:48
  • 3
    Got it: in this specific case I had to press "Shift" too. – Serge Rogatch Sep 14 '16 at 19:49
  • Right; it all depends on what you need in order for the terminal emulator to send the correct "keys" on to the program it is running. – chepner Sep 14 '16 at 20:03
  • 2
    @serge when using graphical terminal, it will most likely capture the `ALT` key for its own shortcuts. `SHIFT` sometimes helps, but not always. The only consistent workaround is to use `ESC` for the meta key. – wisbucky Mar 15 '17 at 01:37
  • This helped me toggle backwards search in nano. Thank you! It was indeed the `ESC` key. How unintuitive... Suppose they ran out of options. – MTarantini Mar 31 '17 at 17:53
  • on a mac, the proper sequence is: c not: m c – dave campbell Oct 06 '22 at 13:47
6

I do not know for nano, but for emacs, M- stands for the Meta key, which can mean pressing the Alt key simultaneously with the letter key or by pressing Esc key before the letter key. Alt generally only works when using an X version of the application, so when using a dumb terminal, only Esc will work.

Community
  • 1
  • 1
6

Esc

For instance, if you wanted to go to the end of the file press

Esc then /

You don't need to hold down Esc as if it were Shift.

Travis Heeter
  • 13,002
  • 13
  • 87
  • 129