I have:
int x = 1;______
(underscores means spaces) and I would like to get:
int x = 1;
My naive solution is $bld$
, is there a quickest way?
In Emacs I use M-\ (delete-horizontal-space)
I have:
int x = 1;______
(underscores means spaces) and I would like to get:
int x = 1;
My naive solution is $bld$
, is there a quickest way?
In Emacs I use M-\ (delete-horizontal-space)
For the current line:
:s/\s\+$
For all lines:
:%s/\s\+$
The substitution text can be omitted if blank, so we don't need to write s/\s\+$//
.
I do this with a search and replace mapping:
map <leader>W :%s/\s\+$//<CR>:let @/=''<CR>
:%s/\s\+$//
deletes all trailing white space and then :let @/=''
clears the search register.
:%s/\s\+$//
What it does is it searches for white spaces at the end of the line and replace them by nothing.