terminal cut and paste
When cut and pasting from terminal into another text document, the terminal formating / colors, also get copied and pasted. I just wantt the text. This was not an issue in Mountain Lion.
Anyone know how to fix?
When cut and pasting from terminal into another text document, the terminal formating / colors, also get copied and pasted. I just wantt the text. This was not an issue in Mountain Lion.
Anyone know how to fix?
If you spend enough time in a terminal emulator and do a lot of copy/paste from the terminal session to other documents, then consider iTerm2 <http://www.iterm2.com/>
Otherwise practice Command-Shift-Option-V
or get a hotkey utility, such as BetterTouchTool <http://www.boastr.net/>, and associate Command-V with Command-Shift-Option-V for the apps where you frequently paste from the Terminal.
That does the trick, thanks tkarabian. I also tried:
defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.attributes
Which switches it on again.
Where did you get this information from, is there a book of magic somewhere out there???
The following will prevent text attributes from being copied from terminal.
Open Terminal on your Mac and enter the following command:
defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.no-attributes
Like several of the people here I use terminal with colors, in my case white text on black translucent background, since i spend many hours in terminal and its easier on the eyes in my opinion.
But when I need to send and email to someone, I can’t give them a random block of white text on black background. And though pasting and matching style is useful, if you have to do it hundreds of times a day the awkward configuration of the keys does become very annoying.
sieburgh wrote:
Where did you get this information from, is there a book of magic somewhere out there???
Defaults are settings in plist files (mostly of the app, but there are global ones too).
You can examine them with (for example)
defaults read com.apple.Terminal
The general format is
defaults read com.<vendor>.<app name>
You can play with what you find ( you are of course NOT doing that without being backed up so you can easily restore ) with
defaults write com.<vendor>.<app name> [property] [value]
However, examining the plists will only show you what properites have already been set and their value. If the property has never been set, you won't see it. In those cases, only the developer really knows what's available. With Apple stuff, that might be documented somewhere, or the lore might have been passed down through the internet somewhere, like here.
EDIT: I should add that, particularly on Mavericks, most (though not all) changes to defaults require log out and log in for the changes to take affect.
sieburgh wrote:
That does the trick, thanks tkarabian. I also tried:
defaults write com.apple.Terminal CopyAttributesProfile com.apple.Terminal.attributes
Which switches it on again.
Note that the above command is setting the preference to an invalid value, which means it is ignored and you get the default behavior (which is to copy the attributes of the current terminal). The preference value must be either a profile name or the special value com.apple.Terminal.no-attributes. "com.apple.Terminal.attributes" is an invalid value.
This preference is normally controlled via Terminal > Preferences > Settings. See action ("gear") menu item Use Settings for Copy. You can select a profile in the list, then choose that menu item to make it the "Copy" profile. You then have full control over what attributes are copied. For example, you can turn off ANSI colors and they won't be copied.
For most people, the issue is merely that the background color is copied. You could set this preference to "Basic" and then you'll always get black-on-white text.
But if it's still an issue for you that the font/size is copied, you can always customize the command key for Edit > Paste and Match Style to make it easier to type. For example, you could set it to Command-P.
Note that com.apple.Terminal.no-attributes isn't officially supported and isn't accessible via the Preferences UI.
"thanks guys for this "defaults" command. It was really frustrating before. Apple should at least give acces to this attribute via preferences."
Terminal > Preferences > Settings. See the action ("gear") menu item Use Settings for Copy. You can select a profile in the list, then choose that menu item to make it the "Copy" profile. You then have full control over what attributes are copied. For example, you can turn off ANSI colors and they won't be copied.
For most people, the issue is merely that the background color is copied. You could set this preference to a profile with a white background, e.g., "Basic", and then you'll always get black-on-white text.
But if it's still an issue for you that the font/size is copied, you can always customize the command key for Edit > Paste and Match Style to make it easier to type. For example, you could set it to Command-V.
“A terminal is a text-only application.”
Terminals have been rich-text devices since even before ANSI colors were invented. Terminal emulator applications should always copy the formatting, which is user data. User data should not be discarded by default. It was an obvious bug that Terminal didn't copy attributed text, and the many people who asked for it to copy rich-text though so, too. Copying plain-text only is the thing that should require customization, and you can in fact customize Terminal to do so:
Most people who are complaining about this are complaining about the background color being copied. Terminal has a preference to let you set the profile to use for copying. If you set it to "Basic", for example, you'll always get black-on-white text with no background color. And you can customize the profile to, say, disable ANSI colors if you really don't want that user data.
"I DO NOT want to use any other cut/paste key."
You can customize the key in System Preferences > Keyboard > Shortcuts > App Shortcuts to whatever works for you. For example, you could assign Command-V to Paste and Match Style.
All we ask is have Terminal -> Preferneces allow us to only copy text as it did in previous version.
I stand by the fact that Terminal is a text-based app. We should not needto limit our font, background, etc, to use Terminal in a way that permits us to copy text only.
To force people to go through Hoops to Google search for ways around this is a Pain. Regardless if this is a bug or not, it is a poor design. Forcing end users to issue defaults commands (that are hidden) and create keyboard shortcuts exemplifies the design, as it stands, is an issue. The users don't like it and therefore it should be changed. Why change something so important and not put it in Prefs. ?S*@^&@
Try: ⇧⌥⌘V
Not just TextEdit.
⇧⌥⌘V is Paste and Match Style for most Apps (MS Word, Pages, Mail, etc...)
It's one extra key located right next to one you are already pressing. I really don't see that has a hardship
I hate that this changed too. but i will just remap ⇧⌥⌘V to ctrl-b or something.
Re-map ⇧⌥⌘V to another key combo 🙂
To strip styling from the clipboard use Applescript:
set the clipboard to «class ktxt» of ((the clipboardastext) as record)
Enable the Applescript Menu and add the script.
➕ Great tip, thanks! Upvote given.
terminal cut and paste