Sublime Forum

Insert text every beginning of line

#1

I have 1000 line following like structure texts.

f54g
f5g546
2122v
kjfkjlf
ttt54
ncjkhd8
DFSD5

But i want beginning insert text “Token”.How do insert this text for 1000 lines?

Token f54g
Token f5g546
Token 2122v
Token kjfkjlf
Token ttt54
Token ncjkhd8
Token DFSD5

0 Likes

#2
  • Ctrl+A selects the whole file content.
  • Ctrl+Shift+L let you get cursors on lines of selected regions.
  • Home moves cursors to the line beginning.
  • Type Token_.

Another way:

  • Ctrl+H with regex mode enabled and replace ^ with Token_.
3 Likes

#3

Hey Jack,

I’m not the original poster, but this helps a lot with another little mass edit I had to do. Perfect! Appreciate the RegEx method too! Still learning. Thanks for taking the time & effort to reply!

Cheers man,
–Kudzu

1 Like

#4

I know this is a bit late but in case anyone wants to bind a hotkey for this I have the following as a key binding:

{"keys":["alt+home"],"command":"run_macro_file","args":{"file":"Packages/User/macros/put-cursor-at-the-beginning-of-every-line.sublime-macro"}},

Then in that file, I have the following:

[
{"args":null,"command":"select_all"},{"args":null,"command":"split_selection_into_lines"},
{"args":{"extend":false,"to":"bol"},"command":"move_to"}
]

This makes it so when I hit ALT+HOME it puts a cursor at the beginning of every single line. I have a similar thing set for the end of a file.

0 Likes

#5

That’s a good idea, I know the key combinations, but the less key strokes the better ! :smiley:

0 Likes