This question already has answers here:
Sublime Text 2 multiple line edit
(10 answers)
Closed 6 years ago.
I was using Notepad++ and now I want to use the same cool features in Sublime but I don't know how.
I want to edit multiple lines at the same time like this:
But I don't want to Ctrl+Click at each line for this. I want to click at first line and click at last line for one vertical line.
How I can do this?
First, select multiple lines (by dragging mouse, shift+arrow, etc.). Then, press:
CTRL+SHIFT+L
or on MAC: CMD+SHIFT+L (as per comments)
Alternatively you can select lines and go to SELECTION MENU >> SPLIT INTO LINES.
Now you can edit multiple lines, move cursors etc. for all selected lines.
Use CTRL+D at each line and it will find the matching words and select them then you can use multiple cursors.
You can also use find to find all the occurrences and then it would be multiple cursors too.
Thank you for all answers!
I found it! It calls "Column selection (for Sublime)" and "Column Mode Editing (for Notepad++)"
https://www.sublimetext.com/docs/3/column_selection.html
Related
I have a csv file. Some lines have 7 columns with tab delimited, and others have only one tab. I want to find all lines with only one tab and remove them.
What's the command to do this in VIM? I tried this but it doesn't work:
[^\t]+\t[^\t]+
Assuming you have a single tab or more on every line, this will remove all lines without multiple tabs.
:v/\t.*\t/d
If you have lines with no tabs that you want to retain, this will not work as it will remove them.
This question already has an answer here:
Sublime Text 3 find stops at the end of the file
(1 answer)
Closed 2 years ago.
When searching for a string in Sublime Text 3, I hit Enter to navigate through the results. This stops when I get to the last result, even if there are more results higher up in the file.
How can I adjust the settings so that if I hit Enter when I'm on the last find result in the file, it brings me to the first find result?
I presume there must be some setting to enable this, but I haven't been able to find it.
You need to activate the Wrap option in the options present to the left of your search box (Highlighted below):
I believe your question already has an answer.
Make sure that you tick the Wrap option in the Find bar.
Then it'll wrap around even if you keep pressing F3 or
Cmd + G.
I have 6 huge text files, and i need to filter them by deleting all the lines that doesn't contains the string: 53=S.
For 5 of them, i managed to filter the files with notepad++ as follow:
Find --> Mark --> Bookmark Lines --> Mark All --> Search --> Bookmarks -- > Remove Unbookmarked Lines
However, the application collapsed for a specific file each time i tried it. I tried it in two PCs with the same result.
Anyone know how can i remove the irrelevant lines with Sublimes or any other tool?
You could try a regular expression replace in notepad++.
Using notepad++, press ctrl+h or bring up the search>replace window.
In the 'find what' text box enter ^(?m)^(?:(?!53=S).)*$
and leave the 'replace with' text box empty
Make sure the search mode is set to 'Regular Expression' and then hit 'Replace All'
This should remove any line that doesn'tcontain the string 53=S
There is a notepad++ plugin called LineFilter (not LineFilter2), which provides a menu with entries like
delete all lines containing the selection
delete all lines not containig the selection
it opens a new tab with the result. That worked on large files. I liked it a lot.
The plugin is available from Notepad++ Plugin Central.
If you have grep available, then grep should do the trick, too.
Below is a screenshot of me entering visual block mode and pressing "w" to select by word:
How can I select every word in the rows I have selected? Meaning I want the full word in the rows highlighted instead of it getting cut off as shown in the screenshot.
edit: What I want to be able to do is delete a column of words of varying length. In the example screenshot I want to delete the words between the tags, But it could be any column of words.
There are a bunch of plugins for multiple selection, look them up on vim.org.
But I must remind you that visually selecting text is more often than not an unnecessary step. Why don't you explain what you actually want to achieve instead of your failed attempts? Maybe there's a better way...
[edit]
:'<,'>norm dit
seems to be the simplest way to achieve your goal without selecting every word:
and :,+7norm dit would be even better because you don't select anything.
The highlight modes can only select blocks (by cursor, by line, or by rectangular block). You can use a plugin such as vim-multiple-cursors to do what you are trying to do.
The only place where Vim allows a non-rectangular, "jagged edge" visual selection is at the end of the lines, i.e. by extending the blockwise selection with $. Therefore, you'd need to (temporarily) get rid of the trailing </th> (or include it in the selection, but operate in such a way that they are kept intact).
You shouldn't need a selection to work with the text. For example, to delete the text inside the tags, you can use a substitution:
:%s#<th>\zs.*\ze</th>##
You can't. You can only select rectangular blocks in block select mode. Maybe a plugin solves this?
Can I do multiple select same words in Vim as that was in Sublime text 2 with command ctrl+D and then edit selected words?
Yep! Check this out: vim-multiple-cursors
No you can't but someone is working on it.