Solved

Vim Settings

Posted on 2002-07-04
7
210 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

724 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