Solved

Vim Settings

Posted on 2002-07-04
7
204 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
  • 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

822 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