You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, from a Vim user who's recently been coerced to use VSCode: thanks for your hard work on this plugin.
Is your feature request related to a problem? Please describe.
Well, it's a problem for me. From searching the Issues, it doesn't seem to have been reported before.
Describe the solution you'd like
In Vim, I'm accustomed to trimming trailing whitespace via something like the following:
:%s/\s\+$//g
In VSCodeVim, this gives E486: Pattern not found: \s\+(?:$(?<!\r)). By trial and error, I was able to get close to my desired behavior by omitting the backslash preceding the plus sign,
:%s/\s+$//g
After this modification, VSCodeVim removes trailing whitespace as desired. Unfortunately, there are two drawbacks.
First, this command also removes blank lines, i.e., lines containing zero or more whitespace characters followed by a newline. This is highly undesirable behavior: blank lines have special meaning in certain programming languages, and they are also a popular technique to improve readability. I much prefer the Vim behavior, where the whitespace is removed but the newline is preserved.
Second, this command behaves quite differently in Vim, where the plus sign would be interpreted literally. (Although I'm sure this can be customized.)
Describe alternatives you've considered
Under settings, VSCode has a "Trim trailing whitespace upon saving file". This seems to do the right thing, but unfortunately affects a file globally. Even if removing the trailing whitespace is the morally correct thing to do, this can cause practical issues when collaborating on projects or working with legacy codebases.
Additional context
My background is Linux-command-line-based development using Vim as my editor. I'm new to VSCode-based development on MacOS. It is possible I've overlooked some configuration setting.
The text was updated successfully, but these errors were encountered:
First of all, from a Vim user who's recently been coerced to use VSCode: thanks for your hard work on this plugin.
Is your feature request related to a problem? Please describe.
Well, it's a problem for me. From searching the Issues, it doesn't seem to have been reported before.
Describe the solution you'd like
In Vim, I'm accustomed to trimming trailing whitespace via something like the following:
In VSCodeVim, this gives
E486: Pattern not found: \s\+(?:$(?<!\r))
. By trial and error, I was able to get close to my desired behavior by omitting the backslash preceding the plus sign,After this modification, VSCodeVim removes trailing whitespace as desired. Unfortunately, there are two drawbacks.
First, this command also removes blank lines, i.e., lines containing zero or more whitespace characters followed by a newline. This is highly undesirable behavior: blank lines have special meaning in certain programming languages, and they are also a popular technique to improve readability. I much prefer the Vim behavior, where the whitespace is removed but the newline is preserved.
Second, this command behaves quite differently in Vim, where the plus sign would be interpreted literally. (Although I'm sure this can be customized.)
Describe alternatives you've considered
Under settings, VSCode has a "Trim trailing whitespace upon saving file". This seems to do the right thing, but unfortunately affects a file globally. Even if removing the trailing whitespace is the morally correct thing to do, this can cause practical issues when collaborating on projects or working with legacy codebases.
Additional context
My background is Linux-command-line-based development using Vim as my editor. I'm new to VSCode-based development on MacOS. It is possible I've overlooked some configuration setting.
The text was updated successfully, but these errors were encountered: