Sponsored Content
Full Discussion: Vim tips and tricks
Top Forums UNIX for Beginners Questions & Answers Vim tips and tricks Post 302912558 by Don Cragun on Saturday 9th of August 2014 01:43:57 PM
Old 08-09-2014
Quote:
Originally Posted by yifangt
How to change Tab width in vim?
Say I have a file, columns are separated with single space (or maybe tab). I want to change space to tab (or different Tab width) so that the columns are aligned and nicely padded.
Code:
bob 100 90 30000 40 5
brian 40 30 20 10 10000
rob 10 2 30 40 50
mike 60 88 92 100 80

I tried setting different tabstop width to find the best one as :set ts=4; or :set ts=8, or :set ts=10, but tab width did not change at all in vim. What did I miss? Thanks!
Code:
:set tabstop=number
     and
:set ts=number

will display lines being processed with tab stops set every number columns. It will not convert spaces to tabs. It will not replace sequences of spaces and tabs to make words on various lines magically align as columns in a table.
 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

tar tricks

Hello there, Is there anyway to make the tar utility print the contents of the files inside it (not list the files, but rather their contents) sequentially from the command line? What I ultimately would like to do is to have a way of printing the contents of each file in the tar archive... (2 Replies)
Discussion started by: neked
2 Replies

2. Shell Programming and Scripting

need couple of ksh tricks please

1) I ran myScript with 2 arguments, I meant to use 3 if I do r my, it will rerun it with the 2 arguments. is there a way I can do r my and add a third argument at the end? 2) say I did myAcript.ksh 2 5 7 8 I realise my typo. is there an easy way to redo the command replacing A with S? ... (4 Replies)
Discussion started by: JamesByars
4 Replies

3. Post Here to Contact Site Administrators and Moderators

Solaris tips and tricks

What do you think could we open new top topic with tips and tricks and to show to other users some tricks what do we know like dtrace , new virtual server , how to add new users etc. This is only suggestion (1 Reply)
Discussion started by: solaris_user
1 Replies

4. UNIX for Dummies Questions & Answers

Sed Tricks

I have a file which containd a string "old" and I need to replace all old with "new" if and only if it is a string not part of a string like Gold or fold etc. I tried with sed like below echo "old gold old" | sed 's/old/new/g' It doesn't give the desired output, It give "old Gnew new".... (3 Replies)
Discussion started by: siba.s.nayak
3 Replies

5. Solaris

Very Importan - Vim Settings - Error while opening a File using vim

I downloaded vim.7.2 and compiled the vim source . Added the vim binary path to PATH (Because iam not the root of the box) when i load the file using vim it throws me an error Error detected while processing /home2/e3003091/.vimrc: line 2: E185: Cannot find color scheme darkblue line... (0 Replies)
Discussion started by: girija
0 Replies

6. UNIX for Advanced & Expert Users

Basic VI tricks

I found a decent guide of VI basic tricks. This guide does expect you to have a decent understanding of VI. It does not go over very much beginner related. vi Manual (3 Replies)
Discussion started by: cokedude
3 Replies
pr(1)							      General Commands Manual							     pr(1)

NAME
pr - print files SYNOPSIS
[options] [files] DESCRIPTION
The command prints the named files on the standard output. If file is or if no files are specified, the standard input is assumed. By default, the listing is separated into pages, each headed by the page number, a date and time, and the name of the file. By default, columns are of equal width, separated by at least one space; lines that do not fit are truncated. If the option is used, lines are not truncated and columns are separated by the separation character. If the standard output is associated with a terminal, error messages are withheld until has completed printing. Options The following options can be used singly or combined in any order: Begin printing with page k (default is 1). Produce k-column output (default is 1). This option should not be used with The options and are assumed for multi-column output. Produce k-column output, same as Print multi-column output across the page. This option is appropriate only with the option. Merge and print all files simultaneously, one per column (overrides the and options). Double space the output. Expand input tabs to character positions k+1, 2xk+1, 3xk+1, etc. If k is 0 or is omitted, default tab settings at every eighth position are assumed. Tab characters in the input are expanded into the appropriate number of spaces. If c (any nondigit character) is given, it is treated as the input tab character (default for c is the tab character). In output, replace white space wherever possible by inserting tabs to character positions k+1, 2xk+1, 3xk+1, etc. If k is 0 or is omitted, default tab settings at every eighth position are assumed. If c (any nondigit character) is given, it is treated as the output tab character (default for c is the tab character). Provide k-digit line numbering (default for k is 5). The number occupies the first k+1 character positions of each column of nor- mal output or each line of output. If c (any nondigit character) is given, it is appended to the line number to separate it from whatever follows (default for c is a tab). Set the width of a line to k character positions (default is 72 for equal-width, multi-column output; no limit otherwise). Width specifications are only effective for multi-columnar output. Offset each line by k character positions (default is 0). The number of character positions per line is the sum of the width and offset. Set the length of a page to k lines (default is 66). If k is less than what is needed for the page header and trailer, the option is in effect; that is, header and trailer lines are suppressed in order to make room for text. Use the next argument as the header to be printed instead of the file name. Pause before beginning each page if the output is directed to a terminal rings the bell at the terminal and waits for a Return). Use form-feed character for new pages (default is to use a sequence of line-feeds). Pause before beginning the first page if the standard output is associated with a terminal. Same as Provided for backwards compatibility. Print no diagnostic reports on failure to open files. Print neither the five-line identifying header nor the five-line trailer normally supplied for each page. Quit printing after the last line of each file without spacing to the end of the page. Separate columns by the single character c instead of by the appropriate number of spaces (default for c is a tab). EXTERNAL INFLUENCES
Environment Variables determines the interpretation of text and the arguments associated with the and options as single-byte and/or multi-byte characters. determines the format and contents of date and time strings. determines the language in which messages are displayed. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to See envi- ron(5). International Code Set Support Single-byte and multi-byte character code sets are supported. RETURN VALUE
The returns the following values upon completion: Successful completion. One or more of the input files do not exist or cannot be opened. EXAMPLES
Print and as a double spaced, three column listing headed by ``file list'': Write on expanding tabs to columns 10, 19, 28, 37, ... : Print in default format with nonblank lines numbered down the left side: FILES
SEE ALSO cat(1), lp(1), nl(1), ul(1). STANDARDS CONFORMANCE
pr(1)
All times are GMT -4. The time now is 11:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy