Mac OS X 10.8.2 Mountain Lion
~/.bash_profile: currently empty, but compatible with test in #1 below.
yields no result, although
alias helpme='echo goodie'
works, just fine and yields expected result.
if I then type
the result is
alias helpme='echo goodie'
I then unalias
, as this is just a test.
I have found that pressing and holding \[ESC\] prompt me to see a list of commands and aliases (including any I just made).
However, if I attempt to look at the definition of a (system-wide/default) alias, then I get, for example:
-bash: alias: pico: not found
I have a) verified this is listed in the 1500 commands/aliases via escape, found the alias file in /user/bin/pico, and I use it all the time because i first got my feet wet with *nix 10 years ago, and none of the platforms I used were running nano
appears to be identical (minus whatever flags are there in the alias) to
but I don't know which flags are being used of course with the alias pico
#2) I would like to have man
instead of less
when I'm browsing man pages. I would like to do this for a couple reasons, one is so I can easily copy all the text to a GUI text editor, then work with it in my preferred program.
actually uses less -is
(ignore case, and squeeze blank lines respectively).
So when I man less
I get this:
On line 724, which is fantastic, it says:
"You may define your own less commands by using the program lesskey (1)"
However, looking at https://developer.apple.com/library/...lesskey.1.html
Lets me see that:
WARNING: This manual page does not exist in the currently shipping version of OS X. This can happen for two reasons:
It may have been renamed or combined with another manual page.
The technology in question may no longer be supported.
You should investigate the availability of this technology before relying on the contents of this page.
Well, thanks a lot apple for telling me to "investigate"... I have, needless to say, done a lot searching about this. I have looked at stackexchange sites, searched and read results from about 10 different angles, and I have found nothing that addresses this for this platform.
So I went ahead and created the $HOME/.less file and put it
and I've also substituted "TRUE" for "1". I have quit shell, and opened a new one, to no avail (this reloads my .bash_profile, so I assume (possibly foolishly?) that this would essentially work in this case as well.
Also, I found it confusing in this section, but maybe it just means I can't do this anyjmore? line 724:
You may define your own less commands by using the program lesskey (1)
to create a lesskey file. This file specifies a set of command keys
and an action associated with each key. You may also use lesskey to
change the line-editing keys (see LINE EDITING), and to set environment
variables. If the environment variable LESSKEY is set, less uses that
as the name of the lesskey file. Otherwise, less looks in a standard
place for the lesskey file: On Unix systems, less looks for a lesskey
file called "$HOME/.less".
Then I put the line:
in my ~/.bash_profile document, but to no avail. I sourced it, after a failed test, but apparently I don't need to as overwriting the file and exiting nano seems to work just fine (I tested changing my $HOME var).
So, no idea where to go from there. So I also tried something else:
I was also playing around with the /private/etc/man.conf
file, and saw that these two lines might be easily changed to fix this issue. So I changed lines: 105-106 which read
PAGER /usr/bin/less -is
BROWSER /usr/bin/less -is
to have "more" instead of "less -is".
This worked, mostly.
Now my man pages remain visible from the top to wherever I have paged down to so far, and then more exits with my final next-page command. Good enough.
Of course this started out with me wanting to use an alias for the man + more
combination which was going to be a syntax problem for me to solve, but I found it to be a little more complex. This is still my preference however, because currently I am changing the behavior of man
I then found that killing a man
command with control-\ yielded this:
( cd '/usr/share/man' && /usr/bin/tbl /usr/share/man/man1/builtin.1 | /usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | ( /usr/bin/less -is || true ) )
as a note this also seems to screw up my input and cause what I type not to appear on the screen, and hitting return with a blank prompt creates a prompt on the same line instead of the next like usual. and I have to
investigating further by reading man man
then man man.conf
I came across the relevant two lines.
A question I have related to this is: is it generally not
a good idea to edit files in /private ?
I've edited the hosts file (/private)/etc before to stop from connecting to ad servers. But beyond that, I'd rather not even do that system wide actually.
So I guess I may have a partial, though not ideal solution to #2. But I would still like to be able to find out the definition of an alias, and ideally... make more complicated aliases than l='ls -l' (very annoying that this is not a default alias on Mac if you ask me).
Why don't I just use something like:
man man >> myfavmanpageatm
because, then I look at that file with nano
and it looks like this:
man - format and display the on-line manual pages
m^Hma^Han^Hn [-^H-a^Hac^Hcd^Hdf^HfF^HFh^Hhk^HkK^HKt^Htw^HwW^HW] [-^H--$
[-^H-M^HM _^Hp_^Ha_^Ht_^Hh_^Hl_^Hi_^Hs_^Ht] [-^H-P^HP _^Hp_^Ha_^Hg_^He_^$
[_^Hs_^He_^Hc_^Ht_^Hi_^Ho_^Hn] _^Hn_^Ha_^Hm_^He _^H._^H._^H.
m^Hma^Han^Hn formats and displays the on-line manual pages. If you spec$
_^Ht_^Hi_^Ho_^Hn, m^Hma^Han^Hn only looks in that section of the manual.$
the name of the manual page, which is typically the name of a command,
function, or file. However, if _^Hn_^Ha_^Hm_^He contains a slash (/^$
and even worse, when it gets to sections with flags,
the flags are all repeated, so it looks like:
-ii ignore case
-ss squeeze lines
EDit: I have figured out that those symbols can be read by 'more'... so, is there a way to remove those and have it readable by nano?
May Loki help me, I know this is a long one...