The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
31 views

Command that indents lines of a C source file

I need a way to auto-indent blocks on a C source file within the terminal. According to the norms. Before: int main() { puts("Hello world"); } After: int main() { puts("Hello world"); }
4
votes
3answers
304 views

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?
7
votes
2answers
127 views

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: /* ...
3
votes
1answer
103 views

bash script autobeautifiying using declare -f

I am trying to "beautify" scripts automatically by using declare -f function In a nutshell: Given a bash script foo , you can apparently "automagically" indent it by doing, in bash: MAGIC () { ......
0
votes
2answers
55 views

How to convert indentation style in a project directory

First of all I am not sure that this is the place to ask this question. I am a web developer working on a medium sized team. We follow the same coding style using Lint/Hint tools. It happens ...
12
votes
6answers
5k views

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?
0
votes
2answers
98 views

How to indent grep's output? [duplicate]

I need grep's output to be indented with tabs/spaces. This is the plain, un-indented version: MyCmd | grep "id:" I tried this without success:MyCmd | grep "id:" | echo " "
2
votes
5answers
499 views

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 ...
2
votes
2answers
215 views

Whats wrong with my file check script?

I don't understand why the last part of my script does not display anything when no file or directory is found. echo -n "Please enter a filename or directory: " read filename if [ -z "$filename" ]; ...
-3
votes
2answers
45 views

How can I auto indent on Ubuntu? [closed]

I want that when I insert any bracket it automatically inserts another closing bracket in next line and indents automatically.It would help a lot in my programming.
32
votes
4answers
14k views

What's the standard for indentation in shell scripts? [closed]

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?
2
votes
0answers
73 views

Why is GNU Indent doing what it seems to be a self rule violation?

I'm using GNU Indent to format some code. I have some lines like this one: port->N[0].BTR.U = (DIV8(0U) | TSEG2(0x3U) | TSEG1(0xEU) | ...
0
votes
1answer
61 views

How to keep GNU Indent from formatting comments?

I don't want that GNU Indent to touch any comment whatsoever. But it seems that there is no option that allows me to keep the comments untouched. What commands or commands combination should I use to ...
2
votes
3answers
77 views

How to add “wrappers” around methods in source code based on a pattern, using sed, awk, grep and friends

How can I add wrappers to a file based on a pattern? For instance I have the following: ... find(css_policy_form_stage3).click with_ajax_wait expect(css_coverage_type_everquote).to ...
4
votes
1answer
100 views

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 ...
4
votes
1answer
2k views

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 ...
0
votes
1answer
148 views

How to replace tab's indent by space's indent with web-mode in Emacs

I don't want to use tabs for indent, so I add (setq-default indent-tabs-mode nil) in my emacs init file. With the setting indents are created by spaces in web-mode, but it doesn't change already ...
2
votes
2answers
59 views

vim disassembles my indentation [duplicate]

When i'm in Insert mode at vim, and press Shift+Insert to paste my code to my file, vim disassembles my indentation , Such as: Question: How can i solve this problem?
3
votes
0answers
283 views

Vertical lines connecting blocks in Gedit

I'd like to know if there is some way I can get gedit to display vertical lines connecting logical blocks of a programming code (namely Fortran 95 in my case).     See in the image ...
0
votes
1answer
541 views

(Vim) How to use TAB for indentation in all file types?

I'm using only TAB for indent, so I configure Vim for using only them: set autoindent set noexpandtab set tabstop=4 set shiftwidth=4 But some files (.py) still using spaces. I've search for it and ...
1
vote
2answers
4k views

How to configure Kate to always use 2 spaces for tabulation?

By default Kate inserts 2 spaces on Tab press but switches to real tabs starting from the fourth Tab level. Can I disable this and use spaces always, regardless to the depth? I want this because I ...
2
votes
1answer
1k views

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) { ...
8
votes
1answer
5k views

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?
5
votes
1answer
2k views

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 ...
1
vote
1answer
853 views

Use tabs for indentation in Python mode

I am using Emacs for Python developement. My team is using Tab indentation, so I must do the same. The problem is that I can't figure out how to make python-mode use tabs instead of spaces. I want ...
4
votes
1answer
378 views

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 ...
1
vote
1answer
159 views

How do I keep 'indent' from moving curly braces to the next line?

I have several empty inline function definitions in C++ like so: class C { void foo(){} void bar(){} }; now if I run indent -st -i4 -nut test.cc in order to just fix the indentation I get ...
2
votes
3answers
256 views

Indent like first line

How can I indent a file such as its first line? Example: A file containing x=1+2+3+4+ 5+6+7+8 +9+10+12 should be converted to x=1+2+3+4+ 5+6+7+8 +9+10+12 I need this inside ...
6
votes
2answers
464 views

Indent the middle of multiple lines

I often run into situations like this: title : Jekyll Bootstrap tagline: Site Tagline author : name : Name Lastname email : blah@email.test github : username twitter : username feedburner : ...
4
votes
2answers
349 views

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 ...
1
vote
1answer
887 views

How to change vim auto-indent behavior?

By default vim aligns lines inside LI tags on the same position as the position of LI tag, but I want the contents of LI to have deeper indentation. Current behaviour: <LI> first line second ...
3
votes
1answer
977 views

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-...