Solved

Vim Settings

Posted on 2002-07-04
7
201 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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.:
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now