LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 04-04-2008, 11:38 AM   #1
visitnag
Member
 
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, 12:11 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

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, 03:47 PM   #3
prad77
Member
 
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
http://vim.sourceforge.net/tips/tip.php?tip_id=83

This thread has more alikes.

Gentoo

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

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
If you create a file, .exrc, in your home directory with this content
Code:
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, 11:41 AM   #5
visitnag
Member
 
Registered: Mar 2008
Posts: 147

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


Reply

Tags
vim


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/Novell 8 03-05-2013 10:24 AM
vim tab key redhax8 Programming 3 09-02-2006 09:44 PM
VIM Command Tab not working AMMullan Linux - Software 1 06-18-2006 05:17 AM
How to set TAB to 4 spaces in vim? kornerr Linux - General 2 01-05-2006 01:26 AM
Configuring (g)vim-tab with C++/Java Mega Man X Programming 2 01-28-2004 06:27 AM


All times are GMT -5. The time now is 03:20 PM.

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