Hi, all,
I'v been a Vim user for a long time. There's a shortcut 'dd' in vim command mode to cut a line, then use 'yy' to paste it. I haven't found any corresponding way to make this done in textmate, could anybody here give some advise? Thanks in advance.
Regards,
On 13.10.2008, at 05:40, Steve Chu wrote:
Hi, all,
I'v been a Vim user for a long time. There's a shortcut 'dd' in vim command mode to cut a line, then use 'yy' to paste it. I haven't found any corresponding way to make this done in textmate, could anybody here give some advise? Thanks in advance.
There're several ways.
-SHIFT+APPLE+L to select entire line -CTRL+APPLE+ARROW_UP/DOWN to move line
or record a macro: -SHIFT+APPLE+L to select entire line -APPLE+X to cut
then with APPLE+V paste
--Hans
On Mon, Oct 13, 2008 at 5:40 AM, Steve Chu stvchu@gmail.com wrote:
Hi, all,
I'v been a Vim user for a long time. There's a shortcut 'dd' in vim command mode to cut a line, then use 'yy' to paste it. I haven't found any corresponding way to make this done in textmate, could anybody here give some advise? Thanks in advance.
There might be others ways to do it, but macros are simple:
- Start Recording a macro (Look in Bundles > Macros) - Type ⇧⌘L (Edit > Select > Line) - Type ⌘X (cut) - Stop Recording macro - Save Last Recording (e.g. in YourName's Bundle) - Uncheck "Use local clipboard (...)". Important if you want to be able to paste it after. - Give it an unused key equivalent (the hardest part ;). I use ⌘⌥X.
Now cut lines. ;)
Regards.
-- FredB
It will be very nice if there is a official shortcut as Fred said '⌘⌥X'. Because this situation is very common in daily programming. Thanks, guys.
On Mon, Oct 13, 2008 at 2:34 PM, Fred B fredb7@gmail.com wrote:
On Mon, Oct 13, 2008 at 5:40 AM, Steve Chu stvchu@gmail.com wrote:
Hi, all,
I'v been a Vim user for a long time. There's a shortcut 'dd' in vim command mode to cut a line, then use 'yy' to paste it. I haven't found any corresponding way to make this done in textmate, could anybody here give some advise? Thanks in advance.
There might be others ways to do it, but macros are simple:
- Start Recording a macro (Look in Bundles > Macros)
- Type ⇧⌘L (Edit > Select > Line)
- Type ⌘X (cut)
- Stop Recording macro
- Save Last Recording (e.g. in YourName's Bundle)
- Uncheck "Use local clipboard (...)". Important if you want to be
able to paste it after.
- Give it an unused key equivalent (the hardest part ;). I use ⌘⌥X.
Now cut lines. ;)
Regards.
-- FredB
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 13.10.2008, at 08:41, Steve Chu wrote:
It will be very nice if there is a official shortcut as Fred said '⌘⌥X'. Because this situation is very common in daily programming.
Well, for at least it's more likely to move not only one line, thus to select something and to move the whole bunch (CTRL+APPLE+ARROW_UP/DOWN/ RIGHT/LEFT) is more flexible. But this is the power of TM if you have your preferences well create your own environment ;)
--Hans
Otherwise, there is Control-K/Control-Y. Control-K cuts the current line starting from the caret, Control-Y pastes it back. Not exactly what you need, but it works in at least one other app (TextEdit). Please note that it does *not* use the pasteboard and as a consequence it cannot be used between different applications.
Édouard GILBERT edouard.gilbert@gmail.com
Le 13 oct. 08 à 08:46, Hans-Jörg Bibiko a écrit :
On 13.10.2008, at 08:41, Steve Chu wrote:
It will be very nice if there is a official shortcut as Fred said '⌘⌥X'. Because this situation is very common in daily programming.
Well, for at least it's more likely to move not only one line, thus to select something and to move the whole bunch (CTRL+APPLE+ARROW_UP/ DOWN/ RIGHT/LEFT) is more flexible. But this is the power of TM if you have your preferences well create your own environment ;)
--Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Its really simple to make it smart and use the CMD-X key (dual purpose).
Create a command called "smartcut" with the following:
#! /bin/sh # if [ "x$TM_SELECTED_TEXT" = "x" ]; then text="$TM_CURRENT_LINE"; else text="$TM_SELECTED_TEXT"; fi
echo -n "$text"|pbcopy
Set the input to "Selected Text" or "Line" and the output to "Replace Selected Text". Then set the Key Equivalent to CMD-X
The standard CMD-V will paste the whole like back.
-- dv