Questions tagged [indentation]
45 questions
80
votes
4 answers
What's the standard for indentation in shell scripts?
Java community use 4 spaces as the unit of indentation. 1
Ruby community use 2 spaces that is generally agreed-upon. 2
What's the standard for indentation in shell scripts? 2 or 4 spaces or 1 tab?
Arturo Herrero
- 2,386
- 2
- 19
- 18
33
votes
3 answers
How to indent multiple lines in nano
Selecting lines in nano can be achieved using Esc+A. With multiple lines selected, how do I then indent all those lines at once?
52d6c6af
- 441
- 1
- 4
- 6
23
votes
8 answers
Change tab size of "cat" command
When I am in vim I can change the tab size with the following command:
:set ts=4
Is it possible to set tab size for cat command output too?
B Faley
- 4,213
- 11
- 37
- 48
12
votes
2 answers
vim auto indenting even after setting noai option
I am using vim 7.2 from putty terminal.
Even if I run set noai it seems vim still trying to indent code.
I am copying my code from Notepad++ to vim.
following is from Notepad++
and following what I got in vim:
I don't have any tab in my file.
As a…
Hemant
- 6,834
- 5
- 38
- 42
10
votes
2 answers
How do I make Kate indent with spaces on Python files but use tabs for text files and other files?
My goal is to set Kate up to work properly on Python files but to use different settings (tabs not spaces) on other documents. I'm sure others are doing this, but I can't figure out a convenient solution. I appreciate any advice.
Kate has settings…
MountainX
- 17,168
- 59
- 155
- 264
10
votes
3 answers
In Vim, how can I automatically determine whether to use spaces or tabs for indentation?
Sometimes I edit others source code where the prevailing style is to use tabs. In this case, I want to keep the existing convention of using literal tabs.
For files I create myself, and files that use spaces as the prevailing indent style, I wish to…
Chris Down
- 122,090
- 24
- 265
- 262
10
votes
2 answers
emacs - paste text from clipboard without formatting
I am using Emacs 24 for macOS. I'm having some problem with pasting code from clipboard to Emacs. The code that I usually select already is nicely formatted (with tab, indent, ...).
However, when I paste it to Emacs, this redoes the formatting, so…
Think Pl
- 473
- 1
- 5
- 7
10
votes
5 answers
Shifting command output to the right
Say I'm writing a .bashrc file to give me some useful information in my login terminals and I'm telling it to run the cal command (a nice one). How would I go about shifting the calendar produced to the right to match the formatting of the rest of…
theStandard
- 303
- 1
- 4
- 11
7
votes
2 answers
Make GNU indent break long comments
Is there a way to convince GNU indent to break long comment and change it to multiline comment?
Something like this:
// Very long comment, longer than 80 characters. Just imagine that.
To this:
/*
* Very long comment, longer than 80 characters.…
Citrisin
- 176
- 5
6
votes
2 answers
Indent the middle of multiple lines
I often run into situations like this:
title : Jekyll Bootstrap
tagline: Site Tagline
author :
name : Name Lastname
email : [email protected]
github : username
twitter : username
feedburner : feedname
Where the arguments are not lined up…
rudolph9
- 1,425
- 1
- 17
- 24
6
votes
4 answers
Disable GNU Indent backup files
I am using GNU Indent to format C code in my project.
By default backup files are created ending with a ~.
I don't want to have any backup files created, is there a way to disable it?
ivokosir
- 79
- 3
5
votes
1 answer
How to use awk to indent a source file based on simple rules?
How can I indent source code based on a couple of simple rules?
As an example, I've used sed and ask to transform a selenium HTML source table to the following rspec like code. How could I consistently indent lines between describe and end ? …
Michael Durrant
- 41,213
- 69
- 165
- 232
4
votes
2 answers
Indenting multiple files
I want to indent multiple files which are poorly indented and indent them properly as would vim do when I type gg=G.
Is there someway to enter the = command or its alias in the command mode? i.e after a :?
If that is possible I can use the bufdo…
balki
- 4,327
- 5
- 30
- 44
3
votes
1 answer
Kate replaces alignment spaces by tabs
When indenting a block of code in Kate (3.11.2), spaces used for alignment are replaced by tabs, ruining all alignments and putting me in the hell of restoring all these spaces.
Example:
if (true)
{
—→$foo = 'bar'.
—→•••••••'baz';
}
(—→ are tabs, •…
lesenk
- 133
- 4
3
votes
1 answer
Emacs cperl mode - how to use tabs for indentation instead of spaces
Is there a way to make cperl mode in emacs use all tabs for indentation instead of spaces? I've tried setting indent-tabs-mode, and cperl-tab-always-indent. Here is my .emacs file:
(defalias 'perl-mode 'cperl-mode)
(setq cperl-tab-always-indent…
sprale
- 33
- 4