Is there a 'copy' command that will copy the current line but only from...

I like using ctrl-c from anywhere on a line to quickly copy the line, but what I'd really like is a way to quickly copy a line that doesn't include the white indented space before(or after) the line. I'd like to copy from only the start of the line to the end (which helps for when I paste it somewhere else that has different indentation or maybe even within another line).

I looked through many of the keybindings but didn't see a way to quickly copy just the text of a line (start of line to end minus any whitespace).

0
2 comments
Avatar
Permanently deleted user

Hello Rick,

R> I like using ctrl-c from anywhere on a line to quickly copy the line,
R> but what I'd really like is a way to quickly copy a line that doesn't
R> include the white indented space before(or after) the line. I'd like
R> to copy from only the start of the line to the end (which helps for
R> when I paste it somewhere else that has different indentation or
R> maybe even within another line).
R>
R> I looked through many of the keybindings but didn't see a way to
R> quickly copy just the text of a line (start of line to end minus any
R> whitespace).

I don't think we have an existing binding for that, but that sounds like
a very good application for our under-used macro feature (Tools | Start Macro
Recording).

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Avatar
Permanently deleted user

Rick> I'd like to copy from only the start of the line to the end (which helps for when I
Rick> paste it somewhere else that has different indentation or maybe even within another line).

What's your setting for IDE SEttings->Editor->Paste->Reformat: ?
I thought by default, if you paste a line, it will reindent it to the proper level.

You can "Select Line at Caret" (No Keybinding by default) to select entire line, and then "Unselect Word at Caret" (CTRLSHIFTW) to unselect the whitespace at beginning and end, and then Copy (CTRL+C).

You could try to make that into a macro and bind a key to it.

0

Please sign in to leave a comment.