Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-04-2008, 12:38 PM   #1
Registered: Mar 2008
Posts: 147

Rep: Reputation: 15
Tab setting in vim editor!!!

Hi all,

I am a newbie to the vi editor. I use vi to write AWK progs and perl scripts. I am facing a problem of indentation. When I press enter after writing a line, the cursor is going back to the start of the line. But i want the cursor to be placed at bottom of the above lines beginning, i.e., if I typed some code from 16th column the next line should start from 16th column only, unless i change the indentation.
Old 04-04-2008, 01:11 PM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387

Did you try activating autoindent (ai)?

You can try it by issueing the following command in command mode: set ai (set noai to deactivate).

If this is what you want/need you can put it in your vimrc (global or local). The full name can also be used. I.e. set autoindent.

Hope this helps.
Old 04-04-2008, 04:47 PM   #3
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15

This thread has more alikes.


Last edited by prad77; 04-17-2008 at 04:42 AM.
Old 04-04-2008, 06:01 PM   #4
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,516

Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
If you create a file, .exrc, in your home directory with this content
set autoindent showmode showmatch
you'll get autoindent (you use ^D to go back to the previous indent level on a new line), showmode (an indication of what mode you're in) and showmatch (the cursor will jump back to the previous '(' or '[' or '{' when you type a corresponding ')' or ']' or '}' -- kinda handy, that).
Old 04-12-2008, 12:41 PM   #5
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
Thank you all...



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a tab is 4 spaces width in vim? ICO SUSE / openSUSE 8 03-05-2013 11:24 AM
vim tab key redhax8 Programming 3 09-02-2006 10:44 PM
VIM Command Tab not working AMMullan Linux - Software 1 06-18-2006 06:17 AM
How to set TAB to 4 spaces in vim? kornerr Linux - General 2 01-05-2006 02:26 AM
Configuring (g)vim-tab with C++/Java Mega Man X Programming 2 01-28-2004 07:27 AM

All times are GMT -5. The time now is 01:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration