All Questions
Tagged with whitespace tab-characters
15 questions
0
votes
2
answers
4k
views
How to convert spaces on a line to tabs?
I know there's a way because it happened by accident. I was frenetically moving in a short region of text and at some point, with some wrong keystroke, the leading spaces on the line became a tab (and ...
2
votes
1
answer
550
views
Stop vim from deleting expanded tab as a block of spaces
I am on CentOS 8.1 and using vim 8.0.1763. When I open a python file, e.g. vim tmp.py, I type tab and it inserts 4 spaces (see .vimrc below). When I type delete, it deletes all 4 spaces. I want it ...
1
vote
1
answer
257
views
Expandtab converts spaces to newline character?
When I enabled expandtab in vim by putting these in .vimrc:
set tw=4
set expandtab
Vim comverted every space typed by me to a newline character.
Like with the above settings whenever I type a new ...
2
votes
1
answer
59
views
On the length of tabs after an initial character
Length of tabs after initial char
Start gvim with the --clean option, to get a clean slate, and then do:
:set noet ts=5 sts=3 sw=2
Then enter the following
1234567890
and on the next line, press ...
1
vote
1
answer
230
views
Tab multiple lines [duplicate]
I have my tab set to 4 spaces with :set tabstop=4.
Now I want to highlight multiple lines and tab them, or indent all them 4 spaces. If I highlight the lines and do >, it seems to indent them more ...
70
votes
2
answers
148k
views
Setting TAB to 2 spaces
I've looked through various answers which imply that setting the following in .vimrc would be appropriate to force tab insertions to become spaces.
filetype plugin indent on
" On pressing tab, ...
5
votes
2
answers
5k
views
Expand <TAB> into 2 spaces when and only when editing HTML
My current configuration makes vim automatically expand TAB to 4 spaces for me:
" Define tab as 4 spaces
" Taken from http://stackoverflow.com/questions/1878974/redefine-tab-as-4-spaces
set tabstop=4 ...
2
votes
2
answers
2k
views
Show leading whitespaces, but not including tabs
I am a tabs kind of guy, I do not like when my code contains leading whitespaces instead of leading tabs. I often exchange codes with colleagues and I first have to convert the leading whitespaces to ...
10
votes
3
answers
2k
views
Shift left or right (with `noet`) without converting existing spaces to tabs
Foreword
I'm using the "indent with tabs, align with spaces" ideology for indentation. This means that each line in a file can be prefixed with an arbitrary amount of tabs and spaces (as opposed to "...
9
votes
3
answers
11k
views
Vim doesn't use the correct indentation in Python files
I have encountered something that I have never seen before in Vim. While I was tentatively modifying some of the source code for software I've been planning to work on, I noticed vim was displaying ...
5
votes
3
answers
1k
views
Avoid spaces getting converted to tabs automatically during shift(>>)
I use 2 spaces as indentation. So I set shiftwidth using :set sw=2.
However when I do the shift operator(>>) on a line twice, the indentation converts the 4 spaces automatically to a tab. So to ...
18
votes
3
answers
2k
views
Tabs for indentation, spaces for alignment
I am trying to make vim auto indent with tabs, and align with whitespaces, but actually, vim indent with tabs and fill the alignment with tabs + white spaces.
Vim does it :
(each block is a tab)
{
&...
21
votes
3
answers
3k
views
How can I make Vim position the cursor at the start of a tab character instead of the end?
Open an empty buffer and insert a tab character then exit to normal mode. When you place the cursor (normal mode) on the tab it will be at the right side of the whitespace. I'm looking for a way so ...
2
votes
3
answers
7k
views
How can I remove additional whitespace in the middle of line?
I know how to remove trailing white spaces at the end of lines.
Does anyone know how to remove white spaces in the middle of a line?
The white space I mean is before tab and after tab characters.
For ...
215
votes
9
answers
277k
views
How can I display tabs as characters?
When I work on files in python, I sometimes mistake tabs for spaces and vice versa. Is there a way I can get Vim to display a character for a tab instead of a tab?