Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [tab-characters]

Question about how to handle white spaces tab characters with vim, insert them, remove them, convert them to space characters, etc...

0
votes
0answers
27 views

configuration in .vimdir file are being ignored

I've a project directory with a .vimdir at the root. I've set expandtab in my vimrc and set noexpandtab in .vimdir, but for some reason tabs are being expanded into spaces in the files in that project,...
1
vote
0answers
62 views

The tab adds 8 spaces even though `set tabstop?` returns 4

For some reasons when I'm editing my ~/.config/nvim/init.vim, it adds 8 spaces even though I set set tabstop=4 on the file. Actually, :verbose set tabstop returns 4, so it should be 4 spaces. I ...
1
vote
1answer
36 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 ...
0
votes
1answer
75 views

How to change the size of the indent that's created using “>” (forward arrow)?

If I want to change the tab size, I can do that with set tabstop=<number>. I have that in my .vimrc to make it 4 instead of 8. However, when I indent/deindent text by highlighting it then using ...
1
vote
0answers
38 views

Set tab width according to file [duplicate]

I have the following in my .vimrc: set expandtab "Use soft tabs (spaces) set shiftwidth=2 "Set tab width = 2 set softtabstop=2 "Set tab width = 2 set autoindent "Set indent of previous line Now if I ...
1
vote
1answer
55 views

Auto-indent with spaces, but insert TAB when I press the TAB key

I like to indent my shell scripts with two spaces instead of a TAB. So, I set setlocal shiftwidth=2 in ~/.vim/after/ftplugin/sh.vim. It works, but I noticed that when the indentation level gets ...
0
votes
1answer
72 views

how to make vim indentation file type specific? [duplicate]

I usually work on js files and php files. My js files require 2 spaces tab, whereas my php requires 4. How can I make vim dynamically change that depending on the file type I'm working on?
0
votes
1answer
31 views

Search for 2 but not for 3 tab characters

I want to search in Vi for two tabs but not for three or more tabs. I tried several things like this: /\t\t\(\t\)@! But nothing works. Any idea?
0
votes
2answers
275 views

Getting Shift-Tab to work in VIM Insert mode

I've been trying to get Shift+Tab or <S-Tab> to work in VIM and for the life of me I can't figure it out. I read this document, but the remap solution only works for normal mode (because if I ...
6
votes
0answers
44 views

Why are tabs adjacent to concealed tabs displayed wider than a single tabstop?

I just wrote the following code in an answer to another question: syntax match HideTwoIndents /\v^\t(\t)?/ conceal set conceallevel=2 This works great if 'list' is set and if 'listchars' does not ...
1
vote
1answer
70 views

Tab size fixed to 8 in spite of polyglot.

I am using Vim 8. Since I installed vim-polyglot to handle syntax highlighting and indentation of different languages without going crazy, whatever file I open has a tab size of 8 automatically. I ...
1
vote
0answers
41 views

Files with tabs are length 8 even with set tabstop=4 in vimrc [duplicate]

I have most of the usual tab commands in ~/.vimrc: set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set breakindent set autoindent set smartindent. There are no problems when I open a ...
7
votes
1answer
11k 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, insert ...
3
votes
1answer
579 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 ...
0
votes
2answers
458 views

Have backspace delete whole tabs

Under regular conditions, the tab key will insert a tab character and backspacing that tab deletes the whole tab character. I have set up expandtab and softtabstop=4 so that when I hit tab it will ...
1
vote
0answers
272 views

expandtab / noexpandtab toggles by itself in Neovim

I have this issue where noexpandtab turns itself on after a while. Tried to describe it here and in the Github Issue because I am not 100% sure this is a legit bug. For a long time, I have ...
0
votes
1answer
595 views

<Tab> in insert mode brings up completion

Today when I open my computer and enter vi, strange things happened: backspace not working(solved), and Tab brings up keyword completion in insert mode, which is what I'm worrying about. Before, I can ...
-1
votes
2answers
448 views

bypassing TAB auto-complete

Sometimes I need to press TAB, but instead of getting actual the tab key, a suggestion pops up and TAB cycles through the suggestions. How can I insert TAB without invoking the auto-completion ? The ...
3
votes
2answers
249 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 ...
7
votes
2answers
193 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 "...
0
votes
2answers
104 views

How can I highlight misuse of tabs and spaces according to current configuration?

I'm looking for a way that will highlight lines (or part of lines) that don't adhere to current tabs settings. Say for instance, I have the following configuration in my .vimrc tabstop=8 ...
2
votes
2answers
888 views

softtabstop == tabstop VS softtabstop=0

Are this: set noexpandtab set shiftwidth=4 set tabstop=4 set softtabstop=0 ..and this: set noexpandtab set shiftwidth=4 set tabstop=4 set softtabstop=4 ..exactly the same? I thought that if ...
1
vote
1answer
31 views

Make pipe behave like `col('.')`

So when I go to the first character in a line, the first character in that line is a tab character, and I execute echo col('.'), I will get 1. However when I type 2| I won't go to the next character, ...
1
vote
2answers
415 views

Transforming a long table into multiple columns

Suppose I have the following table: E 12.02 T 9.10 A 8.12 O 7.68 I 7.31 N 6.95 S 6.28 R 6.02 H 5.92 D 4.32 L 3.98 U 2.88 C 2.71 M 2.61 F 2.30 Y 2.11 W 2.09 G 2.03 ...
6
votes
2answers
1k views

Vim displaying incorrect indentation

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 ...
1
vote
4answers
715 views

Delete indenting spaces one at a time

I want to be able to delete indenting spaces one at a time. If I set shiftwidth to 4, it deletes 4 spaces at a time if vim counts them as indentation. Setting shiftwidth to 1 fixes the problem, but ...
5
votes
1answer
339 views

vimrc tab behavior when noexpandtab and softtabstop is less than tabstop

Questions In the following example: Why in the first line, a \t is inserted but only 4-col blank is displayed? Shouldn't it be 8 according to tabstop? Why the two <TAB> hits in the first line ...
1
vote
1answer
63 views

How to write literal for Tab key to use for motion?

I've the following dummy file created via: echo -e "a a\tb b\tc c" > file Is there any literal for space which I can use for motion argument? For example this works (which removes the 1st a a ...
3
votes
1answer
264 views

How can I set expandtab but only for git commit messages?

Most of the time I'd like noexpandtab on because our corporate formatting uses tabs instead of spaces, so in my .vimrc I have this: " Set tab width stuff set tabstop=4 softtabstop=0 noexpandtab ...
2
votes
3answers
215 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 ...
16
votes
3answers
835 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) { &...
7
votes
2answers
6k views

Show listchars tab as spaces

I use list and listchars to show my whitespace, but the code style I adhere to uses tabs. Seeing > or ^I for all of my tabs is nauseating. How would I keep all of my existing list characters but ...
15
votes
3answers
12k views

What is `softtabstop` used for?

I've been aware of these tab related settings in Vim: ts sw expandtab smarttab sts My normal setting is set ts=4 sw=4 expandtab smarttab. But according to sts documentation, if expandtab is not ...
0
votes
3answers
512 views

Why are <tab> characters variable width?

I have the following settings in my vimrc: set listchars=tab:►-,eol:¬,trail:● When I display unprintable characters in my makefile, I get something that looks like the following for one of the ...
1
vote
1answer
81 views

How to trigger file type specific settings after they they have been executed in vimrc?

I have the following setting in my vimrc autocmd FileType * setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab This is just so that every file I open looks consistent. I also have another ...
4
votes
2answers
114 views

<C-v> <C-i> not working to print literal tab!

I'm trying to set a custom breakat for plain text files. Aiming for a very small set of characters -- just hyphens, slashes, and whitespace. That means I need to add tabs, which I do by setting ...
22
votes
2answers
2k views

Elastic Tabstops in Vim?

Is there a plugin or a built-in feature in Vim that allows for elastic tabstops? I've searched a bit, and I found some references saying it was not possible in Vim, but those were quite old. Is ...
2
votes
1answer
78 views

Don't show tab characters as ^I or <09> in the output of :registers

If I type :registers, I see a lot of <09>: "1 <09><09><09>d = self / i.to_f^J<09><09><09>r = d.to_s^J<09><09><09>p r =~ /0$/^J "2 <...
14
votes
2answers
685 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
3answers
3k 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 ...
10
votes
2answers
6k views

Insert tabs in INSERT mode when expandtab is set

I have set expandtab in my .vimrc file to convert tab to multiple space characters. However some files (like Makefile) need actual the tab character inserted. Is there an easy way to force the ...
78
votes
5answers
53k views

How to replace tabs with spaces?

Is it possible to convert tabs to spaces, while maintaining text alignment? Simply replacing only works usefully when there are no leading characters.
86
votes
6answers
74k views

Displaying 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?