Is there a way to disable the default behaviour of ctrl+enter in find and replace in vscode? - visual-studio-code

VScode has an annoying feature where it adds a new line into the text box during find and replace when I press ctrl+enter. I would like to use the keyboard shortcut ctrl+enter to replace all, but when I configure it that way in keyboard shortcuts, it is still inserting a newline before replacing, adding an extra newline to every match that is replaced. Example:
Find: "foo"
Replace: "bar"
Before:
foofoofoo
foo
Expected result:
barbarbar
bar
Actual result:
bar
bar
bar
bar
This is highly infuriating since I've already become accustomed to this keyboard shortcut and it is disrupting my normal workflow. Does anyone know how to fix this?

Use CTRL+K+S , you will get list of all defaults.
Change whatever you want from the first option in the line of edit.

This issue is now fixed in at least 1.67, probably a version before that.

Related

How to set vscode to display the number of selected lines?

Who knows how to set vscode to display the number of selected lines? Just like NotePad++, when we select many lines, we can see how many lines selected in the lower right corner, thanks!
Try this extension: Selected Lines Count
Without an extension, you have to resort to a workaround: use the command Add Cursors to Line Ends and observe the selection count. The default shortcut is Shift+Alt+I (i, not L).
Surely, you can find an extension. Till now, you can see in the Status Bar, how many characters you have selected. Take a look, at some extensions here.

Sublime text paste joined multicursor

I am looking for a Sublime Text 3 plugin/snippet that allow me to paste a multicursor selection where lines are joined to eachother with a separator I am defining right away.
For example, let's say I have those lines in my clipboard:
foo
bar
baz
When pressing the command, it would be pasted, and I would have a multicursor selector between each item:
Then I can write my separator:
Additionally to separators, I could also set data in the beginning and in the end or each item:
and then, after pressing tab:
Ideally, pressing tab would circle on the different muticursors:
separatorCursor <=> beginingCursor <=> endCursor
Do you know any plugin that does what I'm looking for?
Thank you
The absence of answers seemed to indicate that no such plugin exists yet, so I made my own.
https://github.com/OoDeLally/MultiCaretPaste
So far it only manage central separator. I don't know yet how to circle through TABs as indicated in my original post.

How to use tabs instead of spaces for other than indenting in Eclipse neon?

I want to use the tab character rather than the set of spaces in every opportunity that presents itself. In Eclipse helios, this was not a problem. Eclipse did not attempt to change anything but the indentation, and that setting was settable. Now, I will go from:
...
(tab)/**
(tab)*(cursor)
...
then I will hit the tab character with my cursor where shown, resulting in:
...
(tab)/**
(tab)*(space)(space)(cursor)
...
Anyone know why this might be and how to prevent it? The single most annoying application of this problem is when I copy a tab character and paste it somewhere else, it shows up as a set of spaces.
Note: I can overcome this via ctrl+f and replace, but that is so annoying to use after the fact. I am looking for something that prevents that from being necessary in the first place

How can I convert tabs to spaces and vice versa in an existing file

I cannot figure out how to do this for the life of me apart from doing a find-replace on 4 spaces and converting to tabs (Version 0.10.2). I can't think of an editor/IDE that doesn't have a specific feature to do this. Does VSCode?
Since fix of: https://github.com/Microsoft/vscode/issues/1228 the editor supports it out of the box. Simply go for:
F1,
indentationToSpaces or indentationToTabs (depending on your need)
Enter.
Another way to do it is click the current indentation (Tab/Spaces:n) on the footer which will open your indentation options where you can select what you want to do.
If you are trying to convert non-leading tabs to spaces (or vice versa) you can use a regex search and replace.
Press CTRL + H
Click the .* button to search using regular expressions.
To search for tabs enter [\t] in Find box.
Enter spaces in Replace box and perform your replace.
Search box in regex mode:
To round out these answers, I will add my take for converting each tab to n spaces.
Highlight a tab character
Use CTRL + F2 select all occurrences
Press SPACE n times
This is the easiest way to do this (going beyond only converting leading tabs).
Note that this does not convert consecutive tabs to k spaces. It converts each tab. For consecutive tabs please see my comment on jrupe's answer. You will need VS Code find and replace with regular expressions to accomplish that.
Select Replace: CTRL-H
Enter Horizontal Tab in Find box: hold ATL and type 009 on the keypad.
Enter a space(or more spaces) into the Replace box: press space bar
Press Enter to begin replacing Tabs with Space(s).
Press F1 and then type into textbox convert indentation to spaces or whatever you want ones
On Visual Studio, Ctrl+K+F did the trick for me.
Fast forward to 2020/2021, there are some extensions that will give us that conversion. I have just needed that functionality (hence I found this article), and searching for extensions I found:
geocode.spacecadet - providing both TAB->SPC and SPC->TAB, but not updated since 2017, with 1.3k installs, 3.5 review
takumii.tabspace - TAB->SPC, from 2020, 1.5k installs, no reviews
pygc.spacetab - SPC->TAB, from... wait, literally yesterday! (or today depending on your TZ), 2 installs, no reviews

Hungry Backspace in Eclipse?

In some editors there exist plugins implementing a feature called "hungry backspace" or "hungry delete".
If this mode is active in a text editor then one hit to the backspace key will automatically delete all whitespace chars backwards from the current cursor position up to the first non-whitespace character.
For example, this feature exists for Emacs and IntelliJ IDEA.
Does anyone know if it is also available in Eclipse?
Alt-Del is probably as close as you're going to get without writing a plugin yourself. Others have asked for this feature (coming from intelliJ) but so far it doesn't exist, or it's not published.
-Adam
CTRL-backspace is pretty close too: delete previous word:
function(); (4 spaces)
+ CTRL-BACKSPACE gives:
function
Other than that, AnyEdit plugin can convert trailing spaces into tabs (but also into "", effectively removing them)
Ctrl+Shift+Left, Backspace always works for me. works in notepad, web browsers, everywhere.
Stick to the standards :)
In SciTE, and Eclipse (3.4), Ctrl+Shift+Del with the caret after the last visible character will delete these spaces. Ie. it deletes from caret to end of line.
Actually, in SciTE I don't need to do that, since I have set it up to automatically remove these trailing spaces when saving.
Note: In Preferences > General > Keys, there is a Remove Trailing Whitespace binding (without key assignment by default) which seems to apply to File.
From eclipse Windows menu/Preferences
Search for Keys and filter to "Delete Previous Word"and Bind it to the Ctrl+Backspace