Questions tagged [tabs]

Questions about the inserting/manipulating/displaying TAB characters in Emacs files. Do not use this tag for questions related to browser style "tabs".

Filter by
Sorted by
Tagged with
1 vote
1 answer
42 views

What is the difference between a tab stop and a tab width?

Greetings lately I've been trying to learn Emacs and configure it as an IDE, so I started learning the basics, until I got to the segment of configuring indentations. I do understand that the term Tab ...
KhodeNima's user avatar
  • 113
0 votes
1 answer
30 views

What determines which buffer is current after kill-buffer?

Since moving to Doom emacs and Centaur tabs, I have an issue I can't seem to solve. If I have say two tabs/buffers open in the order A-B and am visiting A. I open another buffer C and am visiting it. ...
PLK's user avatar
  • 111
0 votes
1 answer
39 views

Why is emacs inserting 3-space tabs inside markdown file?

I have the following configuration for tabs: (setq-default indent-tabs-mode nil) (setq-default tab-width 4) This works inside code and text files, where hitting tab indeed gives me 4 spaces. However, ...
cheryllium's user avatar
0 votes
0 answers
31 views

show only file visiting buffers with certain file extension in centaur tabs

I am wondering for some time if it is possible to have centaur tabs display only buffers with the same file extension as the current buffer. After spending some time using infamous search engine and ...
Matthias's user avatar
  • 775
0 votes
2 answers
56 views

Using TAB to flip between two windows

I have set TAB to flip between two windows using:- (global-set-key (kbd "TAB") 'other-window) This works sometimes, but not always. How should I define it?
balanga's user avatar
  • 135
0 votes
1 answer
164 views

When I type the tab key, I want a tab, and when I type the whitespace key, I want a whitespace. How can I ensure that?

In the fundamental mode, when I type the tab key, sometimes I got a tab and sometimes 4(?) whitespaces. When does which happen? When I type the tab key, I want a tab, and when I type the whitespace ...
Tim's user avatar
  • 5,007
0 votes
0 answers
35 views

How to align source code section in both Org-src-edit-code, Org-mode, and exported PDF file?

How to configure emacs such that code (in this case :which-key) is aligned in both org-edit-src-code org-mode and exported PDF? I'm guessing this is somewhat related to tabs getting different amount ...
Garid's user avatar
  • 641
1 vote
1 answer
156 views

Tabs like vim configuration

I'd like to know how to set emacs up to do the equivalent of what vim does when I have this configuration: cat $HOME/.vimrc set tabstop=4 set shiftwidth=4 set expandtab So basically, whenever I hit ...
PatS's user avatar
  • 155
0 votes
0 answers
214 views

How to always use tabs when pressing the tab key?

I use an indentation sensitive language (imba) and I need to always use tabs. I'm using doom emacs and I'm also writing a wip major mode for Imba. But I press tab and it adds indentation using tabs (a ...
Abdellah Stands with Gaza's user avatar
0 votes
1 answer
65 views

Emacs spacing format is inconsistent with my setup

emacs version: GNU Emacs 26.3 using specman_mode.el most of the company uses gvim, i am using emacs, so the alignment are a bit different. but, when i open the file with emacs -Q, the alignment is ...
Michael Marjieh's user avatar
3 votes
2 answers
312 views

Emacs Lisp to view text file like a table

I'd like to write a mode, or at least some Lisp functions, to view a tab-separated file like a table. What I mean is lines like this: foo\t123\tbar yabba dabba\t12345\treally long field here Should ...
Rob N's user avatar
  • 639
0 votes
1 answer
104 views

How can I prevent adding a TAB if inner block is already aligned, in `pine-script-mode`?

I am using pine-script-mode with a 4 space TAB. Here is an inner block of an if statement that is already aligned. How can I prevent adding a TAB char (or 4 space chars) when I press TAB? pine file: ...
alper's user avatar
  • 1,370
1 vote
1 answer
162 views

What is the proper way to set tab-width in configuration block at end of file

I'm editing a file .bashrc-host25 and it's not going into bash editing mode, so I searched for a solution and found it at https://emacs.stackexchange.com/a/52083/16958. My file now has the following ...
PatS's user avatar
  • 155
1 vote
1 answer
549 views

How to make tab-width 4 space in pine-script-mode?

I am using pine-script-mode for TradingView Pine script. When I follow https://emacs.stackexchange.com/a/17565/18414 I have applied: (defun my-custom-settings-fn () (setq indent-tabs-mode nil) (...
alper's user avatar
  • 1,370
0 votes
1 answer
43 views

Indentation without tabs

What is the difference between indent-tabs-mode and tab-always-indent?
Dilna's user avatar
  • 1
1 vote
2 answers
235 views

Using tab key for inserting literal tabs

How can I use the TAB key for inserting literal tab characters (including multiple ones). With (setq-local indent-tabs-mode nil) I cannot introduce them because Emacs doesn't let me do so. With the ...
Dilna's user avatar
  • 1
2 votes
1 answer
1k views

How can I display tabs and spaces in Doom Emacs?

I have tried M-x whitespace-mode but it does not do anything.
BigBoy1337's user avatar
1 vote
3 answers
353 views

How can I align indents for condition statements in AucTex algorithm section?

If possible, I want to align condition statements like: \If, \Else, \For statements in between \begin{algorithmic} ... \end{algorithmic} section. example: \begin{algorithmic}[1] \For{a for statement} ...
alper's user avatar
  • 1,370
1 vote
1 answer
1k views

Emacs DOOM does not show tabs although 'centaur-tabs' is enabled

I'm currently using DOOM emacs. I enabled 'centaur-tabs' in ~/.doom.d/init.el by using (tabs +centaur-tabs). Configures are: (after! centaur-tabs :ensure t ...
sungjun cho's user avatar
1 vote
0 answers
25 views

Customized c-mode indentation style in Emacs 27.2

I would like to produce c code in the following format: char *ft_strdup(const char *s1) { char *h; size_t len; ... } Where I can tab after the type of the function signature and ...
Egydio Pacheco's user avatar
3 votes
1 answer
3k views

How to set the default indentation width globally?

By default Emacs uses tab instead of spaces for indentation, so I changed these 2 variables to change this behavior, (setq-default indent-tabs-mode nil) ;; Disable indent with tabs (setq ...
apoorv569's user avatar
  • 113
1 vote
0 answers
141 views

Python indent alignment for the inner if condition

I am using tab for indent alignment, I believe its a built-in emacs behavior in python-mode. In most cases if cursor is at the beginning of the line and when I press TAB, first** cursor jumps to first ...
alper's user avatar
  • 1,370
1 vote
2 answers
219 views

`dtrt-indent-mode` erroneously uses Tab characters

Here is an example file (/tmp/asdf.sh), for which I want dtrt-indent-mode to do the right thing. #! /usr/bin/env bash function asdf() { printf "asASDFASDF" echo "1234" } ...
Gauthier's user avatar
  • 509
1 vote
1 answer
204 views

Tex indentation with TAB

Recently, when editing files in LaTex, upon pressing TAB, I get a huge indentation. Instead, the default behavior used to be to align with respect to previous environment definition. : I start with ...
Yair Daon's user avatar
  • 131
0 votes
1 answer
92 views

How to stop Emacs from highlighting Linux Tab characters?

So I opened a c++ script made in Xubuntu and every tab character was highlighted with grey. That doesn't happen when I open scripts made on Windows. How do I stop Emacs from highlighting them, it's ...
Philip's user avatar
  • 3
0 votes
1 answer
72 views

How to match emacs column count to gofmt column count?

I am writing Go code but the error messages do not agree with Emacs' column count. Is there an off-the-shelf solution for this? I'm wondering about a minor mode or even a few lines for my .emacs file....
Mehmet's user avatar
  • 103
2 votes
1 answer
521 views

I am writing Fortran code in emacs but the tab key behaviour changes in F90 mode. Can I change it back?

On loading a f90 file, emacs changes to F90 mode, which changes some emacs behaviours. When I press <tab> emacs inserts two spaces at the left margin. Now when I use the backspace key it deletes ...
Georgina Davenport's user avatar
0 votes
0 answers
51 views

Why is a TAB character added when using kill-rectangle and yank-rectangle to insert multiple rows into an org-mode table?

I noticed an annoying behaviour when copying multiple rows (a list) from a web page into an org-mode table, following a process inspired by Is it possible to copy /paste multiple lines of text into ...
chr's user avatar
  • 87
0 votes
3 answers
337 views

elpy (and evil-mode) do not react on TAB

This is my elpy-config 1Elpy Configuration 2 ...
buhtz's user avatar
  • 729
1 vote
3 answers
1k views

How to set js-mode indent in Emacs >= 27.1

I have my tab width set to two spaces and this has worked fine for many years. I have just upgraded to Emacs 27.1, and now js-mode is displaying tabs as three spaces wide, ignoring my preferred ...
Malvineous's user avatar
2 votes
1 answer
92 views

Emacs converting spaces to tabs when using X11 primary selection in a terminal window

When I use emacs in a terminal window on linux, I am often getting spaces unexpectedly converted to tabs when I cut and paste using the X11 primary selection. What reproduces the problem for me is the ...
user avatar
1 vote
2 answers
167 views

How to NOT Auto Indent when a specific Character is inputted?

So I recently encountered a problem programming in C that whenever I enter the left parenthesis character, (, Emacs auto-idents the code. [4 spaces here]DATA *SeqQueueOut( I know that there is this ...
user30099's user avatar
0 votes
0 answers
66 views

Make tabs be visually 4 spaces long but 1 column only

I indent my code with tabs and I want my tabs to be visually 4 spaces long but to be 1 column only. Currently with my configurations my tabs are 4 spaces long but also 4 columns long and I can't find ...
Romix's user avatar
  • 1
2 votes
1 answer
254 views

How do I stop tab from being electric in Text mode?

When editing a plain-text document in Text mode when I press tab emacs inserts spaces until the cursor appears directly beneath the beginning of a word it finds in the line above. I don't want it to ...
Georgina Davenport's user avatar
0 votes
0 answers
112 views

emacs sometimes inserts tabs at weird places

Sometimes when I am typing in emacs, I type a space and emacs actually inserts a tab instead of the space. For example, while typing "Four score and seven years ago" emacs actually inserts ...
Deron D Johnson's user avatar
0 votes
0 answers
1k views

Make tabs behavior like in other IDEs

How can I force Emacs to use tab button and TAB character in "normal stupid way"[1], like in nano or VScode or JetBrain's IDEs. All I can find is smart-tabs package and indent-tabs-mode, but ...
superpupervlad's user avatar
1 vote
2 answers
432 views

How do I disable Centaur Tabs in ispell Choices buffer

I need to disable the Centaur-Tabs in the Choices buffer of ispell/flyspell. In Centaur Tab's site it says to add a hook, so I tried this: (add-hook 'ispell-choices-buffer 'centaur-tabs-local-mode) ...
toledano's user avatar
  • 111
0 votes
2 answers
148 views

Set tabs instead of spaces when programming

I have been using Emacs for a while and it has been one of my favorite editors of all time, even more so than Vim. However, I've had a problem in regards to setting tabs and spaces. Whenever I try to ...
Roy's user avatar
  • 1
0 votes
0 answers
17 views

TCL is adding different tab widths in the program

I am trying to rearrange the columns of below file input.txt, Contents of this file: Name Location Purpose --------------------------------------------- Andy US Business1 ...
user avatar
4 votes
0 answers
193 views

Markdown equivalent of `org-indent-mode`?

What's the simplest way of ensuring that the text below a headline in a Markdown file is aligned with the headline? In org-mode you can accomplish this by calling org-indent-mode. Is there a similar ...
apc's user avatar
  • 319
0 votes
1 answer
332 views

Missing tabs on Emacs

I have been using Emacs for one week, so all of it is really new for me. I saw that there are two types of commands in order to navigate in emacs : - Some "tabs" on the top - Commands like shortcuts ...
Alex's user avatar
  • 1
0 votes
0 answers
82 views

Tabs on windows with custom buffers

I am new to Emacs and I am trying to set up a decent workflow for projects I already have. What I want to do is to be able to have tabs of buffers on each window (not frame). What I want ...
Noob Doob's user avatar
  • 101
3 votes
2 answers
2k views

How to change shell-script-mode indentation not to use tabs?

To reproduce my issue, open your .bashrc or a .sh file and type the following: if while echo The if has no indentation. Good. The while has the default four spaces of indentation. Good. ...
Ness's user avatar
  • 177
1 vote
1 answer
74 views

Dual-language text mode using the original interpretation of tabs

Does there exist an Emacs mode that replaces the contemporary interpretation of tabs (move to 8, 16, 24, .. or a multiple of some constant) with their original typewriter interpretation (set stops at ...
Calaf's user avatar
  • 483
1 vote
1 answer
366 views

Previous indentation is discarded on newline

Let's say I have the following code: void foo(){ ~ } I have marked point with ~. When I press enter the electric indentation works as normal but it doesn't keep the indentation for the previous ...
Nathan's user avatar
  • 13
1 vote
0 answers
2k views

How can I make Emacs enter a TAB character when I press the TAB button, without modifying my config file?

I am looking for a command I can enter that will make the TAB key input an actual TAB character. I'm open to anything that is temporary or that will not stomp on TAB mappings that do things other ...
A.M.'s user avatar
  • 111
0 votes
2 answers
1k views

CC mode: make Tab just insert one tab or complete, no auto-indenting

I am dissatisfied with current behaviour of Emacs in CC Mode. I'm not sure if this applies to other major modes, but that's one I'm currently struggling with. Here are my problems: When I press tab, ...
SuperPrower's user avatar
2 votes
1 answer
605 views

How can I configure the tab width for TCL files

I set all tab-width parameters and indent parameters to 2, but Emacs always uses 8 for the tab space when I press the TAB key at the beginning of a line, if i opened one bracket. How can i set the ...
Andreas Felber's user avatar
0 votes
1 answer
239 views

Make `tab` key insert 5 space characters in Latex Mode

In Latex mode, the tab key runs the command indent-for-tab-command From the output of C-h k tab when in Latex mode I rarely need to indent lines in my Latex files, and so I want to disable this ...
smilingbuddha's user avatar
1 vote
2 answers
433 views

Convert tabs to spaces when copying text to external applications

I use tabs in C/C++ but want to convert those tabs to spaces when copying code that I'm going to paste into an external program. However, I want the original code to retain tabs. Additionally (if ...
MattHusz's user avatar
  • 177