?
Solved

Vim Settings

Posted on 2002-07-04
7
Medium Priority
?
215 Views
Last Modified: 2013-12-16
Hi,
   Sorry for asking at the wrong place but the right question :-(. Here goes my question.

    When option "cindent" is set, then some characters like "#" etc. are positioned at the beginning of the line as soon as we insert that.
    I wanted to know that, for other characaters or words, can we do some sort of setting to get them repositioned anywhere in current line as soon as we enter them?
Thanks in advance,
Animesh
0
Comment
Question by:abhishek_p
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7131142
> .. are positioned at the beginning of the line as soon as we insert that.

DO you mean that the you type in a new line:

abc#

that you end up in:

#bc
0
 

Author Comment

by:abhishek_p
ID: 7131913
No, not exactly... But like this...

Since autoindent option is set and when I press return key, then cursor won't always be on the first column. It'll , in most cases, be in the middle of the line. So at this instance, when I type #, then it goes to
first column.
-> [Firstly]

                    foo[x] = abc;
                    #include

then it , automatically, becomes as,
-> [ secondly. It happens because "cindent" option is set.]

                    foo[x] = abc;
#include                           <---- This goes at the
                                         first column of
                                         the line.


My question is:
 When I type a word or character in the beginning of the line instead of "#include", then I should be able to place it in the beginning of the line.
        So what it would be good to me is, if somebody tells me how "cindent" does this placement for specific character/word?
Thanks and best regards,
0
 
LVL 20

Expert Comment

by:Gns
ID: 7217346
Ah yes, this is specially handled by cindent, since cpp macros with whitespace before the "sharp" isn't meaningful.
So you want to hack up a macro do something similar for any ol' key...
Have a look at the vim help for cindent and cinkeys etc.
In vim, type
:help cindent<Enter>

Might be useful to you.

-- Glenn
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 20

Expert Comment

by:Gns
ID: 7217404
Yup, that should do it.
See (in vim)
:help C-indenting

Should fit your ticket.

-- Glenn
0
 
LVL 20

Accepted Solution

by:
Gns earned 300 total points
ID: 8647823
"10 months late he asks" ... Did it work out for you?

-- Glenn (Who is going through the "real-old-unlocked-questions" he has commented in)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8654511
-- Glenn, seems you have daylight all night long, and family send to vacation ... :-))
0
 
LVL 20

Expert Comment

by:Gns
ID: 8654773
:-). Not yet... They'll be going at the end of next week... And no, Stockholm really is to far from the arctic circle to get light all night long...
Not like when I studied at Lulea... If you didn't look out a window at noon during the winter, you could easily miss the grayish dusk of day (approximately 1 hour)... And in the summertime... Let's say it wasn't easy sleeping... "Whoever heard of students sleeping, when they could party":-)

-- Glenn
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question