Using command as ctrl in a Mac OS X terminal [closed] - macos

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'd like to have my command key work as a ctrl key in the Mac OS X terminal. That is, I want "command-c" to do the same thing as "ctrl-c". Does anyone know of a way to do this?
Specifically, I would really like this to work in emacs. Emacs uses a LOT of ctrl key bindings and reaching for the control key is beginning to strain my wrists. You may say that the command key is actually harder to reach, but I've swapped the command key and the caps-lock key on my MacBook Pro to make that easier.
Any help is appreciated!

I don't think that you can have the same key act as both command and ctrl, and I don't think that there's a way to override the keys for a specific program, at least not without a third-party program. Personally, I recommend having the command key once again be the one with the apple/command label, and using caps lock as your ctrl key as Emacs commands are more complicated (and require pressing multiple keys with ctrl held down).
By the way, if pressing the command key is difficult, you're probably trying to do so with your pinky and not your thumb.
As a side note, if you are using Emacs in the terminal, you may be interested in using option as meta. If you want to use your command key as meta, you can check out Carbon Emacs. It doesn't run in the terminal, but it might fill your needs.

You could (in Leopard) map the Caps Lock key to act as control for all apps.
System Preferences->Keyboard and Mouse->keyboard Modifier Keys button at bottom

Perhaps you could hack http://doublecommand.sourceforge.net/ for this purpose.

I don't think this is possible because the command key is already mapped to a bunch of system-level shortcuts. For example Cmd-C is copy, Cmd-X is paste. I don't think an application can override those system commands.

Related

How to make an exe in cmd from a .py not close the window when it ends? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 27 days ago.
Improve this question
I'm traying to make an app, its too many lines to output here a simple version. I don't know if there is something wrong with the dll's or the .py, with auto-py-to-exe I made it an executable,& it gave some errors (torch libreries not found), but when running the program (exe), it doesn't seem to have any problem (it runds as the py program in the terminal).
So, does the terminal closes by its own when the script is finished? if so; how can I make the program not close till I press a key or force the close?
If the terminal doesn't close by it's own, could those dll be the problem?
Please let me know if the terminal closes by its own (the script is very slow and it takes 45 min for me to see if it works or not).
Thanks.
I've uninstalled and installed torch and torchvision modules (but there's always an errors with some libreries)
The solution I'm going to use is:
import os
......
os.system("pause")
Python has a builtin function input that allows you to customize the prompt that the user will get:
input("Press enter to exit.")
This will show the prompt Press enter to exit.

emacs: key binding for expand region [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
One of my favorite emacs plugins is expand-region.
It selects block code in a smart way. Their ready recommends binding
the key C-= to expand-region. However, in the Mac OS terminal, C-= is not passed to the application by the OS.
So what two key combination can I use on OS X ? (It has to be quickly pressable , because I use expand region almost every minute)
The reason you are unable to use C-= is because you have an OS X shortcut which is using that key binding. You could either disable that shortcut or move it to another key binding, which would allow you to use C-= in emacs.
I'm running Emacs in a GUI window under OS X (El Capitan) and have C-= bound to expand-region.
If your running in a terminal, it is possible the terminal could also be stealing that key binding, so if you find nothing which matches in preferences -> keyboard -> shortcuts, then look in your keyboard preferences.
In general, they way I find available keys to bind in emacs is to do the following
List current key bindings with C-h b and look to see what is already used and identify an available binding.
Use C-h k to verify the key is not bound and to verify the OS will pass it through. If nothing happens, they key is being stolen by the OS or terminal, in which case, either you choose another key or disable the binding at the OS/Terminal layer.
Once you have identified the key binding to use, use either global-set-key to define it globally, or a local key map and define-key to define it in a specific mode.
I tend to use emacs a lot under OSX and therefore, disable many of the OSX shortcuts so that I can use the keys inside emacs. As I work on both Linux and OS X, I like to try and keep my key bindings for emacs the same across both platforms.

Curiosity about executing binary [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
This is just a curiosity of mine about how a specific OS executes a binary file.
If I change dir to some path in UNIX or Windows I can execute a program just by entering its file name. In Linux I have to enter ./file_name (unless it's included in PATH). In know it's kind of a stupid question, but is there any reason for that?
Nothing magical - it's simply because, by default, Windows implicitly includes '.' in the executable search path. *nix does not.
The latter behavior is obviously more secure, if marginally less convenient.
You can obtain behavior similar to Windows under *nix (at some cost in security) by adding '.' to your path
For example, you could add the following to your .bash_profile:
export PATH=PATH:.
Of course, that's not exactly the same as Windows, as Windows (again, by default) looks in the CWD first. You could do the same in *nix by moving the '.' to the front of the system's PATH, but don't do that!
It opens you up to a large security risk. If someone were to be able to drop a malicious program with the same name as a system utility (say "ls", or "cp"), that program would run instead of the system utility. You can imagine the potential for "mischief" that provides!
To expand on what Gregj said, there is a PATH variable in both Windows and Linux, which tells the operating system where to look for executables when you don't tell it explicitly where it is. Linux doesn't include the current directory (.) for security concerns; a program could otherwise hide an executable with the name of a common utility (ls, for instance) in a lot of files so you might overlook it, and then it would be run instead of the utility you meant, potentially causing damage, loss of sensitive data, etc. Windows does search ., even if it's not explicitly in the path, for convenience and because of their lack of concern over security.

How to Open Terminal Window Automatically on Mac OS X [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
On my Mac, there is no window open when I start Terminal app. I just played with a friend's Mac, a window is automatically opened on startup of terminal. He doesn't know how it's done. I just played with preferences and couldn't find anything for that. Does anyone know how to do that?
I'm just grasping at straws here: is it possible that your Terminal program is always running in the background, and you are not actually completely exiting? You can perform this test: Run Terminal in whatever manner you usually do, and then press Command-Q to quit the application completely. Now run Terminal again. Did it open a new window?
The Mac has a slightly different paradigm on open/closed applications, namely that closing the last window doesn't actually quit the application. Combine this with the fact that Mac users rarely ever actually reboot their computers, and it's easy for relatively novice Mac users to have many applications that are simply running in the background that are never closed completely.
Just a shot in the dark. If you are for sure exiting the app completely than I can't think of a solution for the problem either.
Create a Windows Group
Go to Preferences -> Start, and select the windows group to open on start up
From the Terminal App, choose Preferences: select Startup and verify that the "On startup, open new window with settings:" radio button is selected and select Basic from the pull-down menu. That's all I have and it starts up with an open window for me.
If you've tried all the above suggestions, see if anything weird is appearing in your console. Open up /Applications/Utilities/Console.app and watch the "All Messages" log while you open Terminal.
You could try one of the other terminal apps that are out there for Mac. I prefer iTerm, it's free and works very well. It also gives you nice features like tabs, color schemes and fullscreen terminals.
You can also try this out, it is a Ruby gem that lets you automate opening mutliple tabs that run preset scripts or commands: https://github.com/Achillefs/elscripto

Overcoming "It is being used by another person or program." [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there a way to unlock Windows files without downloading a utility?
I have a few files on my Windows XP C: drive that are very old and very useless. When I try to delete these files I get the following message:
Cannot delete FILENAME.zip: It is being used by another person or program
Close any programs that might be using the file and try again.
No one is accessing this file. No program is using it currently. Windows has screwed up the file locking mechanism.
Is there a way to delete this file without downloading someone's unlocking utility? I find the sites offering these programs to be a tad sketchy.
How could you force the file to unlock from within a program? I'm competent in Java, Perl, and Ruby, but I haven't seen anything among their libraries that would aid me here.
I've successfully used Process Explorer to find out which process has the file open. It saves a reboot that may not fix the problem anyway.
In process explorer: Find > Handle or DLL... then search for the name of the folder/file, then double click one of the search results. It'll select a handle in the main window, which you can right click and close.
Try downloading "Unlocker". Google it and take my words that it doesn't have any worm/spyware/virus. It is pretty cool utility and works great. Give it a try.
Did you try the commandline command OpenFiles
It is built in (XP and above I believe) and has several arguments that can be passed in.
Use msconfig and start up with everything turned off.
Then try to move / delete the file.
Or you can always boot up in safe mode and delete it.
You do that by hitting f8 when the machine boots up.
If you reboot and the files are still locked, then there is some process on your machine that is still using them. First you should figure out what that process is and determine if the files really aren't used any more or not.
Rebooting to Safe Mode is often a very easy way to do it. When you boot in safe mode, it won't load all the stuff set to run on startup. Press F8 while it's booting to access the boot menu, and choose "safe mode".
I had a .jpg pfile that hasd that issue and I couldn't delete. That brought me to this thread. When nothing else worked I renamed the file and left off the .jpg. THEN I could delete it easily. Not sure why, but worked for me
You don't need any utility.
Just use Win32 api to unlock them (simply close the handle)

Resources