How can I execute an action n-many times in TextMate (both Emacs and Vim can do this easily!)?

Emacs : C-U (79) #& raquo; pretty 79 character length delimiter

VIM : 79-i-#& raquo; see above

Textmate : ????

Or is it just supposed that we will make a call to Ruby or somewhere snippet?

+3
source share
3 answers

I would create a bundle command for this.

You can select the editor as the input to your script, and then replace it with the result of the execution. This command, for example, will accept the selected number and print the "#" symbol so many times.

python -c "print '#' * $TM_SELECTED_TEXT"

Of course, this example does not allow you to specify a symbol, but it gives you an idea of ​​what is possible.

+2

python -c "print '#' * $TM_SELECTED_TEXT"

, , .

, - , tab trigger - '--', , - :

`python -c "print '_' * $TM_COLUMNS"`

, --⇥ ( ), .

, , vim, , . , .

+1

. :

`python -c "print ':'.join('$TM_SELECTED_TEXT'.split(':')[:-1]) * int('$TM_SELECTED_TEXT'.split(':')[-1])"`

, . CTRL-SHIFT-R

-x:4, (, ), "-x-x-x-x".

::4 "::".

The repeated string is enclosed in single quotes, so to repeat 'you need to use \.

+1
source

Source: https://habr.com/ru/post/1696881/


All Articles